[browser2] add a validate method in order to check objet before returning him
This commit is contained in:
parent
e7d09cbe31
commit
7d59640712
1 changed files with 4 additions and 0 deletions
|
|
@ -497,6 +497,7 @@ class ItemElement(AbstractElement):
|
||||||
_attrs = None
|
_attrs = None
|
||||||
klass = None
|
klass = None
|
||||||
condition = None
|
condition = None
|
||||||
|
validate = None
|
||||||
|
|
||||||
class Index(object):
|
class Index(object):
|
||||||
pass
|
pass
|
||||||
|
|
@ -528,6 +529,9 @@ class ItemElement(AbstractElement):
|
||||||
except SkipItem:
|
except SkipItem:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self.validate is not None and not self.validate_object(self.obj):
|
||||||
|
return
|
||||||
|
|
||||||
yield self.obj
|
yield self.obj
|
||||||
|
|
||||||
def handle_attr(self, key, func):
|
def handle_attr(self, key, func):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue