changeset 181:b19e4e36a1f2

arnica: cosmetic fixes, improve docstrings, minor i18n bugfixes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 17 Jul 2008 23:02:03 +0200
parents 17e1c3d004bf
children 4fed0b16b6fb 7e23f320ce08
files data/plugin/action/arnica_slides.py data/plugin/macro/arnica.py data/plugin/parser/text_x_arnica.py
diffstat 3 files changed, 176 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Thu Jul 17 20:25:49 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Thu Jul 17 23:02:03 2008 +0200
@@ -1,9 +1,10 @@
 # -*- coding: iso-8859-1 -*-
 """
-    MoinMoin - arnica_slides Action macro
-    This action macro is used to rotate, move to bak or to slide through the images from arnica
+    MoinMoin - arnica_slides action
 
-    based on gallery2image by ReimarBauer 2005-2008
+    This action is used to rotate, move to bak or to slide through the images from arnica.
+
+    Based on gallery2image, (c) 2005-2008 by MoinMoin:ReimarBauer.
 
     @copyright: 2008 by MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
@@ -27,26 +28,28 @@
 
 action_name = __name__.split('.')[-1]
 
+
 def image_rotate(file_name, angle, img_type):
     """ rotates the image and dependent images
 
-    @param file: the name of the attachment
-    @param angle: the angle to rotate to
-    @param img_type: type of image PNG or JPEG
+    @param file_name: the name of the attachment
+    @param angle: rotation angle
+    @param img_type: type of image (PNG or JPEG)
     """
-    # image needs to be rotated only, webnail and thumbnail
-    # will be recreated from arnica parser
+    # only image needs to be rotated, webnail and thumbnail
+    # will be recreated by the arnica parser
     image_object = Image.open(file_name)
     os.remove(file_name)
     image_object.rotate(angle).save(file_name, img_type)
 
+
 def html_js(request, counter):
-    """ javscript for the slides
+    """ javascript for the slides
+
     @param request: request object
-    @param this_image:  url of image to start
-    @param counter: index position of this_image
+    @param counter: index of first slide image
     """
-    html = '''
+    html = """
 <script type="text/javascript">
 <!-- Original:  Ricocheting (ricocheting@hotmail.com) -->
 <!-- Web Site:  http://www.ricocheting.com -->
@@ -179,22 +182,25 @@
    }
 }
 //  End -->
-</script> ''' % {
-  'htdocs': request.cfg.url_prefix_static,
-  'counter': counter}
+</script>
+""" % {
+        'htdocs': request.cfg.url_prefix_static,
+        'counter': counter,
+    }
+    return html
 
-    return html
 
 def html_slideform(request, pagename, alias, exif_date, images, original_images, idx, image_for_webnail):
     """ html code for the slideform
+
     @param request: request object
     @param pagename: pagename where the attachments are located
-    @param url_wiki_page:
     @param alias: text alias for filename
     @param exif_date: date information
-    @param images: all images
+    @param images: list of webnail image IDs (either cache keys or attachment names)
+    @param original_images: list of original image attachment names (thumbnails and webnails are derived from it)
     @param idx: index position of the image
-    @param image_for_webnail: identifier for AttchFile or arnica_slides
+    @param image_for_webnail: True: use attachments, False: use cache
     """
     if not image_for_webnail:
         url = cache.url(request, "")
@@ -208,7 +214,7 @@
     inner_table_style = ' style="border-style:none; margin:10px;"'
     this_webnail_list = "".join(["%s%s|" % (url, name) for name in images])
 
-    html = '''
+    html = """
 <div class="arnica-slides">
 <div class="navigation-animation">
 <form name=slideform method="POST" action="">
@@ -240,33 +246,38 @@
 <span id="arnica_exif_date_text">%(this_exif_date_text)s</span>
 </div>
 </div>
