[Dev OpenGP] [44] Putain ca marche !!!! |
[ Thread Index |
Date Index
| More opengp.tuxfamily.org/development Archives
]
Revision: 44
Author: nicolaf
Date: 2009-03-16 19:59:20 +0100 (Mon, 16 Mar 2009)
Log Message:
-----------
Putain ca marche !!!!
Modified Paths:
--------------
trunk/src/DomElementMethods/ElementMethods.py
trunk/src/DomElementMethods/__init__.py
trunk/src/DomElementMethods-test.py
Modified: trunk/src/DomElementMethods/ElementMethods.py
===================================================================
--- trunk/src/DomElementMethods/ElementMethods.py 2009-03-16 16:01:00 UTC (rev 43)
+++ trunk/src/DomElementMethods/ElementMethods.py 2009-03-16 18:59:20 UTC (rev 44)
@@ -8,14 +8,18 @@
ATTR_ID = "id"
class OgpElement(ElementBase):
+ def __init(self, tag, attrib):
+ ElementBase.__init__(self, tag, attrib)
- __text = ElementBase(self).text
- def __getText(self):
- return self.__text
- def __setText(self, text):
- self.delElements()
- self.__text = text
- text = property(__getText, __setText)
+ def __setattr__(self, item, value):
+ if item == "text":
+ print "Deleting all subelements..."
+ self.delElements()
+ if item == "tail":
+ print "Tail must be none"
+ value = None
+
+ ElementBase.__setattr__(self, item, value)
def __getAttributes(self):
res = dict()
Modified: trunk/src/DomElementMethods/__init__.py
===================================================================
--- trunk/src/DomElementMethods/__init__.py 2009-03-16 16:01:00 UTC (rev 43)
+++ trunk/src/DomElementMethods/__init__.py 2009-03-16 18:59:20 UTC (rev 44)
@@ -1,8 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*
+from lxml.etree import *
from ElementMethods import *
-from lxml.etree import *
OGP_PARSER = XMLParser()
OGP_PARSER.set_element_class_lookup(ElementDefaultClassLookup(element=OgpElement))
Modified: trunk/src/DomElementMethods-test.py
===================================================================
--- trunk/src/DomElementMethods-test.py 2009-03-16 16:01:00 UTC (rev 43)
+++ trunk/src/DomElementMethods-test.py 2009-03-16 18:59:20 UTC (rev 44)
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*
+from DomElementMethods import *
from lxml.etree import *
-from DomElementMethods import *
obj = Element("rootelement")
obj2 = Element("rootelement")