changeset 214:e7bf7e714d13

ToDo's for further refactoring added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 01 Sep 2008 10:10:28 +0200
parents ffaf11b6c429
children 63bb59fda932
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Mon Sep 01 09:51:16 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Mon Sep 01 10:10:28 2008 +0200
@@ -39,6 +39,7 @@
     # only image needs to be rotated, webnail and thumbnail
     # will be recreated by the arnica parser
     image_object = Image.open(file_name)
+    # XXX only after success kill the original file, rename first? 
     os.remove(file_name)
     try:
         image_object.rotate(angle).save(file_name, img_type)
@@ -395,6 +396,7 @@
 
         request.write(request.formatter.startContent("content"))
         html = html_slideform(request, pagename, all_description, all_exif_date, images, original_images, idx, image_for_webnail)
+        #XXX f.rawHTML(html)
         request.write(html)
         request.write(request.formatter.endContent())
         request.write(request.theme.send_footer(pagename))
@@ -408,6 +410,7 @@
         page = Page(request, pagename)
         msg = None
 
+        # XXX check why this is needed
         request.formatter = Formatter(request)
         command = request.form.get('do', ['none'])[0]
         target = request.form.get('target', [''])[0]
@@ -419,6 +422,7 @@
         # only users which are allowed to delete should use this tool
         elif request.user.may.delete(pagename):
             # only POST continues
+            # ToDo simplify
             if not request.request_method == 'POST':
                 msg = _('Missing parameters or GET method used')
                 request.theme.add_msg(msg, "error")
@@ -426,7 +430,7 @@
                 return
 
             filename, ext = os.path.splitext(target)
-
+            # ToDo simplify
             if ext in ('.gif', '.png'):
                 img_type = 'PNG'
                 thumbfile = "tmp.thumbnail_%(file)s.png" % {"file": filename}
@@ -443,6 +447,7 @@
             infile = AttachFile.getFilename(request, pagename, target)
 
             # removes attachment (moves to bak)
+            # ToDo simplify call AttachFile.move_attachment
             if command == 'delete':
                 if os.path.exists(infile + '.bak'):
                     os.unlink("%(file)s.bak" % {"file": infile})
--- a/data/plugin/parser/text_x_arnica.py	Mon Sep 01 09:51:16 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Sep 01 10:10:28 2008 +0200
@@ -95,6 +95,7 @@
 
 class Parser:
     """ arnica parser """
+    # ToDo check when only * is used for side effects 
     extensions = '*.jpg'
     def __init__(self, raw, request, **kw):
         self.pagename = request.page.page_name
@@ -148,7 +149,7 @@
                 cache_date = caching.CacheEntry(self.request, cache.cache_arena, date_key+'.data',
                                        cache.cache_scope, do_locking=False)
                 return cache_date.content()
-
+            # ToDo simplify try, except, else
             try:
                 im = Image.open(file_name)
                 rawExif = im._getexif().items()
@@ -209,6 +210,7 @@
 
         @param idx: index postion of corresponding data
         """
+        # ToDo s/text/html/
         this_image = self.high_resolution_image[idx]
         text = """
 <form action="%(url)s" method="POST" enctype="multipart/form-data">
@@ -256,6 +258,7 @@
 
     def html_show_tools(self, idx):
         """ shows toolbox """
+        # ToDo s/text/html/
         text = ''
         if self.show_tools:
             text = '<div class="html-show-tools">%(tools)s</div>' % {
@@ -265,6 +268,7 @@
 
     def html_show_date(self, idx):
         """ shows date """
+        # ToDo s/text/html/
         text = ''
         if self.show_date:
             text = '<div class="html-show-date">%(this_exif_date)s</div>' % {
@@ -273,6 +277,7 @@
 
     def html_show_alias(self, idx):
         """ view mode 1 alias text below image """
+        # ToDo s/text/html/
         text = ''
         if self.show_text:
             text = '<div class="html-show-alias"> %(this_alias)s</div>' % {
@@ -281,6 +286,7 @@
 
     def html_arrange_thumbnails(self, idx):
         """ defines arrangement of thumbnail, text, date and tools """
+        # ToDo s/text/html/
         title = ""
         if self.album:
             title = '<div class="title">%(n)d images (%(album_title)s)</div>' % {"n": len(self.high_resolution_image),
@@ -332,6 +338,7 @@
         @param quotes: text alias for image file
         """
         ddict = {}
+        # ToDo simplify
         if len(quotes['image']) > 0:
             i = 0
             for txt in quotes['image']:
@@ -467,6 +474,7 @@
 
            # XXX later, a unit conversion method for using other units than 'px' is needed
             if not cache.exists(self.request, webnail):
+                # ToDo check if we can make the code simpler if we handle this option similiar than the other cache files
                 if not self.image_for_webnail:
                     try:
                         exif = im_obj._getexif()
@@ -548,6 +556,7 @@
             self.request.write(self.formatter.preformatted(0))
             self.request.write(self.formatter.div(0))
             self.request.write(self.formatter.div(0))
+        # ToDo lowercase COLUMNS
         COLUMNS = min([self.columns, len(self.high_resolution_image)])
         if self.album:
             COLUMNS = 1