Author: jmorliaguet
Date: Fri Apr 28 22:47:19 2006
New Revision: 2982

Modified:
   cpsskins/branches/paris-sprint-2006/standard/io/relation.py
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
Log:

- some fixes in the import of relations
  (must still find a way to resolve URIs to dereference relates)



Modified: cpsskins/branches/paris-sprint-2006/standard/io/relation.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/io/relation.py (original)
+++ cpsskins/branches/paris-sprint-2006/standard/io/relation.py Fri Apr 28 
22:47:19 2006
@@ -74,28 +74,27 @@
 
         relations = getThemeManager(context).getRelationStorage()
 
-        for relation_def in dom.getElementsByTagName('relation'):
-            predicate_str = relation_def.getAttribute('predicate')
-            predicate = Predicate(predicate_str)
-
-            relates_def = relation_def.getElementsByTagName('relate')
-            relates = []
-
-            for relate_def in relates_def:
-                uri = relate_def.getAttribute('uri')
-                #obj = resolve(uri) # TODO
-                obj = uri
-                relates.append(obj)
-
-            arity = len(relates_def)
-
-            if arity == 1:
-                rel = MonadicRelation(predicate=predicate, first=relates[0])
-            elif arity == 2:
-                rel = DyadicRelation(predicate=predicate, first=relates[0],
-                                     second=relates[1])
-            elif arity == 3:
-                rel = TriadicRelation(predicate=predicate, first=relates[0],
-                                      second=relates[1], third=relates[2])
+        predicate_str = dom.getAttribute('predicate')
+        predicate = Predicate(predicate_str)
 
-            relations.add(rel)
+        relates_def = dom.getElementsByTagName('relate')
+        relates = []
+
+        for relate_def in relates_def:
+            uri = relate_def.getAttribute('uri')
+            #obj = resolve(uri) # TODO
+            obj = uri
+            relates.append(obj)
+
+        arity = len(relates_def)
+
+        if arity == 1:
+            rel = MonadicRelation(predicate=predicate, first=relates[0])
+        elif arity == 2:
+            rel = DyadicRelation(predicate=predicate, first=relates[0],
+                                 second=relates[1])
+        elif arity == 3:
+            rel = TriadicRelation(predicate=predicate, first=relates[0],
+                                  second=relates[1], third=relates[2])
+
+        relations.add(rel)

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 Fri Apr 
28 22:47:19 2006
@@ -156,6 +156,7 @@
     def importSite(self, file=None):
 
         archive = TarArchive(mode='r', data=file.read())
+
         mgr = getThemeManager(self.context)
 
         uri_mapping = {}
@@ -165,9 +166,10 @@
 
         # storages
         for storage_id in u'formats', u'displays', u'portlets':
-            data = archive[u'%s.xml' % storage_id]
             storage = mgr[storage_id]
             storage.purge()
+
+            data = archive[u'%s.xml' % storage_id]
             uri_mapping.update(self.importStorage(storage_id, data))
 
         for k, v in uri_mapping.items():
@@ -244,7 +246,7 @@
         if not name:
             raise KeyError("Must specify a storage name.")
 
-        mgr = getThemeManager(context)
+        mgr = getThemeManager(self.context)
         storage = mgr[name]
 
         dom = parseString(xml)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to