changeset 3338:5f660b3c1cd7

moved browser_supported_images to config and exchanged it
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 19 Mar 2008 18:14:38 +0100
parents 6049339db18f
children a07ac5a0811e
files MoinMoin/action/AttachFile.py MoinMoin/config/__init__.py MoinMoin/parser/text_moin_wiki.py MoinMoin/wikiutil.py
diffstat 4 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Wed Mar 19 17:52:40 2008 +0100
+++ b/MoinMoin/action/AttachFile.py	Wed Mar 19 18:14:38 2008 +0100
@@ -951,8 +951,8 @@
 
     mt = wikiutil.MimeType(filename=filename)
 
-    # later on we can add svg too. (destinguishs if browser need a plugin in place)
-    if mt.major == 'image' and mt.minor in ('jpg', 'jpeg', 'png', 'gif'):
+    # destinguishs if browser need a plugin in place
+    if mt.major == 'image' and mt.minor in config.browser_supported_images:
         request.write('<img src="%s" alt="%s">' % (
             getAttachUrl(pagename, filename, request, escaped=1),
             wikiutil.escape(filename, 1)))
--- a/MoinMoin/config/__init__.py	Wed Mar 19 17:52:40 2008 +0100
+++ b/MoinMoin/config/__init__.py	Wed Mar 19 18:14:38 2008 +0100
@@ -11,6 +11,9 @@
 # unicode: set the char types (upper, lower, digits, spaces)
 from MoinMoin.util.chartypes import *
 
+# List of image types browser do support regulary
+browser_supported_images = ('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', )
+
 # When creating files, we use e.g. 0666 & config.umask for the mode:
 umask = 0770
 
--- a/MoinMoin/parser/text_moin_wiki.py	Wed Mar 19 17:52:40 2008 +0100
+++ b/MoinMoin/parser/text_moin_wiki.py	Wed Mar 19 18:14:38 2008 +0100
@@ -706,8 +706,8 @@
                     if mt.major == 'text':
                         desc = self._transclude_description(desc, url)
                         return self.formatter.attachment_inlined(url, desc)
-                    # later on we can add svg too. (destinguishs if browser need a plugin in place)
-                    elif mt.major == 'image' and mt.minor in ('jpg', 'jpeg', 'png', 'gif'):
+                    # destinguishs if browser need a plugin in place
+                    elif mt.major == 'image' and mt.minor in config.browser_supported_images:
                         desc = self._transclude_description(desc, url)
                         tag_attrs, query_args = self._get_params(params,
                                                                  tag_attrs={'alt': desc,
--- a/MoinMoin/wikiutil.py	Wed Mar 19 17:52:40 2008 +0100
+++ b/MoinMoin/wikiutil.py	Wed Mar 19 18:14:38 2008 +0100
@@ -2161,8 +2161,8 @@
     @rtype: bool
     @return: true if url points to a picture
     """
-    extpos = url.rfind(".")
-    return extpos > 0 and url[extpos:].lower() in ['.gif', '.jpg', '.jpeg', '.png', '.bmp', '.ico', ]
+    extpos = url.rfind(".") + 1
+    return extpos > 1 and url[extpos:].lower() in config.browser_supported_images
 
 
 def link_tag(request, params, text=None, formatter=None, on=None, **kw):