changeset 40:c208aceb1ebd

join and split exchanged on various places to packLine and unpackLine
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 02 Jun 2008 18:51:22 +0200
parents a30075ec4b43
children edc8b8c5ccdd
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Mon Jun 02 17:05:43 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Mon Jun 02 18:51:22 2008 +0200
@@ -16,6 +16,7 @@
 
 from MoinMoin import  caching, config, wikiutil
 from MoinMoin.Page import Page
+from MoinMoin.packages import packLine, unpackLine
 from MoinMoin.action import AttachFile
 from MoinMoin.formatter.text_html import Formatter
 from MoinMoin.util import filesys, timefuncs
@@ -82,7 +83,7 @@
 
 function arnica_preload() {
    var list = document.slideform.webnail_list.value;
-   var value = list.split(",");
+   var value = list.split("|");
    var n = value.length;
 
    for (i = 0; i <  n-1; i++){
@@ -106,8 +107,8 @@
   var alias_text = document.slideform.alias.value;
   var exif_date_text = document.slideform.exif_date.value;
   var index = document.slideform.slide.selectedIndex;
-  var alias = alias_text.split("!,!");
-  var exif = exif_date_text.split(",");
+  var alias = alias_text.split("|");
+  var exif = exif_date_text.split("|");
   document.getElementById("arnica_alias_text").innerHTML = alias[index];
   document.getElementById("arnica_exif_date_text").innerHTML = exif[index];
 }
@@ -202,7 +203,7 @@
 
     option_webnail = option_list(url + images[idx], pagename, images, request, image_for_webnail)
     inner_table_style = ' style="border-style:none; margin:10px;"'
-    this_webnail_list = "".join(["%s%s," % (url, name) for name in images])
+    this_webnail_list = "".join(["%s%s|" % (url, name) for name in images])
     
     html = '''
 <form name=slideform method="POST">
@@ -260,11 +261,11 @@
 "htdocs": request.cfg.url_prefix_static,
 "base_url": request.getScriptname(),
 "this_webnail_list": this_webnail_list,
-"this_webnail_name": ','.join(images),
+"this_webnail_name": packLine(images),
 "this_alias_text": wikiutil.escape(alias[idx], quote=1),
-"this_alias_list": wikiutil.escape('!,!'.join(alias), quote=1),
+"this_alias_list": wikiutil.escape(packLine(alias), quote=1),
 "this_exif_date_text": wikiutil.escape(exif_date[idx], quote=1),
-"this_exif_date_list": wikiutil.escape(','.join(exif_date), quote=1),
+"this_exif_date_list": wikiutil.escape(packLine(exif_date), quote=1),
 
 "this_image": url + images[idx],
 "pagename": pagename,
@@ -354,16 +355,16 @@
         if command == 'VS':
             web = {}
             images = request.form.get('images', [''])[0]
-            images = images.split(',')
+            images = unpackLine(images)
             images = (images[1:])
 
             all_description = request.form.get('alias', [''])[0]
-            all_description = all_description.split('!,!')
+            all_description = unpackLine(all_description)
             #this_description = all_description[0]
             all_description = (all_description[1:])
 
             all_exif_date = request.form.get('exif_date', [''])[0]
-            all_exif_date = all_exif_date.split(',')
+            all_exif_date = unpackLine(all_exif_date)
             all_exif_date = (all_exif_date[1:])
 
             # XXX Check that all lists have same length
--- a/data/plugin/parser/text_x_arnica.py	Mon Jun 02 17:05:43 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Jun 02 18:51:22 2008 +0200
@@ -94,6 +94,7 @@
 from random import randint
 from MoinMoin import caching, wikiutil
 from MoinMoin.action import AttachFile
+from MoinMoin.packages import packLine
 from MoinMoin.Page import Page
 from MoinMoin.filter import EXIF
 
@@ -253,10 +254,10 @@
             "tablestyle": self.inner_table_style,
             "style": self.td_style,
             "thumbnail_width": self.thumbnail_width,
-            "description": self.description[idx] + '!,!' + '!,!'.join(self.description),
-            "exif_date": self.exif_date[idx] + ',' + ','.join(self.exif_date),
+            "description": packLine([self.description[idx]] + self.description),
+            "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
             "target": self.webimg[idx],
-            "images": self.webimg[idx] + ',' + ','.join(self.webimg),
+            "images": packLine([self.webimg[idx]] + self.webimg),
             "this_target": self.full[idx],
             "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb[idx]),
             "show_tools_restricted": self.show_tools_restricted(this_image)
@@ -319,11 +320,11 @@
      "baseurl": self.request.getScriptname(),
      "pagename": wikiutil.quoteWikinameURL(self.pagename),
      "thumbnail_width": self.thumbnail_width,
-     "description": self.description[idx] + '!,!' + '!,!'.join(self.description),
-     "exif_date": self.exif_date[idx] + ',' + ','.join(self.exif_date),
+     "description": packLine([self.description[idx]] + self.description),
+     "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
      "image_for_webnail": self.image_for_webnail,
      "target": self.webimg[idx],
-     "images": self.webimg[idx] + ',' + ','.join(self.webimg),
+     "images": packLine([self.webimg[idx]] + self.webimg),
      "thumbnail": self.thumb[idx],
      "tools_html": self.show_tools_mode2(idx),
      "date_html": self.show_date_mode2(idx),
@@ -394,11 +395,11 @@
      "style": self.inner_table_style,
      "baseurl": self.request.getScriptname(),
      "pagename": wikiutil.quoteWikinameURL(self.pagename),
-     "description": self.description[idx] + '!,!' + '!,!'.join(self.description),
-     "exif_date": self.exif_date[idx] + ',' + ','.join(self.exif_date),
+     "description": packLine([self.description[idx]] + self.description),
+     "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
      "image_for_webnail": self.image_for_webnail,
      "target": self.webimg[idx],
-     "images": self.webimg[idx] + ',' + ','.join(self.webimg),
+     "images": packLine([self.webimg[idx]] + self.webimg),
      "thumbnail": self.thumb[idx],
      "thumbnail_width": self.thumbnail_width,
      "tools_html": self.show_tools_mode1(idx),