[Checkins] SVN: z3c.dobbin/trunk/src/z3c/dobbin/relations.py Improved output when a lookup fails.

Malthe Borch mborch at gmail.com
Thu Jun 12 12:02:52 EDT 2008


Log message for revision 87335:
  Improved output when a lookup fails.

Changed:
  U   z3c.dobbin/trunk/src/z3c/dobbin/relations.py

-=-
Modified: z3c.dobbin/trunk/src/z3c/dobbin/relations.py
===================================================================
--- z3c.dobbin/trunk/src/z3c/dobbin/relations.py	2008-06-12 15:52:16 UTC (rev 87334)
+++ z3c.dobbin/trunk/src/z3c/dobbin/relations.py	2008-06-12 16:02:52 UTC (rev 87335)
@@ -13,8 +13,12 @@
 
 def lookup(uuid, ignore_cache=False):
     session = Session()
-    item = session.query(bootstrap.Soup).select_by(uuid=uuid)[0]
 
+    try:
+        item = session.query(bootstrap.Soup).select_by(uuid=uuid)[0]
+    except IndexError:
+        raise LookupError("Unable to locate object with UUID = '%s'." % uuid)
+        
     # try to acquire relation target from session
     if not ignore_cache:
         try:



More information about the Checkins mailing list