opental-checkins
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OpenTAL-checkins] opental/pax core.py __init__.py


From: Fernando Lalo Martins
Subject: [OpenTAL-checkins] opental/pax core.py __init__.py
Date: Mon, 27 Jan 2003 02:05:12 -0500

CVSROOT:        /cvsroot/opental
Module name:    opental
Changes by:     Fernando Lalo Martins <address@hidden>  03/01/27 02:05:12

Modified files:
        pax            : core.py __init__.py 

Log message:
        adding a Literal class (actually pasted over from OpenPTi18n), as it 
turns out to be a common use case

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/pax/core.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/pax/__init__.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text

Patches:
Index: opental/pax/__init__.py
diff -u opental/pax/__init__.py:1.15 opental/pax/__init__.py:1.16
--- opental/pax/__init__.py:1.15        Tue Sep 10 06:07:05 2002
+++ opental/pax/__init__.py     Mon Jan 27 02:05:12 2003
@@ -4,7 +4,7 @@
 
 from utils import XML
 import core
-from core import Container, Element
+from core import Container, Element, Literal
 from textpaxparser import parse as text2pax
 from htmlpaxparser import parse as html2pax
 try:
Index: opental/pax/core.py
diff -u opental/pax/core.py:1.13 opental/pax/core.py:1.14
--- opental/pax/core.py:1.13    Thu Nov 14 17:46:07 2002
+++ opental/pax/core.py Mon Jan 27 02:05:12 2003
@@ -187,3 +187,17 @@
 
     def __xml__(self, ns_map):
         return u'<!%s>' % self.text
+
+# for wrapping a string so that XML() doesn't try to
+# render it again
+class Literal(object):
+    def __init__(self, text):
+        self.text = text
+
+    def __xml__(self, *a):
+        return self.text
+
+    __str__ = __xml__
+
+    def __repr__(self):
+        return '<Literal %s>' % repr(self.text)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]