Author: jmorliaguet
Date: Sun Dec 11 01:58:26 2005
New Revision: 2010

Added:
   cpsskins/branches/jmo-perspectives/io/
   cpsskins/branches/jmo-perspectives/io/perspective.xml
      - copied unchanged from r2009, 
cpsskins/branches/jmo-perspectives/perspectives/perspective.xml
   cpsskins/branches/jmo-perspectives/io/style.xml
      - copied unchanged from r2009, 
cpsskins/branches/jmo-perspectives/engines/default/formats/style.xml
Removed:
   cpsskins/branches/jmo-perspectives/engines/default/formats/style.xml
   cpsskins/branches/jmo-perspectives/perspectives/perspective.xml
Modified:
   cpsskins/branches/jmo-perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml
   cpsskins/branches/jmo-perspectives/engines/default/formats/style.py
   cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/perspectives/perspective.py
   cpsskins/branches/jmo-perspectives/relations/configure.zcml
   cpsskins/branches/jmo-perspectives/relations/predicates.py
   cpsskins/branches/jmo-perspectives/setup/interfaces.py
   cpsskins/branches/jmo-perspectives/setup/registration.py
   cpsskins/branches/jmo-perspectives/tests/test_relations.py
Log:

- moved XML import / export to cpsskins.io

- registered a relation exporter / importer (not implemented)

- test updates



Modified: cpsskins/branches/jmo-perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/configure.zcml   (original)
+++ cpsskins/branches/jmo-perspectives/configure.zcml   Sun Dec 11 01:58:26 2005
@@ -94,4 +94,6 @@
 
   <include package=".setup" />
 
+  <include package=".io" />
+
 </configure>

Modified: 
cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/formats/configure.zcml   
Sun Dec 11 01:58:26 2005
@@ -36,20 +36,6 @@
       factory=".style.StyleFactory"
   />
 
-  <!-- XML export -->
-  <browser:page
-      name="exporter"
-      for=".style.IStyle"
-      class=".style.Exporter"
-      permission="zope.ManageContent"
-      template="style.xml"
-  />
-
-  <!-- XML import -->
-  <adapter
-      factory=".style.Importer"
-  />
-
   <!-- Widget -->
   <cpsskins:format
       name="widget"

Modified: cpsskins/branches/jmo-perspectives/engines/default/formats/style.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/formats/style.py 
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/formats/style.py Sun Dec 
11 01:58:26 2005
@@ -17,12 +17,8 @@
 """
 __docformat__ = "reStructuredText"
 
-from xml.dom.minidom import parseString
-
 from persistent.mapping import PersistentMapping
 
-from zope.app.publisher.browser import BrowserView
-from zope.component import adapts
 from zope.component.interfaces import IFactory
 from zope.interface import implements, implementedBy
 from zope.interface.common.mapping import IMapping
@@ -31,7 +27,6 @@
 from cpsskins.elements.interfaces import IFormat
 from cpsskins.elements.format import Format
 from cpsskins.relations import Predicate
-from cpsskins.setup.interfaces import IDataExporter, IDataImporter
 
 _ = MessageFactory("cpsskins")
 
@@ -174,41 +169,3 @@
 
 StyleFactory = StyleFactory()
 
-class Exporter(BrowserView):
-    """This adapter makes it possible to export style resources
-    """
-    implements(IDataExporter)
-
-    def export(self):
-        return self.template()
-
-    def getInfo(self):
-        info = []
-        for k, v in self.context.items():
-            properties = [{'name': name, 'value': value}
-                         for name, value in v.items()]
-            info.append({'selector': k, 'properties': properties})
-        return info
-
-class Importer(object):
-    """This adapter makes it possible to import style resources.
-    """
-    adapts(IStyle)
-    implements(IDataImporter)
-
-    def __init__(self, context):
-        self.context = context
-
-    def load(self, xml=u''):
-        context = self.context
-        dom = parseString(xml)
-        for style in dom.getElementsByTagName('style'):
-            for sel in style.getElementsByTagName('selector'):
-                sel_name = sel.getAttribute('name')
-                style_props = {}
-                for prop in sel.getElementsByTagName('property'):
-                    name = prop.getAttribute('name')
-                    value = prop.getAttribute('value')
-                    style_props[name] = value
-                context[sel_name] = style_props
-

Modified: cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      Sun Dec 
11 01:58:26 2005
@@ -34,20 +34,4 @@
       schema=".interfaces.IPerspective"
   />
 
-  <!-- XML export -->
-  <browser:page
-      name="exporter"
-      for=".interfaces.IPerspective"
-      class=".perspective.Exporter"
-      permission="zope.ManageContent"
-      template="perspective.xml"
-  />
-
-  <!-- XML import -->
-  <adapter
-      for=".interfaces.IPerspective"
-      factory=".perspective.Importer"
-      provides="cpsskins.setup.interfaces.IDataImporter"
-  />
-
 </configure>

Modified: cpsskins/branches/jmo-perspectives/perspectives/perspective.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/perspective.py      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/perspective.py      Sun Dec 
11 01:58:26 2005
@@ -26,7 +26,6 @@
 
 from cpsskins.perspectives.interfaces import IPerspective
 from cpsskins.relations.interfaces import IRelatable
-from cpsskins.setup.interfaces import IDataExporter, IDataImporter
 
 class Perspective(object):
     """A perspective
