cwvreg.py
branchtls-sprint
changeset 1263 01152fffd593
parent 1176 0ff3d29e91c9
parent 1254 585f3c476a18
child 1282 272d8ec6f308
--- a/cwvreg.py	Mon Apr 06 12:37:45 2009 +0200
+++ b/cwvreg.py	Tue Apr 07 09:30:23 2009 +0200
@@ -11,7 +11,7 @@
 
 from rql import RQLHelper
 
-from cubicweb import Binary, UnknownProperty
+from cubicweb import Binary, UnknownProperty, UnknownEid
 from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject
 
 _ = unicode
@@ -352,9 +352,9 @@
         if vocab is not None:
             if callable(vocab):
                 # list() just in case its a generator function
-                vocabfunc = lambda e: list(vocab(propkey, req))
+                vocabfunc = lambda **kwargs: list(vocab(propkey, req))
             else:
-                vocabfunc = lambda e: vocab
+                vocabfunc = lambda **kwargs: vocab
             w = StaticComboBoxWidget(self, 'EProperty', self.schema['value'], 'String',
                                      vocabfunc=vocabfunc, description=tr(pdef['help']),
                                      **attrs)
@@ -367,7 +367,11 @@
         rqlst = self.rqlhelper.parse(rql)
         def type_from_eid(eid, session=session):
             return session.describe(eid)[0]
-        self.rqlhelper.compute_solutions(rqlst, {'eid': type_from_eid}, args)
+        try:
+            self.rqlhelper.compute_solutions(rqlst, {'eid': type_from_eid}, args)
+        except UnknownEid:
+            for select in rqlst.children:
+                select.solutions = []
         return rqlst
 
     @property