[Dev OpenGP] [56] First corrections after SVN crashing

[ Thread Index | Date Index | More opengp.tuxfamily.org/development Archives ]


Revision: 56
Author:   alband85
Date:     2009-03-18 15:10:40 +0100 (Wed, 18 Mar 2009)

Log Message:
-----------
First corrections after SVN crashing

Modified Paths:
--------------
    trunk/src/lib/ogp/etree/__init__.py
    trunk/src/tests/etree-test.py


Modified: trunk/src/lib/ogp/etree/__init__.py
===================================================================
--- trunk/src/lib/ogp/etree/__init__.py	2009-03-18 14:00:52 UTC (rev 55)
+++ trunk/src/lib/ogp/etree/__init__.py	2009-03-18 14:10:40 UTC (rev 56)
@@ -2,8 +2,21 @@
 # -*- coding: utf-8 -*
 
 from lxml.etree import *
-from ElementMethods import *
+#from ElementMethods import *
+from ogp.etree  import *
 
+def parse(source, parser=None):
+	if not hasattr(source, "read"):
+		source = open(source, "rb")
+	xml = ''
+	for l in source.readlines():
+		xml = xml + l
+	source.close()
+	if parser is None:
+		return fromstring(xml)
+	else:
+		return fromstring(xml, parser)
+
 OGP_PARSER = XMLParser()
 OGP_PARSER.set_element_class_lookup(ElementDefaultClassLookup(element=OgpElement))
 Element = OGP_PARSER.makeelement

Modified: trunk/src/tests/etree-test.py
===================================================================
--- trunk/src/tests/etree-test.py	2009-03-18 14:00:52 UTC (rev 55)
+++ trunk/src/tests/etree-test.py	2009-03-18 14:10:40 UTC (rev 56)
@@ -1,7 +1,8 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*
 from lxml.etree import *
-from DomElementMethods import *
+#from DomElementMethods import *
+from ogp.etree import *
 
 obj = Element("rootelement")
 obj2 = Element("rootelement")


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/