@@ -78,29 +77,3 @@
     def __str__(self):
         return str(self.context)
 
-class Exporter(BrowserView):
-    """This view makes it possible to export style resource data
-    """
-    implements(IDataExporter)
-
-    def export(self):
-        return self.template()
-
-class Importer(object):
-    """This adapter makes it possible to import style resource data
-    """
-    adapts(IPerspective)
-    implements(IDataImporter)
-
-    def __init__(self, context):
-        self.context = context
-
-    def load(self, xml=u''):
-        context = self.context
-        dom = parseString(xml)
-        perspectives = dom.getElementsByTagName('perspective')
-        if perspectives:
-            perspective = perspectives[0]
-            context.name = perspective.getAttribute('name')
-            context.title = perspective.getAttribute('value')
-

Modified: cpsskins/branches/jmo-perspectives/relations/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/relations/configure.zcml (original)
+++ cpsskins/branches/jmo-perspectives/relations/configure.zcml Sun Dec 11 
01:58:26 2005
@@ -1,5 +1,6 @@
 <configure
     xmlns="http://namespaces.zope.org/zope";
+    xmlns:browser="http://namespaces.zope.org/browser";
     xmlns:cpsskins="http://namespaces.zope.org/cpsskins";>
 
   <content class=".Relation">

Modified: cpsskins/branches/jmo-perspectives/relations/predicates.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/relations/predicates.py  (original)
+++ cpsskins/branches/jmo-perspectives/relations/predicates.py  Sun Dec 11 
01:58:26 2005
@@ -89,12 +89,12 @@
     1
 
     >>> [p for p in is_black_or_white]
-    [u'_ is black', '_ is white']
+    ['_ is black', '_ is white']
 
     Compound predicates can be combined to form a new predicate:
-    >>> P1 = Predicate('_ is A')
-    >>> P2 = Predicate('_ is B')
-    >>> P3 = Predicate('_ is C')
+    >>> P1 = Predicate(u'_ is A')
+    >>> P2 = Predicate(u'_ is B')
+    >>> P3 = Predicate(u'_ is C')
     >>> CP = CompoundPredicate((P1, P2))
     >>> CP
     <Compound Predicate: '_ is A OR _ is B'>

Modified: cpsskins/branches/jmo-perspectives/setup/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/interfaces.py      (original)
+++ cpsskins/branches/jmo-perspectives/setup/interfaces.py      Sun Dec 11 
01:58:26 2005
@@ -19,7 +19,7 @@
 
 from zope.interface import Interface, Attribute
 from zope.interface.interfaces import IInterface
-from zope.schema import Bool, TextLine
+from zope.schema import TextLine
 
 class ISettings(Interface):
     """ """
@@ -78,15 +78,3 @@
     def customize(name, context):
         """Customize a resource."""
 
-class IDataExporter(Interface):
-    """A data exporter is used to export data to XML
-    """
-    def export():
-        """Export to XML."""
-
-class IDataImporter(Interface):
-    """A data import is used to import data from XML
-    """
-    def load(xml):
-        """Load data from XML."""
-

Modified: cpsskins/branches/jmo-perspectives/setup/registration.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/registration.py    (original)
+++ cpsskins/branches/jmo-perspectives/setup/registration.py    Sun Dec 11 
01:58:26 2005
@@ -28,7 +28,8 @@
 from zope.component import queryUtility, getUtility
 from zope.component.interfaces import IFactory
 
-from cpsskins.setup.interfaces import IDataImporter, IResourceManager
+from cpsskins.io.interfaces import IDataImporter
+from cpsskins.setup.interfaces import IResourceManager
 from cpsskins.setup.interfaces import ISetting, IResource
 
 DEBUG = logging.DEBUG

Modified: cpsskins/branches/jmo-perspectives/tests/test_relations.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/tests/test_relations.py  (original)
+++ cpsskins/branches/jmo-perspectives/tests/test_relations.py  Sun Dec 11 
01:58:26 2005
@@ -200,6 +200,8 @@
     return unittest.TestSuite((
         DocTestSuite('cpsskins.relations'),
         DocTestSuite('cpsskins.relations.storage'),
+        DocTestSuite('cpsskins.relations.predicates'),
+        DocTestSuite('cpsskins.relations.tool'),
         unittest.makeSuite(TestRelationStorage),
         ))
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to