[kupu-checkins] r38541 - kupu/trunk/kupu/plone
duncan at codespeak.net
duncan at codespeak.net
Mon Feb 12 12:15:08 CET 2007
Author: duncan
Date: Mon Feb 12 12:15:07 2007
New Revision: 38541
Modified:
kupu/trunk/kupu/plone/plonedrawers.py
Log:
Plone Title field can contain control characters; XML cannot. Need to sanitize the titles before using them.
Modified: kupu/trunk/kupu/plone/plonedrawers.py
==============================================================================
--- kupu/trunk/kupu/plone/plonedrawers.py (original)
+++ kupu/trunk/kupu/plone/plonedrawers.py Mon Feb 12 12:15:07 2007
@@ -14,7 +14,7 @@
Python scripts, but has been moved here to make it easier to maintain.
"""
-import re
+import re, string
from thread import get_ident
from Products.CMFCore.utils import getToolByName
from AccessControl import Unauthorized, ClassSecurityInfo, getSecurityManager
@@ -33,6 +33,7 @@
HAS_PIL = True
UIDURL = re.compile(".*\\bresolveuid/([^/?#]+)")
+NOCC = nocc = string.maketrans(''.join([chr(c) for c in range(32) if c not in (9,10,13)]), "?"*29)
# mapping (thread-id, portal-physicalPath, portal_type) ->
# imagefield-getAvailableSizes (as tuple sorted by dimension) (width, height, key)
@@ -312,7 +313,7 @@
icon = self.icon(portal_type)
size, width, height = self.sizes(obj)
- title = obj.Title() or obj.getId()
+ title = (obj.Title() or obj.getId()).translate(NOCC)
description = newline_to_br(html_quote(obj.Description()))
linkable = None
More information about the kupu-checkins
mailing list