Commit ef496230 authored by wenjie.zheng's avatar wenjie.zheng

Variable.py: getInfoGuard allow to return none if necessary.

parent 432ba65e
......@@ -73,29 +73,31 @@ class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
else:
return self.default_expr.text
def generateInfoGuard(self):
if self.info_guard == None:
self.info_guard = Guard(permissions=self.getPermissionList(),
roles=self.getRoleList(),
groups=self.getGroupList(),
expr=Expression(self.getExpression()))
if self.getRoleList() is not None:
self.info_guard.roles = self.getRoleList()
if self.getPermissionList() is not None:
self.info_guard.permissions = self.getPermissionList()
if self.getGroupList() is not None:
self.info_guard.groups = self.getGroupList()
if self.getExpression() is not None:
self.info_guard.expr = Expression(self.getExpression())
def getInfoGuardSummary(self):
res = None
if self.getGuard() is not None:
res = self.guard.getSummary()
return res
def getInfoGuard(self):
if self.info_guard is not None:
self.generateInfoGuard()
return self.info_guard
if self.getRoleList() is None and\
self.getPermissionList() is None and\
self.getGroupList() is None and\
self.getExpression() is None and\
self.guard is None:
return None
else:
self.generateGuard()
return self.guard
def getInfoGuardSummary(self):
res = None
if self.info_guard is not None:
res = self.info_guard.getSummary()
return res
\ No newline at end of file
def generateInfoGuard(self):
if self.guard is None:
self.guard = Guard().__of__(self)
if self.getRoleList() is not None:
self.guard.roles = self.getRoleList()
if self.getPermissionList() is not None:
self.guard.permissions = self.getPermissionList()
if self.getGroupList() is not None:
self.guard.groups = self.getGroupList()
if self.getExpression() is not None:
self.guard.expr = Expression(self.getExpression())
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment