[kupu-checkins] r33453 - kupu/trunk/kupu/plone

duncan at codespeak.net duncan at codespeak.net
Thu Oct 19 13:22:21 CEST 2006


Author: duncan
Date: Thu Oct 19 13:22:20 2006
New Revision: 33453

Modified:
   kupu/trunk/kupu/plone/html2captioned.py
   kupu/trunk/kupu/plone/plonedrawers.py
Log:
Portal type kludging needs to be done in another place also.

Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py	(original)
+++ kupu/trunk/kupu/plone/html2captioned.py	Thu Oct 19 13:22:20 2006
@@ -160,6 +160,7 @@
     r'(?P<prefix>\<(?:img\s[^>]*src|a\s[^>]*href)=(?:"?))(?P<href>(?<=")[^"]*|[^ \/>]*)',
     re.IGNORECASE)
 FRAGMENT_TYPE = 'CompositePack Fragments'
+NAVIGATION_PAGE = 'Navigation Page'
 
 class Migration:
     FIELDS = ('portal_type', 'typename', 'fieldname',
@@ -250,7 +251,7 @@
         query = {}
         if self.portal_type:
             if self.portal_type==FRAGMENT_TYPE:
-                query['portal_type'] = 'Navigation Page'
+                query['portal_type'] = NAVIGATION_PAGE
             else:
                 query['portal_type'] = self.portal_type
         if self.paths:
@@ -568,3 +569,10 @@
         if prev+10 < len(data):
             out.append('...')
     return ''.join(out)
+
+def sanitize_portal_type(pt):
+    """Performs portal type mapping prior to database query.
+    Needed for CompositePack pages"""
+    if pt==FRAGMENT_TYPE:
+        return NAVIGATION_PAGE
+    return pt

Modified: kupu/trunk/kupu/plone/plonedrawers.py
==============================================================================
--- kupu/trunk/kupu/plone/plonedrawers.py	(original)
+++ kupu/trunk/kupu/plone/plonedrawers.py	Thu Oct 19 13:22:20 2006
@@ -23,6 +23,7 @@
 from Products.Archetypes.interfaces.referenceable import IReferenceable
 from Products.PythonScripts.standard import html_quote, newline_to_br
 from Products.kupu.plone.librarytool import KupuError
+import html2captioned
 
 try:
     from PIL import Image
@@ -720,7 +721,7 @@
         """Returns a list of all kupu editable fields"""
         inuse = getToolByName(self, 'portal_catalog').uniqueValuesFor('portal_type')
         for t,f,pt in self._getKupuFields():
-            if pt in inuse or not filter:
+            if html2captioned.sanitize_portal_type(pt) in inuse or not filter:
                 yield { 'type': t, 'name': f.getName(), 'label': f.widget.label, 'portal_type':pt }
 
     def _getKupuFields(self):


More information about the kupu-checkins mailing list