changeset 635:40c3c6aaafaa frontends_multi_profiles

browser side (LiberviaWidget): an error is raised when expect is True on getParent
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:44:58 +0100
parents 16a5da120b7f
children 86ae737da6f3
files src/browser/sat_browser/base_widget.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):