Author: jmorliaguet
Date: Tue Apr 11 20:08:07 2006
New Revision: 2817

Modified:
   cpsskins/branches/jmo-perspectives/standard/io/relation.py
   cpsskins/branches/jmo-perspectives/standard/io/relation.zcml
Log:

- saving work: refactoring of relation importer



Modified: cpsskins/branches/jmo-perspectives/standard/io/relation.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/io/relation.py  (original)
+++ cpsskins/branches/jmo-perspectives/standard/io/relation.py  Tue Apr 11 
20:08:07 2006
@@ -58,18 +58,22 @@
 class Importer(object):
     """Import a relation.
     """
-    adapts(IRelation)
     implements(IDataImporter)
 
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+
     def load(self, xml=u''):
         context = self.context
         dom = parseString(xml)
+
         for relation in dom.getElementsByTagName('relation'):
             predicate = relation.getAttribute('predicate')
             position = 0
-            for relate in relation.getElementsByTagName('relate'):
-                path = relate.getAttribute('path')
-                obj = traverse(context, path)
-                context[position] = obj
-            context._predicate = predicate
+            relates = relation.getElementsByTagName('relate')
+            for relate in relates:
+                uri = relate.getAttribute('uri')
+                obj = resolve(uri) # TODO
+            arity = len(relates)
 

Modified: cpsskins/branches/jmo-perspectives/standard/io/relation.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/io/relation.zcml        
(original)
+++ cpsskins/branches/jmo-perspectives/standard/io/relation.zcml        Tue Apr 
11 20:08:07 2006
@@ -10,8 +10,11 @@
       permission="zope.ManageContent"
   />
 
-  <adapter
-      factory=".relation.Importer"
+  <browser:view
+      provides="cpsskins.setup.interfaces.IDataImporter"
+      for="cpsskins.relations.interfaces.IRelationStorage"
+      class=".relation.Importer"
+      permission="zope.ManageContent"
   />
 
 </configure>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to