changeset 17:cb6ad4cfdc5e

PEP8 whitespace fix
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 22 May 2008 18:24:46 +0200
parents 22e4dacd1d37
children 72099349b4a8
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 44 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Thu May 22 18:20:12 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Thu May 22 18:24:46 2008 +0200
@@ -227,7 +227,7 @@
 
         option_webnail = self.option_list(static_url + target[idx], pagename, target, request)
         static_path, static_url = self.get_path_url(request, pagename, attachment_path)
-        
+
         inner_table_style = ' style="border-style:none; margin:10px;"'
 
         this_webnail_list = ''
@@ -348,8 +348,7 @@
         pagename = self.pagename
         page = Page(request, pagename)
         arena_dir = caching.get_arena_dir(request, page, 'item')
-        
-        
+
         if not Image:
             msg = _('The action %(action)s needs python imaging library (PIL) installed' % {'action': action_name})
             request.theme.add_msg(msg, "error")
@@ -360,7 +359,7 @@
         attachment_path = AttachFile.getAttachDir(request, self.pagename)
         command = request.form.get('do', ['none'])[0]
         target = request.form.get('target', [None])[0]
-        
+
         if command == 'VS':
             web = {}
             images = request.form.get('target', [''])[0]
@@ -421,8 +420,8 @@
 
             thumbf = os.path.join(arena_dir, thumbfile)
             webf = os.path.join(arena_dir, webnail)
-            cache_web = caching.CacheEntry(request, page, webnail, scope='item', use_pickle=True)        
-            cache_thumb= caching.CacheEntry(request, page, thumbfile, scope='item', use_pickle=True) 
+            cache_web = caching.CacheEntry(request, page, webnail, scope='item', use_pickle=True)
+            cache_thumb = caching.CacheEntry(request, page, thumbfile, scope='item', use_pickle=True)
 
             infile = os.path.join(attachment_path, target)
 
@@ -434,7 +433,7 @@
                 filesys.rename(infile, "%(file)s.bak" % {"file": infile})
                 cache_web.remove()
                 cache_thumb.remove()
-                
+
                 msg = _('%(target)s deleted, backup in place' % {
                       'target':target})
             # rotate left
@@ -446,14 +445,14 @@
             elif command == 'RR':
                 self.image_rotate(infile, webf, thumbf, 270, img_type)
                 msg = _('%(target)s rotated to right 90 degrees' % {'target':target})
-                
+
             elif command == 'view':
                 if not target:
-                    return 
+                    return
                 if not request.user.may.read(pagename):
                     return _('You are not allowed to view attachments of this page.')
-                
-                
+
+
                 fpath = os.path.join(arena_dir, target)
                 if not os.path.exists(fpath):
                     return
@@ -464,17 +463,17 @@
                     mt = wikiutil.MimeType(filename=target)
                     content_type = mt.content_type()
                     mime_type = mt.mime_type()
-        
+
                     content_dispo = 'inline'
                     filename_enc = target.encode(config.charset)
-                
+
                     request.emit_http_headers([
                         'Content-Type: %s' % content_type,
                         'Last-Modified: %s' % timestamp,
                         'Content-Length: %d' % os.path.getsize(fpath),
                         'Content-Disposition: %s; filename="%s"' % (content_dispo, filename_enc),
                         ])
-                    
+
                     # send data
                     request.send_file(open(fpath, 'rb'))
             else:
--- a/data/plugin/parser/text_x_arnica.py	Thu May 22 18:20:12 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Thu May 22 18:24:46 2008 +0200
@@ -85,7 +85,7 @@
     import Image
 except ImportError:
     Image = None
-    
+
 # ToDo may be move to wikiutil    
 def get_exif_info(file_name):
     """ gets exif info from image file 
@@ -101,7 +101,7 @@
             date = date.replace(':', '-', 2)
 
     return date
-    
+
 class Parser:
     """ arnica parser """
     extensions = '*.jpg'
@@ -131,7 +131,7 @@
         self.webnail_width = '640'
         self.text_width = '140'
         # list of optional arguments for the parser ends here
-        
+
         # get the paraemters
         test = kw.get('format_args', '')
         if test:
@@ -141,7 +141,7 @@
                     setattr(self, key, wikiutil.escape(value.strip(), quote=1))
         # calc
         self.width = str(int(self.thumbnail_width) + int(self.text_width))
-        
+
         self.pagename = request.page.page_name
         self.raw = raw
         self.request = request
@@ -151,7 +151,7 @@
         self.outer_table_style = ' border="%s"' % self.border_thick
         self.inner_table_style = ' style="border-style:none; margin:10px;"'
         self.td_style = ' align="center" style="padding:0; margin:2px 2px; border-style:none"'
-        
+
         self.web = [] # array for webnails
         self.full = [] # array for  images
         self.thumb = [] # array for thumbnails
@@ -159,7 +159,7 @@
         self.imgtype = [] # array of imagetype of full image 
         self.description = [] # array of description
         self.webimg = [] # array of images for forms
-        
+
     def show_tools_restricted(self, this_target):
         """ show only tools to users with enough rights 
         @param this_target: image
@@ -391,16 +391,16 @@
         if len(quotes['image']) > 0:
             i = 0
             for txt in quotes['image']:
-                ddict[txt] = quotes['alias'][i]               
-                i += 1            
-            
+                ddict[txt] = quotes['alias'][i]
+                i += 1
+
         for attfile in files:
             # only files not thumb or webnails
             if not attfile.startswith('tmp.'):
                 # only images
                 if wikiutil.isPicture(attfile):
                     self.description.append(ddict.get(attfile, attfile))
-                    
+
                     self.full.append(attfile)
 
                     fname, ext = os.path.splitext(attfile)
@@ -417,7 +417,7 @@
                     if os.path.exists(att_file):
                         self.web.append(webnail)
                         self.thumb.append(thumbfile)
-                        
+
                         date = get_exif_info(att_file)
                         self.exif_date.append(wikiutil.escape(date, quote=1))
 
@@ -469,10 +469,10 @@
  * [[image1.jpg|alias]] <br>
  * [[image2.jpg|alias]] <br>
 }}}''')
-        
+
     def select_files(self, formatter):
         """ select files """
-        
+
         # we need to take the page_name from the formatter.page otherwise 
         # include does not work
         self.pagename = formatter.page.page_name
@@ -496,13 +496,13 @@
                 keys = image_dict.keys()
                 keys.sort()
                 all_files = [image_dict[txt] for txt in keys]
-                
+
         else:
             all_files = os.listdir(path)
-        
+
         if self.filter != '.':
             all_files = [attfile for attfile in all_files if re.match(self.filter, attfile)]
-            
+
         if self.sort_by_name == '1' and self.only_items == '0':
             all_files.sort()
 
@@ -510,21 +510,21 @@
             for attfile in all_files:
                 infile = os.path.join(path, attfile)
                 ft_file = "%s%s" % (str(os.path.getmtime(infile)), str(randint(0, 65535)))
-                image_dict[ft_file] = attfile   
+                image_dict[ft_file] = attfile
             keys = image_dict.keys()
             keys.sort()
             all_files = [image_dict[txt] for txt in keys]
-            
+
         image_dict.clear()
-        
+
         if self.reverse_sort == '1':
             all_files.reverse()
 
         if all_files:
-            self.get_files(path, all_files, quotes)        
-        
+            self.get_files(path, all_files, quotes)
+
         return all_files
-    
+
     def create_thumbnail_and_webnail(self, image, webnail, thumbnail, image_type):
         """creates thumbnails and webnails cache files for given image type
         @param image: filename of image
@@ -535,10 +535,10 @@
         path = AttachFile.getAttachDir(self.request, self.pagename, create=1)
         imagef = os.path.join(path, image)
 
-       
+
         page = Page(self.request, self.pagename)
-        cache_web = caching.CacheEntry(self.request, page, webnail, scope='item', use_pickle=True)        
-        cache_thumb= caching.CacheEntry(self.request, page, thumbnail, scope='item', use_pickle=True) 
+        cache_web = caching.CacheEntry(self.request, page, webnail, scope='item', use_pickle=True)
+        cache_thumb = caching.CacheEntry(self.request, page, thumbnail, scope='item', use_pickle=True)
 
         arena_dir = caching.get_arena_dir(self.request, page, 'item')
         webf = os.path.join(arena_dir, webnail)
@@ -556,12 +556,12 @@
                 else:
                     im_obj.thumbnail((int(self.webnail_width), int(self.webnail_width)), Image.ANTIALIAS)
                     im_obj.save(webf, image_type)
-                    
+
             if not cache_thumb.exists():
                 im_obj.thumbnail(((int(self.thumbnail_width)), ((int(self.thumbnail_width)))),
                                Image.ANTIALIAS)
                 im_obj.save(thumbf, image_type)
-                
+
     def format(self, formatter):
         """ does the format """
         _ = self._
@@ -577,7 +577,7 @@
         if not self.select_files(formatter):
             self.request.write(_("No matching image file found!"))
             return
-        
+
         if self.template_itemlist == '1':
             self.request.write(_("Copy the following listitems into the script. Replace alias with the label you want. Afterwards disable template_itemlist by setting it to 0:"))
             self.request.write('<br>')
@@ -607,7 +607,7 @@
             # on a slow machine. Otherwise he does see until it is finished nothing and may
             # believe it is broken.
             self.create_thumbnail_and_webnail(image, self.web[i], self.thumb[i], self.imgtype[i])
-            
+
             if self.image_for_webnail == '1':
                 self.webimg = self.full
             else:
@@ -619,10 +619,10 @@
 
             if self.mode == '2':
                 text = self.mode2_html(i)
-                if cols > 1: 
+                if cols > 1:
                     self.request.write('<table valign="bottom">')
                 self.request.write(''.join(text))
-                if cols > 1: 
+                if cols > 1:
                     self.request.write('</table>')
 
             if self.mode == '1' or cols > 1: