[gen] Now it is possible to index and search Ref fields.
This commit is contained in:
parent
bdaf1b4bbd
commit
5f530d9f9e
8 changed files with 78 additions and 17 deletions
gen/wrappers
|
@ -169,8 +169,15 @@ class UserWrapper(AbstractWrapper):
|
|||
del self.o.__ac_local_roles__[None]
|
||||
return self._callCustom('onEdit', created)
|
||||
|
||||
def mayEdit(self): return self._callCustom('mayEdit')
|
||||
def mayDelete(self): return self._callCustom('mayDelete')
|
||||
def mayEdit(self):
|
||||
custom = self._getCustomMethod('mayEdit')
|
||||
if custom: return self._callCustom('mayEdit')
|
||||
else: return True
|
||||
|
||||
def mayDelete(self):
|
||||
custom = self._getCustomMethod('mayDelete')
|
||||
if custom: return self._callCustom('mayDelete')
|
||||
else: return True
|
||||
|
||||
def getZopeUser(self):
|
||||
'''Gets the Zope user corresponding to this user.'''
|
||||
|
|
|
@ -132,16 +132,21 @@ class AbstractWrapper(object):
|
|||
if other: return cmp(self.o, other.o)
|
||||
return 1
|
||||
|
||||
def _getCustomMethod(self, methodName):
|
||||
'''See docstring of _callCustom below.'''
|
||||
if len(self.__class__.__bases__) > 1:
|
||||
# There is a custom user class
|
||||
custom = self.__class__.__bases__[-1]
|
||||
if custom.__dict__.has_key(methodName):
|
||||
return custom.__dict__[methodName]
|
||||
|
||||
def _callCustom(self, methodName, *args, **kwargs):
|
||||
'''This wrapper implements some methods like "validate" and "onEdit".
|
||||
If the user has defined its own wrapper, its methods will not be
|
||||
called. So this method allows, from the methods here, to call the
|
||||
user versions.'''
|
||||
if len(self.__class__.__bases__) > 1:
|
||||
# There is a custom user class
|
||||
customUser = self.__class__.__bases__[-1]
|
||||
if customUser.__dict__.has_key(methodName):
|
||||
return customUser.__dict__[methodName](self, *args, **kwargs)
|
||||
custom = self._getCustomMethod(methodName)
|
||||
if custom: return custom(self, *args, **kwargs)
|
||||
|
||||
def getField(self, name): return self.o.getAppyType(name)
|
||||
def isEmpty(self, name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue