[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/ Refactor.

Malthe Borch mborch at gmail.com
Thu Nov 13 11:11:00 EST 2008


Log message for revision 92905:
  Refactor.

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

-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-11-13 14:20:57 UTC (rev 92904)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-11-13 16:10:59 UTC (rev 92905)
@@ -10,7 +10,6 @@
 import config
 import etree
 import marshal
-import htmlentitydefs
 
 class Node(object):
     """Element translation class.
@@ -557,11 +556,7 @@
         # prepend the implicit doctype to the document source and add
         # entity definitions
         if implicit_doctype and require_wrapping:
-            entities = "".join((
-                '<!ENTITY %s "&#%s;">' % (name, text) for (name, text) in \
-                htmlentitydefs.name2codepoint.items()))
-
-            implicit_doctype = implicit_doctype[:-1] + '  [ %s ]>' % entities
+            implicit_doctype = implicit_doctype[:-1] + '  [ %s ]>' % utils.entities
             self.implicit_doctype = implicit_doctype
             body = implicit_doctype + "\n" + body
 

Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-13 14:20:57 UTC (rev 92904)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/utils.py	2008-11-13 16:10:59 UTC (rev 92905)
@@ -28,6 +28,10 @@
         return False
     return True
 
+entities = "".join((
+    '<!ENTITY %s "&#%s;">' % (name, text) for (name, text) in \
+    htmlentitydefs.name2codepoint.items()))
+
 s_counter = 0
 marker = object()
 



More information about the Checkins mailing list