Author: jmorliaguet
Date: Sat Nov 19 20:56:36 2005
New Revision: 1897

Added:
   cpsskins/branches/jmo-perspectives/configuration/resources/
   cpsskins/branches/jmo-perspectives/configuration/resources/__init__.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/resources/meta.zcml   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/resources/metaconfigure.py  
 (contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/resources/metadirectives.py 
  (contents, props changed)
Modified:
   cpsskins/branches/jmo-perspectives/configuration/meta.zcml
   cpsskins/branches/jmo-perspectives/engines/default/perspectives.zcml
Log:


- saving work:

   added a cpsskins:resource directive to simplify the import of resources

   resources are represented on the filesystem using xml pickles until a better
   format is found.



Modified: cpsskins/branches/jmo-perspectives/configuration/meta.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/meta.zcml  (original)
+++ cpsskins/branches/jmo-perspectives/configuration/meta.zcml  Sat Nov 19 
20:56:36 2005
@@ -22,4 +22,6 @@
 
   <include package=".storages" file="meta.zcml" />
 
+  <include package=".resources" file="meta.zcml" />
+
 </configure>

Added: cpsskins/branches/jmo-perspectives/configuration/resources/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/resources/__init__.py      
Sat Nov 19 20:56:36 2005
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+

Added: cpsskins/branches/jmo-perspectives/configuration/resources/meta.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/resources/meta.zcml        
Sat Nov 19 20:56:36 2005
@@ -0,0 +1,12 @@
+<configure xmlns="http://namespaces.zope.org/meta";>
+
+  <directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <directive
+       name="resource"
+       schema=".metadirectives.IResourceDirective"
+       handler=".metaconfigure.resource" />
+
+  </directives>
+
+</configure>

Added: 
cpsskins/branches/jmo-perspectives/configuration/resources/metaconfigure.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/resources/metaconfigure.py 
Sat Nov 19 20:56:36 2005
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.configuration.exceptions import ConfigurationError
+from zope.xmlpickle import xmlpickle
+
+def resource(_context, name=u'', type=None, file=None):
+
+    if not name:
+        raise ConfigurationError("Must specify a resource name.")
+
+    if not type:
+        raise ConfigurationError("Must specify a resource type.")
+
+    if not file:
+        raise ConfigurationError("Must specify a resource file.")
+
+    f = open(file)
+    pickle = f.read()
+    f.close()
+
+    resource = xmlpickle.loads(pickle)
+
+    # TODO: register the resource
+    print repr(resource)
+

Added: 
cpsskins/branches/jmo-perspectives/configuration/resources/metadirectives.py
==============================================================================
--- (empty file)
+++ 
cpsskins/branches/jmo-perspectives/configuration/resources/metadirectives.py    
    Sat Nov 19 20:56:36 2005
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.configuration.fields import GlobalObject, Path
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import TextLine
+
+_ = MessageFactory("cpsskins")
+
+class IResourceDirective(Interface):
+
+    name = TextLine(
+        title=_("Name"),
+        description=_("The name of the resource."),
+        required=False,
+        )
+
+    type = GlobalObject(
+        title=_("Type"),
+        description=_("The type the resource."),
+        required=False,
+        )
+
+    file = Path(
+        title=_("File"),
+        description=_("The resource file."),
+        required=False,
+        )
+

Modified: cpsskins/branches/jmo-perspectives/engines/default/perspectives.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/default/perspectives.zcml        
(original)
+++ cpsskins/branches/jmo-perspectives/engines/default/perspectives.zcml        
Sat Nov 19 20:56:36 2005
@@ -6,4 +6,12 @@
       title="Global perspective"
   />
 
+  <!-- XXX for testing -->
+
+  <resource
+      type="cpsskins.configuration.perspectives.perspective.IPerspective"
+      name="cpsskins.globalperspective"
+      file="globalperspective.xml"
+  />
+
 </configure>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to