changeset 1936:7162f665f752 namespaces

routing: if no namespace can be determined, fail early
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 03 Feb 2013 14:22:48 +0100
parents 2589c6bc54d7
children 483dfd7fc86a
files MoinMoin/storage/middleware/routing.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/middleware/routing.py	Sun Feb 03 13:39:05 2013 +0100
+++ b/MoinMoin/storage/middleware/routing.py	Sun Feb 03 14:22:48 2013 +0100
@@ -106,10 +106,13 @@
             # is fully qualified and determine the namespace from it:
             fq_names = meta[NAME]
             assert isinstance(fq_names, list)
-            backend_name, item_names, namespace = self._get_backend(fq_names)
-            # side effect: update the metadata with namespace and short item name (no ns)
-            meta[NAMESPACE] = namespace
-            meta[NAME] = item_names
+            if fq_names:
+                backend_name, item_names, namespace = self._get_backend(fq_names)
+                # side effect: update the metadata with namespace and short item name (no ns)
+                meta[NAMESPACE] = namespace
+                meta[NAME] = item_names
+            else:
+                raise ValueError('can not determine namespace: empty NAME list, no NAMESPACE metadata present')
         else:
             if namespace:
                 namespace += u':' # needed for _get_backend