Author: jmorliaguet
Date: Sun Mar 26 23:50:03 2006
New Revision: 2733

Added:
   cpsskins/branches/jmo-perspectives/ftests/test_io.py   (contents, props 
changed)
Modified:
   cpsskins/branches/jmo-perspectives/io/README.txt
   cpsskins/branches/jmo-perspectives/io/perspective.py
   cpsskins/branches/jmo-perspectives/io/relation.py
   cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
   cpsskins/branches/jmo-perspectives/setup/README.txt
Log:

- IO test updates



Added: cpsskins/branches/jmo-perspectives/ftests/test_io.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/ftests/test_io.py        Sun Mar 26 
23:50:03 2006
@@ -0,0 +1,50 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Format tests
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import re
+import unittest
+
+from zope.app.testing import ztapi
+from zope.app.testing.functional import FunctionalDocFileSuite
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import ztapi
+from zope.component import getMultiAdapter
+from zope.configuration.xmlconfig import XMLConfig
+from zope.publisher.browser import TestRequest
+from zope.interface import implements
+
+import cpsskins.elements.element
+
+from cpsskins.elements.interfaces import IElement, IIdentifiable
+from cpsskins.elements.element import Identifiable
+from cpsskins.relations.interfaces import IRelatable
+from cpsskins.io.interfaces import IDataExporter, IDataImporter
+
+def setUp(test):
+    from cpsskins.io import element
+    ztapi.browserViewProviding(IElement, element.Exporter, IDataExporter)
+    ztapi.provideAdapter(IElement, IDataImporter, element.Importer)
+
+def test_suite():
+    return unittest.TestSuite((
+        FunctionalDocFileSuite('../io/README.txt', setUp=setUp),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: cpsskins/branches/jmo-perspectives/io/README.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/io/README.txt    (original)
+++ cpsskins/branches/jmo-perspectives/io/README.txt    Sun Mar 26 23:50:03 2006
@@ -1,5 +1,5 @@
 
-$id$
+$id:$
 
 ===============
 IMPORT / EXPORT
@@ -7,7 +7,8 @@
 
 This package contains XML exporters and importers.
 
-Resources must be identifiable within a given context.
+Resources must be uniquely identifiable to be exported or imported.
+
 Their name is obtained from a combination of element, resource and content
 type names.
 
@@ -42,12 +43,21 @@
 The element name of a given resource is obtained from the "IElementType"
 interface:
 
+    >>> from zope.app.interface import queryType
+
+    >>> from cpsskins.elements.interfaces import IElementType
+    >>> from cpsskins.elements.theme import Theme
+
+    >>> resource = Theme()
     >>> element_type = queryType(resource, IElementType)
-    >>> name = element_type.getTaggedValue('name')
+    >>> element_type.getTaggedValue('name')
+    u'canvas'
 
-or:
+or more simply:
 
-    >>> name = resource.elementname
+    >>> from cpsskins.elements.interfaces import IType
+    >>> IType(resource).elementname
+    u'canvas'
 
 
 2) Resource types
@@ -59,15 +69,23 @@
 
 - formats: 'widget', 'style', 'effect', 'layout', ...
 
+- perspectives: 'perspective'
+
 The resource name of a given resource is obtained from the "IResourceType"
 interface:
 
+    >>> from cpsskins.setup.interfaces import IResourceType
+    >>> from cpsskins.ui.standard.formats.style import Style
+
+    >>> resource = Style()
     >>> resource_type = queryType(resource, IResourceType)
-    >>> name = resource_type.getTaggedValue('name')
+    >>> resource_type.getTaggedValue('name')
+    u'style'
 
 or:
 
-    >>> name = resource.resourcename
+    >>> IType(resource).resourcename
+    u'style'
 
 
 3) Content types
@@ -85,21 +103,27 @@
 The content name of a given resource is obtained from the "IContentType"
 interface:
 
+    >>> from zope.app.content.interfaces import IContentType
+    >>> from cpsskins.portlets.actions.portlet import Actions
+
+    >>> resource = Actions()
     >>> content_type = queryType(resource, IContentType)
-    >>> name = content_type.getTaggedValue('name')
+    >>> content_type.getTaggedValue('name')
+    'cpsskins.actions'
 
 or:
 
-    >>> name = resource.contentname
+    >>> IType(resource).contentname
+    'cpsskins.actions'
 
 
-Combinations
-------------
+Combination of the three categories
+-----------------------------------
 
 URI
 ~~~
 
-To identify resources a URI (Uniform Resource Identifier) is used.
+To identify resources, a URI (Uniform Resource Identifier) is used.
 A URI consists of a prefix and a suffix separated by a '.' character.
 The prefix is the *resource name* described above.
 The suffix identifies the resource inside the namespace.

Modified: cpsskins/branches/jmo-perspectives/io/perspective.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/io/perspective.py        (original)
+++ cpsskins/branches/jmo-perspectives/io/perspective.py        Sun Mar 26 
23:50:03 2006
@@ -27,7 +27,7 @@
 from cpsskins.io.interfaces import IDataExporter, IDataImporter
 
 class Exporter(object):
-    """This view makes it possible to export style resource data
+    """Export a perspective.
     """
     implements(IDataExporter)
 
@@ -37,7 +37,7 @@
         return self.template()
 
 class Importer(object):
-    """This adapter makes it possible to import style resource data
+    """Import a perspective.
     """
     adapts(IPerspective)
     implements(IDataImporter)

Modified: cpsskins/branches/jmo-perspectives/io/relation.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/io/relation.py   (original)
+++ cpsskins/branches/jmo-perspectives/io/relation.py   Sun Mar 26 23:50:03 2006
@@ -28,7 +28,7 @@
 from cpsskins.io.interfaces import IDataExporter, IDataImporter
 
 class Exporter(object):
-    """This view is used to exports relations to XML
+    """Export a relation.
     """
     implements(IDataExporter)
 
@@ -56,7 +56,8 @@
             }
 
 class Importer(object):
-
+    """Import a relation.
+    """
     adapts(IRelation)
     implements(IDataImporter)
 

Modified: cpsskins/branches/jmo-perspectives/perspectives/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/perspectives/configure.zcml      Sun Mar 
26 23:50:03 2006
@@ -27,7 +27,7 @@
       provides="cpsskins.relations.interfaces.IRelatable"
   />
 
-  <!-- register the 'perspective' XML directive -->
+  <!-- register the 'perspective' setting -->
   <cpsskins:setting
       name="perspective"
       factory=".perspective.PerspectiveFactory"

Modified: cpsskins/branches/jmo-perspectives/setup/README.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/README.txt (original)
+++ cpsskins/branches/jmo-perspectives/setup/README.txt Sun Mar 26 23:50:03 2006
@@ -274,4 +274,4 @@
     >>> refreshSettings()
 
 In that case the file's modification date is compared with the date when the
-settings where last loaded.
+settings were last loaded.
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to