[Checkins] SVN: Sandbox/malthe/chameleon.core/ If element corresponds to an unknown namespace, assume it's the default.

Malthe Borch mborch at gmail.com
Wed Nov 12 18:29:42 EST 2008


Log message for revision 92897:
  If element corresponds to an unknown namespace, assume it's the default.

Changed:
  U   Sandbox/malthe/chameleon.core/CHANGES.txt
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py

-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt	2008-11-12 23:28:23 UTC (rev 92896)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt	2008-11-12 23:29:41 UTC (rev 92897)
@@ -4,6 +4,10 @@
 HEAD
 ~~~~
 
+- If an element does not belong to a known namespace, assume it's the
+  default namespace. This change is relevant after the introduction of
+  fallback elements. [malthe]
+
 - XML declarations should be printed with or without a doctype
   element, and only if the template includes it. [malthe]
 

Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-12 23:28:23 UTC (rev 92896)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-12 23:29:41 UTC (rev 92897)
@@ -29,6 +29,7 @@
     return True
 
 s_counter = 0
+marker = object()
 
 def handler(key=None):
     def decorate(f):
@@ -223,7 +224,7 @@
         return map(self.get, self._keys)
     
 def get_attributes_from_namespace(element, namespace):
-    if element.nsmap.get(element.prefix) == namespace:
+    if element.nsmap.get(element.prefix, marker) in (namespace, marker):
         return dict([
             (name, value) for (name, value) in element.attrib.items() \
             if '{' not in name])



More information about the Checkins mailing list