]> git.parisson.com Git - telemeta.git/commitdiff
fix crash when searching by an unexisting country
authorolivier <>
Wed, 17 Feb 2010 15:36:28 +0000 (15:36 +0000)
committerolivier <>
Wed, 17 Feb 2010 15:36:28 +0000 (15:36 +0000)
telemeta/web/base.py

index 7181da12d2ea7731945dd6a2fceda0a169d9e828..5edff21c80bde4773f94a77a900bed223c66d134 100644 (file)
@@ -239,11 +239,16 @@ class WebView(Component):
         for key, value in input.items():
             func = switch.get(key)
             if func and value and value != "0":
-                res = func(value)
-                if len(res) > 2:
-                    collections, items, value = res
-                else: 
-                    collections, items = res
+                try:
+                    res = func(value)
+                    if len(res) > 2:
+                        collections, items, value = res
+                    else: 
+                        collections, items = res
+                except ObjectDoesNotExist:
+                    collections = collections.none()
+                    items = items.none()
+
                 criteria[key] = value
 
         if type is None: