Author: jmorliaguet
Date: Sun May 21 20:57:56 2006
New Revision: 3181

Added:
   cpsskins/branches/paris-sprint-2006/setup/traversal.py   (contents, props 
changed)
Modified:
   cpsskins/branches/paris-sprint-2006/setup/configure.zcml

Log:

- added an ++image++ traversal adapter



Modified: cpsskins/branches/paris-sprint-2006/setup/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/configure.zcml    (original)
+++ cpsskins/branches/paris-sprint-2006/setup/configure.zcml    Sun May 21 
20:57:56 2006
@@ -19,8 +19,7 @@
 
   <adapter
       name="type"
-      provides="zope.traversing.interfaces.IPathAdapter"
-      for="*"
+      provides="zope.traversing.interfaces.IPathAdapter" for="*"
       factory="cpsskins.setup.adapters.Type"
   />
 
@@ -39,6 +38,22 @@
       factory="cpsskins.setup.adapters.Identifiable"
   />
 
+  <!-- 'image' traversal -->
+  <adapter
+      name="image"
+      provides="zope.traversing.interfaces.ITraversable"
+      for="*"
+      factory="cpsskins.setup.traversal.image"
+  />
+
+  <view
+      name="image"
+      type="zope.interface.Interface"
+      provides="zope.traversing.interfaces.ITraversable"
+      for="*"
+      factory="cpsskins.setup.traversal.image"
+  />
+
   <!-- register global application sites and settings -->
   <subscriber
       handler=".registration.loadEvent"

Added: cpsskins/branches/paris-sprint-2006/setup/traversal.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/setup/traversal.py      Sun May 21 
20:57:56 2006
@@ -0,0 +1,38 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Traversal adapters
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.component import getUtility
+from zope.interface import implements
+from zope.traversing.interfaces import ITraversable
+
+from cpsskins.setup.interfaces import IResourceManager
+
+class image(object):
+
+    implements(ITraversable)
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+
+    def traverse(self, name, ignored):
+        resources = getUtility(IResourceManager)
+        uri = u'cpsskins://[EMAIL PROTECTED]' % name
+        return resources.resolve(uri, context=self.context)
+
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to