[Checkins] SVN: Sandbox/malthe/chameleon.core/ Prefix tags which do not belong to the default namespace.
Malthe Borch
mborch at gmail.com
Mon Nov 24 10:22:24 EST 2008
Log message for revision 93314:
Prefix tags which do not belong to the default namespace.
Changed:
U Sandbox/malthe/chameleon.core/CHANGES.txt
U Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt 2008-11-24 15:20:02 UTC (rev 93313)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt 2008-11-24 15:22:24 UTC (rev 93314)
@@ -4,6 +4,8 @@
HEAD
~~~~
+- Prefix tags which do not belong to the default namespace. [malthe]
+
1.0b10 (released 24/11/2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py 2008-11-24 15:20:02 UTC (rev 93313)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py 2008-11-24 15:22:24 UTC (rev 93314)
@@ -49,6 +49,16 @@
self.element = element
@property
+ def tag(self):
+ tag = self.element.tag
+ if '}' in tag:
+ url, tag = tag[1:].split('}')
+ for prefix, _url in self.element.nsmap.items():
+ if prefix is not None and _url == url:
+ return "%s:%s" % (prefix, tag)
+ return tag
+
+ @property
def text(self):
if self.element.text is None:
return ()
@@ -232,7 +242,7 @@
if self.omit is not True:
selfclosing = not text and not dynamic and len(self.element) == 0
tag = clauses.Tag(
- self.element.tag, attributes,
+ self.tag, attributes,
expression=self.dict_attributes, selfclosing=selfclosing,
cdata=self.cdata is not None, defaults=self.static_attributes)
if self.omit:
More information about the Checkins
mailing list