Author: jmorliaguet
Date: Tue May  2 16:18:03 2006
New Revision: 3025

Modified:
   cpsskins/branches/paris-sprint-2006/setup/interfaces.py
   cpsskins/branches/paris-sprint-2006/setup/io.py
Log:

- fixed the fields_as_attributes property



Modified: cpsskins/branches/paris-sprint-2006/setup/interfaces.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/interfaces.py     (original)
+++ cpsskins/branches/paris-sprint-2006/setup/interfaces.py     Tue May  2 
16:18:03 2006
@@ -148,6 +148,8 @@
     fields_as_attributes = Attribute(
                            u"The list of fields written as DOM attributes.")
 
+    reserved_fields = Attribute(u"Reserved fields.")
+   
     def save():
         """Save data as a DOM fragment."""
 

Modified: cpsskins/branches/paris-sprint-2006/setup/io.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/io.py     (original)
+++ cpsskins/branches/paris-sprint-2006/setup/io.py     Tue May  2 16:18:03 2006
@@ -45,7 +45,9 @@
 
     ignored_fields = ()
 
-    fields_as_attributes = ()
+    _fields_as_attributes = ()
+
+    reserved_attrs = ()
 
     def __init__(self, context, node):
         self.context = context
@@ -75,18 +77,24 @@
         self.fields_as_attributes = other.fields_as_attributes
         self.mapping = other.mapping
 
+    def getFieldsAsAttr(self):
+        return self._fields_as_attributes
+
+    def setFieldsAsAttr(self, fields):
+        for attr in self.reserved_attrs:
+            if attr in fields:
+                raise ValueError("'%s' is a reserved attribute." % attr)
+        self._fields_as_attributes = fields
+
+    fields_as_attributes = property(getFieldsAsAttr, setFieldsAsAttr)
+
+
 class DOMAdapter(BaseDOMAdapter):
     """Generic DOM adapter
     """
     implements(IDOMAdapter)
 
-    _reserved_attrs = u'id', u'type', u'value'
-
-    def writeAsAttributes(self, fields):
-        for attr in self._reserved_attrs:
-            if attr in fields:
-                raise ValueError("'%s' is a reserved attribute." % attr)
-        self.fields_as_attributes = fields
+    reserved_attrs = u'id', u'type', u'value'
 
     def save(self):
         context = self.context
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to