Commit 245abd40 authored by Lucas Ficheux's avatar Lucas Ficheux Committed by hydrargyrum
Browse files

[browser/elements] Added the ability to overrride *Elements' env copy

Added fill_env method to AbstractElement so that it can be
overriden in pages methods.

It is useful to chose how Env behaves
parent 262e0f63
......@@ -107,10 +107,7 @@ def __init__(self, page, parent=None, el=None):
else:
self.el = page.doc
if parent is not None:
self.env = deepcopy(parent.env)
else:
self.env = deepcopy(page.params)
self.fill_env(page, parent)
# Used by debug
self._random_id = AbstractElement._creation_counter
......@@ -154,6 +151,12 @@ def handle_loaders(self):
loader = getattr(self, attrname)
self.loaders[name] = self.use_selector(loader, key=attrname)
def fill_env(self, page, parent=None):
if parent is not None:
self.env = deepcopy(parent.env)
else:
self.env = deepcopy(page.params)
class ListElement(AbstractElement):
item_xpath = None
......
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