From 4586801c9e729eea0154525f6f509a5d95bace9a Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 17 Mar 2007 16:57:43 +0000 Subject: [PATCH] make attributes editable via XML-RPC git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1648 fd906abe-77d9-0310-91a1-e0d9ade77398 --- xmlrpc/README.txt | 8 +++++++- xmlrpc/common.py | 9 +++++++++ xmlrpc/configure.zcml | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/xmlrpc/README.txt b/xmlrpc/README.txt index 0318600..2d88572 100755 --- a/xmlrpc/README.txt +++ b/xmlrpc/README.txt @@ -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 diff --git a/xmlrpc/common.py b/xmlrpc/common.py index 76ce7c5..f04bf86 100644 --- a/xmlrpc/common.py +++ b/xmlrpc/common.py @@ -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) diff --git a/xmlrpc/configure.zcml b/xmlrpc/configure.zcml index ccf615d..3c2f12f 100644 --- a/xmlrpc/configure.zcml +++ b/xmlrpc/configure.zcml @@ -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" />