Author: jmorliaguet
Date: Sun Apr 30 13:56:49 2006
New Revision: 2996

Modified:
   cpsskins/branches/paris-sprint-2006/setup/configure.zcml
   cpsskins/branches/paris-sprint-2006/setup/io.py
   cpsskins/branches/paris-sprint-2006/standard/io/setting.py
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
Log:

- minor fixes



Modified: cpsskins/branches/paris-sprint-2006/setup/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/configure.zcml    (original)
+++ cpsskins/branches/paris-sprint-2006/setup/configure.zcml    Sun Apr 30 
13:56:49 2006
@@ -79,6 +79,10 @@
   />
 
   <adapter
+      factory="cpsskins.setup.io.BytesLineField"
+  />
+
+  <adapter
       factory="cpsskins.setup.io.FloatField"
   />
 

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     Sun Apr 30 13:56:49 2006
@@ -166,11 +166,11 @@
 
     def dump(self, obj):
         # TODO escape ','
-        return u','.join(obj)
+        return u', '.join(obj)
 
     def load(self, text):
         # TODO unescape ','
-        return text.split(',')
+        return text.split(', ')
 
 class IntField(BaseFieldIO):
     """An integer field.
@@ -184,6 +184,12 @@
     adapts(zope.schema.interfaces.ITextLine)
     implements(IFieldIO)
 
+class BytesLineField(BaseFieldIO):
+    """A bytes line field.
+    """
+    adapts(zope.schema.interfaces.IBytesLine)
+    implements(IFieldIO)
+
 class FloatField(BaseFieldIO):
     """A float field.
     """

Modified: cpsskins/branches/paris-sprint-2006/standard/io/setting.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/io/setting.py  (original)
+++ cpsskins/branches/paris-sprint-2006/standard/io/setting.py  Sun Apr 30 
13:56:49 2006
@@ -43,6 +43,7 @@
         resource = IResource(context).getResource()
         exporter = getMultiAdapter((resource, setting_el), IDOMAdapter)
         exporter.setDocument(document)
+        exporter.writeAsAttributes(self.attributes)
         exporter.save()
 
     def load(self):

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Sun Apr 
30 13:56:49 2006
@@ -42,9 +42,8 @@
         self.context = context
         self.request = request
 
-    ###################################################################
-    # Settings
-    ###################################################################
+
+    ### Settings  #####################################################
 
     def getSettingInfo(self):
         """Return information about registered resources categorized by type.
@@ -132,7 +131,7 @@
             exporter.setDocument(document)
             exporter.save()
 
-        return document.toxml()
+        return document.toprettyxml(indent=u'  ', encoding=u'utf-8')
 
     def importSettings(self, xml=u''):
         """Import site settings
@@ -147,9 +146,8 @@
         importer = getMultiAdapter((mgr, dom), IDOMAdapter, name=u'settings')
         importer.load()
 
-    ###################################################################
-    # Site
-    ###################################################################
+
+    ### Site  #########################################################
 
     def exportSite(self):
         """Export the entire site an XML file.
@@ -189,9 +187,8 @@
         importer.mapping = uri_mapping
         importer.load(dom)
 
-    ###################################################################
-    # Snapshots
-    ###################################################################
+
+    ### Snapshots  ####################################################
 
     def getSnapshotStorage(self):
         return getThemeManager(self.context).getSnapshotStorage()
@@ -230,12 +227,10 @@
         snapshots = self.getSnapshotStorage()
         self.importSite(snapshots[filename])
 
-    ###################################################################
-    # Storage
-    ###################################################################
+    ### Storage  ######################################################
 
     def exportStorage(self, name=u''):
-        """Export the storage as an XML file.
+        """Export the storage as XML.
         """
         context = self.context
         request = self.request
@@ -245,8 +240,16 @@
         mgr = getThemeManager(context)
         storage = mgr[name]
 
-        exporter = getMultiAdapter((storage, request), IDataExporter)
-        return exporter()
+        document = DOMImplementation().createDocument(None, name, None)
+        root = document.documentElement
+
+        for item in storage:
+            exporter = getMultiAdapter((storage[item], root), IDOMAdapter)
+            exporter.setDocument(document)
+            exporter.writeAsAttributes((u'title', u'description'))
+            exporter.save()
+
+        return document.toprettyxml(indent=u'  ', encoding=u'utf-8')
 
     def importStorage(self, name=u'', xml=u''):
         request = self.request
@@ -262,9 +265,7 @@
         return importer.mapping
 
 
-    ###################################################################
-    # Themes
-    ###################################################################
+    ### Themes  #######################################################
 
     def exportThemes(self):
         """Export the themes
@@ -278,7 +279,8 @@
         for theme in getThemeManager(context).getThemes():
             exporter = getMultiAdapter((theme, root), IDOMAdapter)
             exporter.setDocument(document)
+            exporter.writeAsAttributes((u'title', u'description'))
             exporter.save()
 
-        return document.toxml()
+        return document.toprettyxml(indent=u'  ', encoding=u'utf-8')
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to