Author: jmorliaguet
Date: Fri Jun 23 00:53:11 2006
New Revision: 3494

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

Log:

- add slots into cells



Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/io/migration.py   (original)
+++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py   Fri Jun 23 
00:53:11 2006
@@ -88,16 +88,31 @@
 
         # second stage: create cells in pageblocks
         for pageblock_info in self.objects['Page Block']:
-            info = self.getProperties(pageblock_info['node'], 'maxcols')
+            pageblock_node = pageblock_info['node']
+            props = self.getProperties(pageblock_node, 'maxcols')
             container = pageblock_info['object']
-            for c in range(int(info['maxcols'])):
-                self.addObject('cpsskins.canvas.cell', container)
+            cells = {}
+            for c in range(int(props['maxcols'])):
+                cells[c] = self.addObject('cpsskins.canvas.cell', container)
+
+            # add slots into cells
+            for slot_name in self.getObjects(pageblock_node,
+                                             u'Portal Box Group Templet'):
+                slot_path = '%s/%s.xml' % (pageblock_info['path'], slot_name)
+                slot_doc = parseString(archive[slot_path])
+                slot_node = slot_doc.childNodes[0]
+                slot_props = self.getProperties(slot_node, 'name', 'xpos')
+                xpos = int(slot_props['xpos'])
+                del slot_props['xpos']
+                self.addObject('cpsskins.canvas.slot', cells[xpos],
+                               **slot_props)
 
     def addObject(self, type, container, name=u'', **props):
         object = createObject(type, **props)
         namechooser = INameChooser(container)
         new_name = namechooser.chooseName(name, object)
         container[new_name] = object
+        return object
 
     def importObject(self, node, container, current_path):
         archive = self.archive
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to