-''' % {
-"server": request.getQualifiedURL(),
-"htdocs": request.cfg.url_prefix_static,
-"base_url": request.getScriptname(),
-"link_url": link_to_image,
-"this_webnail_list": this_webnail_list,
-"this_webnail_name": packLine(images),
-"original_images": packLine(original_images),
-"this_alias_text": wikiutil.escape(alias[idx], 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(packLine(exif_date), quote=1),
-"this_image": image_url,
-"pagename": pagename,
-"tablestyle": inner_table_style,
-"option_webnails": option_webnail,
-}
+""" % {
+        "server": request.getQualifiedURL(),
+        "htdocs": request.cfg.url_prefix_static,
+        "base_url": request.getScriptname(),
+        "link_url": link_to_image,
+        "this_webnail_list": this_webnail_list,
+        "this_webnail_name": packLine(images),
+        "original_images": packLine(original_images),
+        "this_alias_text": wikiutil.escape(alias[idx], 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(packLine(exif_date), quote=1),
+        "this_image": image_url,
+        "pagename": pagename,
+        "tablestyle": inner_table_style,
+        "option_webnails": option_webnail,
+    }
     return html
 
+
 def option_list(this_image, pagename, text, original_images, alias, request, image_for_webnail):
     """ generates the pulldown option list
-    @param this_image: selected image  on top
+
+    @param this_image: selected image on top
     @param pagename: pagename of attachments
-    @param text: array of filenames
+    @param text: list of filenames
+    @param original_images: list of original image attachment names (thumbnails and webnails are derived from it)
+    @param alias: text alias for filename
     @param request: request object
+    @param image_for_webnail: True: use attachments, False: use cache
     """
-    # ToDo original image needs to be send to the action and used instead of the alias
+    # TODO: original image needs to be sent to the action and used instead of the alias
     txt = ''
     i = 0
     for filename in text:
@@ -288,7 +299,6 @@
                     "name": this_image,
                     "alias": original_images[i]}
         i += 1
-
     return txt
 
 
@@ -323,7 +333,7 @@
         return None
 
     def slide_show(self, pagename):
-        """ does show the slide show """
+        """ run the slide show """
         _ = self.request.getText
         request = self.request
         if not request.user.may.read(pagename):
@@ -338,7 +348,7 @@
 
         all_description = request.form.get('alias', [''])[0]
         all_exif_date = request.form.get('exif_date', [''])[0]
-        image_for_webnail = (request.form.get("image_for_webnail", [0])[0])  == u'True'
+        image_for_webnail = request.form.get("image_for_webnail", [0])[0] == u'True'
 
         if not (target and images and all_description and all_exif_date):
             msg = _("Missing required parameters!")
@@ -347,22 +357,22 @@
             return
 
         images = unpackLine(images)
-        images = (images[1:])
+        images = images[1:]
 
         original_images = unpackLine(original_images)
-        original_images = (original_images[1:])
+        original_images = original_images[1:]
 
         all_description = unpackLine(all_description)
-        all_description = (all_description[1:])
+        all_description = all_description[1:]
 
         all_exif_date = unpackLine(all_exif_date)
-        all_exif_date = (all_exif_date[1:])
+        all_exif_date = all_exif_date[1:]
 
         # XXX Check that all lists have same length
         try:
             idx = images.index(target)
         except ValueError:
-            msg =  _("Attachment '%(filename)s' does not exist!") % {'filename': target}
+            msg = _("Attachment '%(filename)s' does not exist!") % {'filename': target}
             request.theme.add_msg(msg, "error")
             Page(request, pagename).send_page()
             return
@@ -371,7 +381,7 @@
         if not image_for_webnail:
             web['src'] = cache.url(request, target)
         else:
-            web['src']  = AttachFile.getAttachUrl(pagename, target, request)
+            web['src'] = AttachFile.getAttachUrl(pagename, target, request)
 
         web['title'] = target
 
@@ -391,7 +401,7 @@
         request.theme.send_closing_html()
 
     def render(self):
-        """ does execute the commands of the form data """
+        """ executes the commands of the form data """
         _ = self.request.getText
         request = self.request
         pagename = request.form.get('pagename', [self.pagename])[0]
@@ -435,7 +445,7 @@
             cache_thumb = caching.CacheEntry(request, page, thumbfile, scope='item', use_pickle=True)
             infile = os.path.join(attachment_path, target)
 
-            if command in ('delete', 'rotate_left', 'rotate_right'):
+            if command in ('delete', 'rotate_left', 'rotate_right', ):
                 # removes cache files
                 cache_web.remove()
                 cache_thumb.remove()
@@ -445,18 +455,17 @@
                 if os.path.exists(infile + '.bak'):
                     os.unlink("%(file)s.bak" % {"file": infile})
                 filesys.rename(infile, "%(file)s.bak" % {"file": infile})
-                msg = _('%(target)s deleted, backup in place' % {
-                      'target': target})
+                msg = _('%(target)s deleted, backup in place') % {'target': target}
 
             # rotate left
             elif command == 'rotate_left':
                 image_rotate(infile, 90, img_type)
-                msg = _('%(target)s rotated to left 90 degrees' % {'target': target})
+                msg = _('%(target)s rotated left 90 degrees') % {'target': target}
 
             # rotate right
             elif command == 'rotate_right':
                 image_rotate(infile, 270, img_type)
-                msg = _('%(target)s rotated to right 90 degrees' % {'target': target})
+                msg = _('%(target)s rotated right 90 degrees') % {'target': target}
 
             else:
                 # fallback
@@ -468,11 +477,12 @@
             request.theme.add_msg(msg, "info")
             self.page.send_page()
 
+
 def execute(pagename, request):
     """ Main dispatcher for the arnica_slides action. """
     _ = request.getText
     if not Image:
-        msg = _('The action %(action)s needs python imaging library (PIL) installed' % {'action': action_name})
+        msg = _('The action %(action)s needs Python Imaging Library (PIL) installed') % {'action': action_name}
         request.theme.add_msg(msg, "error")
         Page(request, pagename).send_page()
         return
--- a/data/plugin/macro/arnica.py	Thu Jul 17 20:25:49 2008 +0200
+++ b/data/plugin/macro/arnica.py	Thu Jul 17 23:02:03 2008 +0200
@@ -2,10 +2,10 @@
 """
     MoinMoin - arnica
 
-    This macro is used to call the parser arnica,
+    This macro is used to call the arnica parser,
     it is just a thin wrapper around it.
 
-    based on Gallery2/gallery2image by ReimarBauer 2005-2008
+    Based on Gallery2/gallery2image, (c) 2005-2008 by MoinMoin:ReimarBauer
 
     @copyright: 2008 by MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
--- a/data/plugin/parser/text_x_arnica.py	Thu Jul 17 20:25:49 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Thu Jul 17 23:02:03 2008 +0200
@@ -35,7 +35,8 @@
 
 class _DataBrowserWidget(DataBrowserWidget):
     """ we have to remove the used form in format otherwise the needed form elements
-        becomes a nested form and this do raise lot's of strict html4.01 errors"""
+        becomes a nested form and this raises lots of strict html4.01 errors.
+    """
     def format(self):
         fmt = self.request.formatter
         result = []
@@ -62,7 +63,7 @@
                 result.append(fmt.strong(0))
                 if col.autofilter:
                     result.append(fmt.linebreak(False))
-                    select = '<select %s onchange="dbw_update_search(\'%s\');">%s</select>' % (
+                    select = """<select %s onchange="dbw_update_search('%s');">%s</select>""" % (
                                       self._name('filter%d' % idx),
                                       self.data_id,
                                       self._filteroptions(idx))
@@ -117,6 +118,7 @@
 
         return ''.join(result)
 
+
 def arnica_settings(target_page=u'', columns=4, file_regex=u'.',
                     image_for_webnail=False,
                     show_text=True, show_date=True, show_tools=False,
@@ -128,27 +130,27 @@
                     thumbnail_width=wikiutil.UnitArgument('128', float, ['px', ], defaultunit='px'),
                     webnail_width=wikiutil.UnitArgument('640', float, ['px', ], defaultunit='px')):
     """ dummy function to initialize all default parameters for arnica. The parameters are checked for wrong input.
+
     @param target_page: page to read attachments from. empty pagename is current page.
     @param columns: number of columns for thumbnails
     @param file_regex: regex for selecting images
     @param image_for_webnail if set then the image is shown instead of the webnail
     @param show_text: default shows description
-    @param show_date: default shows date from exif header if available
+    @param show_date: default shows date from exif header, if available
     @param show_tools: default does not show the icon toolbar
-    @param sort_by_name: default sorts images by name,
+    @param sort_by_name: default, sorts images by name
     @param sort_by_date: if set, sorts images by the modification time
-    @param sort_by_alias: if set, sorts images by the alias name, this needs also only_items enabled
-    @param reverse_sort: if set, the file list is reverse sorted
-    @param only_items: if set only images which are described in listitem are shown, e.g.
+    @param sort_by_alias: if set, sorts images by the alias name, this also needs only_items enabled
+    @param reverse_sort: if set, the file list is sorted in reverse order
+    @param only_items: if set, only images which are described in listitem are shown, e.g.
                        * [[image1.jpg|alias]]
                        * [[image2.jpg|alias]]
     @param template_itemlist: if set, an item list is shown which could be copied into the wiki page
     @param album: if set, selects album mode, only thumbnail from first image is shown, related is album title and album_image
     @param album_title: default is pagename of the images for the album.
     @param album_image: image to show on album default is the first image
-    @param renew: if set then all selected thumbnails_* and webnails_* are removed
-                  and will be recreated
-    @param thumbnail_width: default width of thumbnails is 128px
+    @param renew: if set then all selected thumbnails_* and webnails_* are removed and will be recreated
+    @param thumbnail_width: default width of thumbnail is 128px
     @param webnail_width: default width of webnail is 640px
     """
     if thumbnail_width:
@@ -163,14 +165,16 @@
             webnail_width = '%g%s' % webnail_width
     return locals()
 
+
 # ToDo may be move to wikiutil
 def get_exif_info(file_name):
     """ gets exif info from image file
+
     @param: image file name
     """
     date = "--"
     if wikiutil.isPicture(file_name):
-        # if there is no exif data available tags is an empty dict
+        # if there is no exif data available, tags is an empty dict
         exif_file = open(file_name, 'rb')
         tags = EXIF.process_file(exif_file, 'DateTimeOriginal')
         exif_file.close()
@@ -179,6 +183,7 @@
             date = date.replace(':', '-', 2)
     return date
 
+
 def _get_files(request, pagename):
     # get files dependent on isPicture and ignores tmp. files
     # ToDo remove tmp. files check later
@@ -229,65 +234,70 @@
         """
         if not self.request.user.may.delete(self.pagename):
             return ''
-        return '''
-        <form action="%(url)s" method="POST" enctype="multipart/form-data">
-            <div class="rotate-to-left">
-                <input type="hidden" name="action" value="arnica_slides">
-                <input type="hidden" name="do" value="rotate_left">
-                <input type="hidden" name="target" value="%(this_target)s">
-                <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_left.png" title="rotate to left">
-            </div>
-        </form>
-        <form action="%(url)s" method="POST" enctype="multipart/form-data">
-            <div class="rotate-to-right">
-                <input type="hidden" name="action" value="arnica_slides">
-                <input type="hidden" name="do" value="rotate_right">
-                 <input type="hidden" name="target" value="%(this_target)s">
-                <input type="image"  value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_right.png" title="rotate to right">
-            </div>
-        </form>
-        <form action="%(url)s" method="POST" enctype="multipart/form-data">
-             <div class="delete-image">
-                 <input type="hidden" name="action" value="arnica_slides">
-                 <input type="hidden" name="do" value="delete">
-                 <input type="hidden" name="target" value="%(this_target)s">
-                 <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_remove_image.png" title="move to bak">
-             </div>
-        </form>''' % {
+        return """
+<form action="%(url)s" method="POST" enctype="multipart/form-data">
+    <div class="rotate-to-left">
+        <input type="hidden" name="action" value="arnica_slides">
+        <input type="hidden" name="do" value="rotate_left">
+        <input type="hidden" name="target" value="%(this_target)s">
+        <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_left.png" title="rotate to left">
+    </div>
+</form>
+<form action="%(url)s" method="POST" enctype="multipart/form-data">
+    <div class="rotate-to-right">
+        <input type="hidden" name="action" value="arnica_slides">
+        <input type="hidden" name="do" value="rotate_right">
+         <input type="hidden" name="target" value="%(this_target)s">
+        <input type="image"  value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_right.png" title="rotate to right">
+    </div>
+</form>
+<form action="%(url)s" method="POST" enctype="multipart/form-data">
+     <div class="delete-image">
+         <input type="hidden" name="action" value="arnica_slides">
+         <input type="hidden" name="do" value="delete">
+         <input type="hidden" name="target" value="%(this_target)s">
+         <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_remove_image.png" title="move to bak">
+     </div>
+</form>
+""" % {
             'url': Page(self.request, self.pagename).url(self.request),
             'style': self.td_style,
             'htdocs': self.request.cfg.url_prefix_static,
             "pagename": wikiutil.quoteWikinameURL(self.pagename),
-            "this_target": this_target}
+            "this_target": this_target,
+        }
 
     def html_tools(self, idx):
         """ html code of thumbnails view with contol
+
         @param idx: index postion of corresponding data
         """
         this_image = self.high_resolution_image[idx]
-        text = '''
-        <form action="%(url)s" method="POST" enctype="multipart/form-data">
-            <div class="get-image">
-                <input type="hidden" name="action" value="AttachFile">
-                <input type="hidden" name="do" value="get">
-                <input type="hidden" name="target" value="%(this_target)s">
-                <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_full_image.png" title="load image">
-            </div>
-        </form>
-        <form action="%(url)s" method="POST" enctype="multipart/form-data">
-            <div class="slide-show">
-                <input type="hidden" name="action" value="arnica_slides">
-                <input type="hidden" name="do" value="slide_show">
-                <input type="hidden" name="alias" value="%(description)s">
-                <input type="hidden" name="target" value="%(target)s">
-                <input type="hidden" name="pagename" value="%(pagename)s">
-                <input type="hidden" name="images" value="%(images)s">
-                <input type="hidden" name="original_images" value="%(original_images)s">
-                <input type="hidden" name="exif_date" value="%(exif_date)s">
-                <input type="hidden" name="image_for_webnail" value="%(image_for_webnail)s">
-                <input type="image" value="submit" title="slide show" src="%(htdocs)s/arnica/img/arnica_load_slide_show.png">
-            </div>
-        </form> %(html_tools_restricted)s''' % {
+        text = """
+<form action="%(url)s" method="POST" enctype="multipart/form-data">
+    <div class="get-image">
+        <input type="hidden" name="action" value="AttachFile">
+        <input type="hidden" name="do" value="get">
+        <input type="hidden" name="target" value="%(this_target)s">
+        <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_full_image.png" title="load image">
+    </div>
+</form>
+<form action="%(url)s" method="POST" enctype="multipart/form-data">
+    <div class="slide-show">
+        <input type="hidden" name="action" value="arnica_slides">
+        <input type="hidden" name="do" value="slide_show">
+        <input type="hidden" name="alias" value="%(description)s">
+        <input type="hidden" name="target" value="%(target)s">
+        <input type="hidden" name="pagename" value="%(pagename)s">
+        <input type="hidden" name="images" value="%(images)s">
+        <input type="hidden" name="original_images" value="%(original_images)s">
+        <input type="hidden" name="exif_date" value="%(exif_date)s">
+        <input type="hidden" name="image_for_webnail" value="%(image_for_webnail)s">
+        <input type="image" value="submit" title="slide show" src="%(htdocs)s/arnica/img/arnica_load_slide_show.png">
+    </div>
+</form>
+%(html_tools_restricted)s
+""" % {
             "url": Page(self.request, self.pagename).url(self.request),
             "pagename": self.pagename,
             "htdocs": self.request.cfg.url_prefix_static,
@@ -303,8 +313,8 @@
             "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
             "this_target": self.high_resolution_image[idx],
             "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb_key[idx]),
-            "html_tools_restricted": self.html_tools_restricted(this_image)
-            }
+            "html_tools_restricted": self.html_tools_restricted(this_image),
+        }
         return text
 
     def html_show_tools(self, idx):
@@ -338,7 +348,7 @@
         if self.album:
             title = '<div class="title">%(n)d images (%(album_title)s)</div>' % {"n": len(self.high_resolution_image),
                                                         "album_title": self.album_title or self.pagename}
-        text = '''
+        text = """
 <div class="arrange-thumbnails">
     <form action="%(url)s" method="POST" enctype="multipart/form-data">
         <div class="image"> %(title)s
@@ -357,24 +367,25 @@
     %(alias_html)s
     %(date_html)s
     %(html_tools)s
-</div>'''% {
-     "title": title,
-     "tdstyle": self.td_style,
-     "style": self.inner_table_style,
-     "url": Page(self.request, self.pagename).url(self.request),
-     "pagename": self.pagename,
-     "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.webnail_image[idx],
-     "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
-     "images": packLine([self.webnail_image[idx]] + self.webnail_image),
-     "thumbnail": cache.url(self.request, self.thumb_key[idx]),
-     "thumbnail_width": self.thumbnail_width,
-     "html_tools": self.html_show_tools(idx),
-     "date_html": self.html_show_date(idx),
-     "alias_html": self.html_show_alias(idx)
-     }
+</div>
+""" % {
+            "title": title,
+            "tdstyle": self.td_style,
+            "style": self.inner_table_style,
+            "url": Page(self.request, self.pagename).url(self.request),
+            "pagename": self.pagename,
+            "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.webnail_image[idx],
+            "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
+            "images": packLine([self.webnail_image[idx]] + self.webnail_image),
+            "thumbnail": cache.url(self.request, self.thumb_key[idx]),
+            "thumbnail_width": self.thumbnail_width,
+            "html_tools": self.html_show_tools(idx),
+            "date_html": self.html_show_date(idx),
+            "alias_html": self.html_show_alias(idx),
+        }
         return text
 
     def define_thumb_webnails(self, path, files, quotes):
