# HG changeset patch # User Goffi # Date 1424713498 -3600 # Node ID 40c3c6aaafaa3afa35620f0642fe1c7fcf28a7f0 # Parent 16a5da120b7fcd077eaac2faa4a156059a360798 browser side (LiberviaWidget): an error is raised when expect is True on getParent diff -r 16a5da120b7f -r 40c3c6aaafaa src/browser/sat_browser/base_widget.py --- a/src/browser/sat_browser/base_widget.py Mon Feb 23 18:44:57 2015 +0100 +++ b/src/browser/sat_browser/base_widget.py Mon Feb 23 18:44:58 2015 +0100 @@ -20,6 +20,7 @@ import pyjd # this is dummy in pyjs from sat.core.log import getLogger log = getLogger(__name__) +from sat.core import exceptions from sat_frontends.quick_frontend import quick_widgets from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.AbsolutePanel import AbsolutePanel @@ -338,8 +339,9 @@ Note: this method overrides pyjamas.ui.Widget.getParent @param class_: class of the ancestor to look for or None to return the first parent - @param expect: set to True if the parent is expected (print a message if not found) + @param expect: set to True if the parent is expected (raise an error if not found) @return: the parent/ancestor or None if it has not been found + @raise exceptions.InternalError: expect is True and no parent is found """ current = Widget.getParent(self) if class_ is None: @@ -347,7 +349,7 @@ while current is not None and not isinstance(current, class_): current = Widget.getParent(current) if current is None and expect: - log.error("Can't find parent %s for %s" % (class_, self)) + raise exceptions.InternalError("Can't find parent %s for %s" % (class_, self)) return current def onClick(self, sender):