diff data/plugin/parser/text_x_arnica.py @ 37:ad1d433589e4

moved test for PIL to a better place
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 24 May 2008 12:08:08 +0200
parents 864fba4e90f3
children c208aceb1ebd
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sat May 24 11:45:53 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Sat May 24 12:08:08 2008 +0200
@@ -102,6 +102,8 @@
 except ImportError:
     Image = None
 
+parser_name = __name__.split('.')[-1]
+
 # ToDo may be move to wikiutil
 def get_exif_info(file_name):
     """ gets exif info from image file
@@ -558,6 +560,12 @@
         @param thumbnail: name of thumbnail file
         @param image_type: filetype of image
         """
+        _ = self.request.getText
+        if not Image:
+            msg = _('The parser %(parser)s needs python imaging library (PIL) installed' % {'parser': parser_name})
+            self.request.write(msg)
+            return
+    
         path = AttachFile.getAttachDir(self.request, self.pagename, create=1)
         imagef = os.path.join(path, image)