@@ -410,8 +421,8 @@
                 self.exif_date.append(self.formatter.text(date))
 
     def to_wikitext(self, text):
-        """
-        converts text to wiki name if it is written as WikiName or [[wikiname]]
+        """ converts text to wiki name if it is written as WikiName or [[wikiname]]
+
         @param text: text to parse and render
         """
         text = ''.join(text)
@@ -419,8 +430,8 @@
         return wikiutil.renderText(self.request, WikiParser, text)
 
     def get_quotes(self):
-        """  get's the qoutes from the itemlist  """
-        # ToDo make this more generic and use common libs of similiar modules
+        """  gets the quotes from the item list  """
+        # ToDo make this more generic and use common libs of similar modules
         quotes = self.raw.split('\n')
         quotes = [quote.strip() for quote in quotes]
         quotes = [quote[2:] for quote in quotes if quote.startswith('* ')]
@@ -481,11 +492,11 @@
             all_files.reverse()
         if all_files:
             self.define_thumb_webnails(path, all_files, quotes)
-
         return all_files
 
     def create_thumbnail_and_webnail_image(self, image, webnail, thumbnail, image_type):
-        """creates thumbnails and webnails cache files for given image type
+        """ creates thumbnails and webnails cache files for given image type
+
         @param image: filename of image
         @param webnail: name of webnail file
         @param thumbnail: name of thumbnail file
@@ -493,7 +504,7 @@
         """
         _ = self.request.getText
         if not Image:
-            msg = _('The parser %(parser)s needs python imaging library (PIL) installed' % {'parser': parser_name})
+            msg = _('The parser %(parser)s needs python imaging library (PIL) installed') % {'parser': parser_name}
             self.request.write(self.formatter.text(msg))
             return
 
@@ -525,7 +536,7 @@
                 self.request.write(self.formatter.text(msg))
                 return
 
-           # XXX later on a unit conversion method for using other units than 'px' is needed
+           # XXX later, a unit conversion method for using other units than 'px' is needed
             if not cache_web.exists():
                 if not self.image_for_webnail:
                     im_obj.thumbnail((int(self.webnail_width.strip('px')), int(self.webnail_width.strip('px'))), Image.ANTIALIAS)
@@ -564,10 +575,10 @@
 
         if self.template_itemlist:
             self.request.write(self.formatter.div(1, css_class="text"))
-            text = _("""
-            Copy the following listitems into the script.
-            Replace alias with the label you want.
-            Afterwards disable template_itemlist by setting it to False:""")
+            text = _("""\
+Copy the following listitems into the script.
+Replace alias with the label you want.
+Afterwards disable template_itemlist by setting it to False:""")
             self.request.write(self.formatter.text(text))
             self.request.write(self.formatter.div(1))
             self.request.write(self.formatter.preformatted(1))
@@ -618,9 +629,9 @@
                     self.webnail_image = self.high_resolution_image
                 text = self.html_arrange_thumbnails(i)
             except ValueError:
-                text = self.formatter.text(_("""You can't use as album image: \
-                         "%(album_image)s" because it does not exists or it is not listed \
-                         in your item list!""") % {"album_image": album_image, })
+                text = self.formatter.text(_('You can't use as album image: '
+                         '"%(album_image)s" because it does not exist or it is not listed '
+                         'in your item list!') % {"album_image": album_image, })
 
             result.append(''.join(text))
 
@@ -638,3 +649,4 @@
             self.request.write(self.formatter.div(1, css_class="arnica"))
             self.request.write(self.render(formatter))
             self.request.write(self.formatter.div(0))
+