Added method Wrapper.isEmpty(name) that checks if the content of some field is empty or not on a given object.

This commit is contained in:
Gaetan Delannay 2012-06-13 09:31:09 +02:00
parent 5b255ce55d
commit e13575c506
4 changed files with 10 additions and 1 deletions

View file

@ -125,6 +125,14 @@ class AbstractWrapper(object):
return customUser.__dict__[methodName](self, *args, **kwargs)
def getField(self, name): return self.o.getAppyType(name)
def isEmpty(self, name):
'''Returns True if value of field p_name is considered as being
empty.'''
obj = self.o
if hasattr(obj.aq_base, name):
field = obj.getAppyType(name)
return field.isEmptyValue(getattr(obj, name))
return True
def link(self, fieldName, obj):
'''This method links p_obj (which can be a list of objects) to this one