getMainObject() ok quelque soit l'admin
This commit is contained in:
parent
c66e41a86b
commit
f87235b9a3
|
@ -78,13 +78,12 @@ register(Rubric)
|
|||
|
||||
|
||||
class RubricsServer(RubricsCommonMixin, ObjectsServer):
|
||||
def getMainObjectXmlRpc(self):
|
||||
def getMainObjectId(self):
|
||||
virtualServerId = context.getVar('applicationId')
|
||||
virtualServer = self.getVirtualServer(virtualServerId)
|
||||
if virtualServer.admin.mainRubricId is None:
|
||||
raise faults.MissingMainRubric()
|
||||
result = self.getObjectXmlRpc(virtualServer.admin.mainRubricId)
|
||||
return result
|
||||
return virtualServer.admin.mainRubricId
|
||||
|
||||
def getObjectIdsWithContent(self, objectId):
|
||||
virtualServerId = context.getVar('applicationId')
|
||||
|
@ -97,8 +96,7 @@ class RubricsServer(RubricsCommonMixin, ObjectsServer):
|
|||
|
||||
def registerPublicMethods(self):
|
||||
ObjectsServer.registerPublicMethods(self)
|
||||
self.registerPublicMethod('getMainObject',
|
||||
self.getMainObjectXmlRpc)
|
||||
self.registerPublicMethod('getMainObjectId')
|
||||
self.registerPublicMethod('getObjectIdsWithContent')
|
||||
|
||||
def repairVirtualServer(self, virtualServer, version):
|
||||
|
|
|
@ -66,11 +66,19 @@ register(Rubric)
|
|||
|
||||
class RubricsProxy(RubricsCommonMixin, ObjectsProxy):
|
||||
def getMainObject(self, serverId = None):
|
||||
objectId = self.getAdmin(serverId = serverId).mainRubricId
|
||||
objectId = self.getMainObjectId(serverId = serverId)
|
||||
if not objectId:
|
||||
raise faults.MissingMainRubric()
|
||||
return getObject(objectId)
|
||||
|
||||
def getMainObjectId(self, serverId = None):
|
||||
userToken = context.getVar('userToken', default = '')
|
||||
serverId = self.getServerId(serverId = serverId)
|
||||
return callServer(
|
||||
serverId,
|
||||
'getMainObjectId',
|
||||
[serverId, getApplicationToken(), userToken])
|
||||
|
||||
def getObjectIdsWithContent(self, objectId, indirect = 0, serverId = None):
|
||||
userToken = context.getVar('userToken', default = '')
|
||||
serverId = self.getServerId(serverId = serverId)
|
||||
|
|
Reference in New Issue