diff MoinMoin/themes/__init__.py @ 216:661a57c747bd

replace mimetype by contenttype, use more constants to deal correctly with text items, we do not just need the simple mimetype like "text/plain", but rather the contenttype like "text/plain;charset=utf-8" or, for content from moin 1.9, "text/x.moin.wiki;format=1.9;charset=utf-8" to make moin use the moinwiki19_in converter. this changeset mostly deals with the stupid task of renaming the constant, the attributes, the arguments, qs arg names, etc. - so that everything that does not mean a basic mimetype major/minor should be named contenttype now. it also fixes a few places that used strings and not the constants from MoinMoin.config or where imports were missing. further changes will be needed to really deal with the charset and other params. also, the value of MoinMoin.config.CONTENTTYPE will need to get changed later.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 May 2011 20:22:30 +0200
parents e8f61cbd661b
children 1a1dab306214
line wrap: on
line diff
--- a/MoinMoin/themes/__init__.py	Wed May 04 01:32:54 2011 +0200
+++ b/MoinMoin/themes/__init__.py	Sat May 07 20:22:30 2011 +0200
@@ -361,20 +361,20 @@
     'application/pdf': 'pdf',
-def mimetype_to_class(mimetype):
+def contenttype_to_class(contenttype):
-    Convert a mimetype string to a css class.
+    Convert a contenttype string to a css class.
-    cls = MIMETYPE_TO_CLASS.get(mimetype)
+    cls = MIMETYPE_TO_CLASS.get(contenttype)
     if not cls:
         # just use the major part of mimetype
-        cls = mimetype.split('/', 1)[0]
+        cls = contenttype.split('/', 1)[0]
     return 'moin-mime-%s' % cls
 def setup_jinja_env():
     app.jinja_env.filters['shorten_item_name'] = shorten_item_name
-    app.jinja_env.filters['mimetype_to_class'] = mimetype_to_class
+    app.jinja_env.filters['contenttype_to_class'] = contenttype_to_class
     # please note that these filters are installed by flask-babel:
     # datetimeformat, dateformat, timeformat, timedeltaformat