block assignment or deassignment of hasType relations via XML-RPC
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2540 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
828dfda5c5
commit
c9e8430fc9
2 changed files with 20 additions and 4 deletions
|
@ -158,11 +158,17 @@ Updating the concept map
|
||||||
|
|
||||||
>>> zopeId = xrf.getObjectByName('zope')['id']
|
>>> zopeId = xrf.getObjectByName('zope')['id']
|
||||||
>>> zope3Id = xrf.getObjectByName('zope3')['id']
|
>>> zope3Id = xrf.getObjectByName('zope3')['id']
|
||||||
>>> xrf.assignChild(zopeId, zope3Id, defaultPred['id'])
|
>>> xrf.assignChild(zopeId, defaultPred['id'], zope3Id)
|
||||||
'OK'
|
'OK'
|
||||||
|
>>> pa = xrf.getParents(zope3Id)
|
||||||
|
>>> len(pa)
|
||||||
|
2
|
||||||
|
|
||||||
>>> xrf.deassignChild(zopeId, zope3Id, defaultPred['id'])
|
>>> xrf.deassignChild(zopeId, defaultPred['id'], zope3Id)
|
||||||
'OK'
|
'OK'
|
||||||
|
>>> pa = xrf.getParents(zope3Id)
|
||||||
|
>>> len(pa)
|
||||||
|
1
|
||||||
|
|
||||||
>>> topicId = xrf.getObjectByName('topic')['id']
|
>>> topicId = xrf.getObjectByName('topic')['id']
|
||||||
>>> xrf.createConcept(topicId, u'zope2', u'Zope 2')
|
>>> xrf.createConcept(topicId, u'zope2', u'Zope 2')
|
||||||
|
@ -176,6 +182,12 @@ parameter is empty, the name will be generated from the title.
|
||||||
{'description': u'', 'title': u'Python', 'type': '24', 'id': '58',
|
{'description': u'', 'title': u'Python', 'type': '24', 'id': '58',
|
||||||
'name': u'python'}
|
'name': u'python'}
|
||||||
|
|
||||||
|
If we try to deassign a ``hasType`` relation nothing will happen; a
|
||||||
|
corresponding error value will be returned.
|
||||||
|
|
||||||
|
>>> xrf.deassignChild(topicId, typePred['id'], zope3Id)
|
||||||
|
'Not allowed'
|
||||||
|
|
||||||
Changing the attributes of a concept
|
Changing the attributes of a concept
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -120,15 +120,19 @@ class LoopsMethods(MethodPublisher, I18NView):
|
||||||
return mapping
|
return mapping
|
||||||
|
|
||||||
def assignChild(self, objId, predicateId, childId):
|
def assignChild(self, objId, predicateId, childId):
|
||||||
obj = getObjectForUid(objId)
|
|
||||||
pred = getObjectForUid(predicateId)
|
pred = getObjectForUid(predicateId)
|
||||||
|
if pred == self.typePredicate:
|
||||||
|
return 'Not allowed'
|
||||||
|
obj = getObjectForUid(objId)
|
||||||
child = getObjectForUid(childId)
|
child = getObjectForUid(childId)
|
||||||
obj.assignChild(child, pred)
|
obj.assignChild(child, pred)
|
||||||
return 'OK'
|
return 'OK'
|
||||||
|
|
||||||
def deassignChild(self, objId, predicateId, childId):
|
def deassignChild(self, objId, predicateId, childId):
|
||||||
obj = getObjectForUid(objId)
|
|
||||||
pred = getObjectForUid(predicateId)
|
pred = getObjectForUid(predicateId)
|
||||||
|
if pred == self.typePredicate:
|
||||||
|
return 'Not allowed'
|
||||||
|
obj = getObjectForUid(objId)
|
||||||
child = getObjectForUid(childId)
|
child = getObjectForUid(childId)
|
||||||
obj.deassignChild(child, [pred])
|
obj.deassignChild(child, [pred])
|
||||||
return 'OK'
|
return 'OK'
|
||||||
|
|
Loading…
Add table
Reference in a new issue