From fe8d2792d344553f8beda371539a317d7d1a3beb Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 25 Feb 2007 18:41:08 +0000 Subject: [PATCH] bugfix XML-RPC: make sure title is stored as unicode git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1600 fd906abe-77d9-0310-91a1-e0d9ade77398 --- util.py | 7 +++++++ xmlrpc/common.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/util.py b/util.py index d28790b..4e0c09f 100644 --- a/util.py +++ b/util.py @@ -67,3 +67,10 @@ def getUidForObject(obj): return '*' intIds = component.getUtility(IIntIds) return str(intIds.queryId(obj)) + + +def toUnicode(text): + if type(text) is not unicode: + return text.decode('UTF-8') + else: + return text diff --git a/xmlrpc/common.py b/xmlrpc/common.py index 6421f4e..f84d419 100644 --- a/xmlrpc/common.py +++ b/xmlrpc/common.py @@ -32,7 +32,7 @@ from zope.security.proxy import removeSecurityProxy from zope.cachedescriptors.property import Lazy from loops.concept import Concept -from loops.util import getUidForObject, getObjectForUid +from loops.util import getUidForObject, getObjectForUid, toUnicode class LoopsMethods(MethodPublisher): """ XML-RPC methods for the loops root object. @@ -113,6 +113,7 @@ class LoopsMethods(MethodPublisher): def createConcept(self, typeId, name, title): type = getObjectForUid(typeId) + title = toUnicode(title) c = self.concepts[name] = Concept(title) c.conceptType = type notify(ObjectCreatedEvent(c))