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
This commit is contained in:
parent
e6afb6c328
commit
fe8d2792d3
2 changed files with 9 additions and 1 deletions
7
util.py
7
util.py
|
@ -67,3 +67,10 @@ def getUidForObject(obj):
|
||||||
return '*'
|
return '*'
|
||||||
intIds = component.getUtility(IIntIds)
|
intIds = component.getUtility(IIntIds)
|
||||||
return str(intIds.queryId(obj))
|
return str(intIds.queryId(obj))
|
||||||
|
|
||||||
|
|
||||||
|
def toUnicode(text):
|
||||||
|
if type(text) is not unicode:
|
||||||
|
return text.decode('UTF-8')
|
||||||
|
else:
|
||||||
|
return text
|
||||||
|
|
|
@ -32,7 +32,7 @@ from zope.security.proxy import removeSecurityProxy
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from loops.concept import Concept
|
from loops.concept import Concept
|
||||||
from loops.util import getUidForObject, getObjectForUid
|
from loops.util import getUidForObject, getObjectForUid, toUnicode
|
||||||
|
|
||||||
class LoopsMethods(MethodPublisher):
|
class LoopsMethods(MethodPublisher):
|
||||||
""" XML-RPC methods for the loops root object.
|
""" XML-RPC methods for the loops root object.
|
||||||
|
@ -113,6 +113,7 @@ class LoopsMethods(MethodPublisher):
|
||||||
|
|
||||||
def createConcept(self, typeId, name, title):
|
def createConcept(self, typeId, name, title):
|
||||||
type = getObjectForUid(typeId)
|
type = getObjectForUid(typeId)
|
||||||
|
title = toUnicode(title)
|
||||||
c = self.concepts[name] = Concept(title)
|
c = self.concepts[name] = Concept(title)
|
||||||
c.conceptType = type
|
c.conceptType = type
|
||||||
notify(ObjectCreatedEvent(c))
|
notify(ObjectCreatedEvent(c))
|
||||||
|
|
Loading…
Add table
Reference in a new issue