make attributes editable via XML-RPC
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1648 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
685ac858b0
commit
4586801c9e
3 changed files with 18 additions and 3 deletions
|
@ -181,7 +181,13 @@ Updating the concept map
|
|||
Changing the attributes of a concept
|
||||
------------------------------------
|
||||
|
||||
Not implemented yet.
|
||||
>>> xrf.editConcept(john['id'], 'firstName', u'John')
|
||||
'OK'
|
||||
>>> john = xrf.getObjectById(john['id'])
|
||||
>>> john['firstName']
|
||||
u'John'
|
||||
>>> john['lastName']
|
||||
u''
|
||||
|
||||
|
||||
Fin de partie
|
||||
|
|
|
@ -129,6 +129,15 @@ class LoopsMethods(MethodPublisher):
|
|||
notify(ObjectModifiedEvent(c))
|
||||
return objectAsDict(c)
|
||||
|
||||
def editConcept(self, objId, attr, value):
|
||||
obj = getObjectForUid(objId)
|
||||
ti = IType(obj).typeInterface
|
||||
if ti is not None:
|
||||
obj = ti(obj)
|
||||
setattr(obj, attr, toUnicode(value))
|
||||
notify(ObjectModifiedEvent(obj))
|
||||
return 'OK'
|
||||
|
||||
|
||||
def objectAsDict(obj):
|
||||
objType = IType(obj)
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
methods="getStartObject getObjectById getObjectByName
|
||||
getDefaultPredicate getTypePredicate getTypeConcept
|
||||
getConceptTypes getPredicates
|
||||
getChildren getParents
|
||||
assignChild deassignChild createConcept"
|
||||
getChildren getParents getResources
|
||||
assignChild deassignChild createConcept editConcept"
|
||||
permission="loops.xmlrpc.ManageConcepts"
|
||||
/>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue