[Checkins] SVN: five.localsitemanager/trunk/ Provide a more meaningful error message if the current site is not set correctly or the Acquisition chain of the site is messed up.

Hanno Schlichting hannosch at hannosch.eu
Tue Jan 19 19:52:57 EST 2010


Log message for revision 108285:
  Provide a more meaningful error message if the current site is not set correctly or the Acquisition chain of the site is messed up.
  

Changed:
  U   five.localsitemanager/trunk/CHANGES.txt
  U   five.localsitemanager/trunk/src/five/localsitemanager/registry.py

-=-
Modified: five.localsitemanager/trunk/CHANGES.txt
===================================================================
--- five.localsitemanager/trunk/CHANGES.txt	2010-01-19 23:42:21 UTC (rev 108284)
+++ five.localsitemanager/trunk/CHANGES.txt	2010-01-20 00:52:56 UTC (rev 108285)
@@ -4,6 +4,9 @@
 2.0.4 - unreleased
 ------------------
 
+* Provide a more meaningful error message if the current site is not set
+  correctly or the Acquisition chain of the site is messed up.
+  [hannosch]
 
 2.0.3 - 2010-01-02
 ------------------

Modified: five.localsitemanager/trunk/src/five/localsitemanager/registry.py
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/registry.py	2010-01-19 23:42:21 UTC (rev 108284)
+++ five.localsitemanager/trunk/src/five/localsitemanager/registry.py	2010-01-20 00:52:56 UTC (rev 108285)
@@ -170,7 +170,11 @@
             # If the component happens to be the component registry
             # container we are looking up a ISiteRoot.
             # We are not wrapping it in itself but in its own parent
-            comp = base.__of__(Acquisition.aq_parent(parent))
+            site_parent = Acquisition.aq_parent(parent)
+            if site_parent is None:
+                raise ValueError('The ISiteRoot %s has no parent or the '
+                    'current site is not set correctly.' % repr(parent))
+            comp = base.__of__(site_parent)
 
     return comp
 



More information about the checkins mailing list