Author: jmorliaguet
Date: Fri Apr 14 12:05:21 2006
New Revision: 2838

Modified:
   cpsskins/branches/jmo-perspectives/standard/io/storage.py
   cpsskins/branches/jmo-perspectives/ui/screens/sitemanager/views.py
Log:

- storage importers return mappings between old and new object URIs



Modified: cpsskins/branches/jmo-perspectives/standard/io/storage.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/io/storage.py   (original)
+++ cpsskins/branches/jmo-perspectives/standard/io/storage.py   Fri Apr 14 
12:05:21 2006
@@ -67,6 +67,7 @@
         context = self.context
         request = self.request
 
+        mapping = {}
         for storage_def in dom.getElementsByTagName('storage'):
             for element_def in storage_def.getElementsByTagName('*'):
                 element_type = element_def.tagName
@@ -79,5 +80,6 @@
                     element = importer.load(element_def)
                     new_uri = IIdentifiable(element).getURI()
 
-                    print '%s -> %s' % (old_uri, new_uri)
+                    mapping[old_uri] = new_uri
 
+        return mapping

Modified: cpsskins/branches/jmo-perspectives/ui/screens/sitemanager/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/screens/sitemanager/views.py  
(original)
+++ cpsskins/branches/jmo-perspectives/ui/screens/sitemanager/views.py  Fri Apr 
14 12:05:21 2006
@@ -150,20 +150,26 @@
 
         themes_data = archive[u'themes.xml']
         settings_data = archive[u'settings.xml']
-        formats_data = archive[u'formats.xml']
         displays_data = archive[u'displays.xml']
         portlets_data = archive[u'portlets.xml']
         relations_data = archive[u'relations.xml']
 
         mgr = getThemeManager()
 
-        formats = mgr[u'formats']
-        formats.purge()
-        self.importStorage(u'formats', formats_data)
+        uri_mapping = {}
+
+        for storage_id in u'formats', :
+            data = archive[u'%s.xml' % storage_id]
+            storage = mgr[storage_id]
+            storage.purge()
+            uri_mapping.update(self.importStorage(storage_id, data))
+
+        for k, v in uri_mapping.items():
+            print '%s -> %s' % (k, v)
 
         relations = mgr[u'relations']
         relations.purge()
-        self.importStorage(u'relations', relations_data)
+        #self.importStorage(u'relations', relations_data)
 
     ###################################################################
     # Snapshots
@@ -223,7 +229,7 @@
 
         dom = parseString(xml)
         importer = getMultiAdapter((storage, request), IDataImporter)
-        importer.load(dom)
+        return importer.load(dom)
 
     ###################################################################
     # Themes
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to