Author: jmorliaguet
Date: Wed Nov  2 22:33:35 2005
New Revision: 28915

Modified:
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
   z3lab/cpsskins/branches/jmo-perspectives/engines/default/engine.zcml
   
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/accesskeys/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/ftests/test_filters.py
Log:

- added test access key filter

- import path fix



Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/filters/metaconfigure.py 
    Wed Nov  2 22:33:35 2005
@@ -28,13 +28,8 @@
 
 filter_registry = getUtility(IRegistry, 'filters')
 
-def filter(_context,
-           name='',
-           for_=None,
-           factory=None,
-           predicate=None,
-           template='',
-           stylesheet=None):
+def filter(_context, name='', for_=None, factory=None, predicate=None,
+           template='', stylesheet=None):
 
     if not name:
         raise ConfigurationError("Must specify the filter name.")

Modified: z3lab/cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt  Wed Nov 
 2 22:33:35 2005
@@ -84,7 +84,7 @@
 the widget filter adapts the widget providing a view:
 
     >>> from cpsskins.engines.default.filters.widget import WidgetFilter
-    >>> from cpsskins.engines.default.filters.widget import IWidget
+    >>> from cpsskins.engines.default.formats.interfaces import IWidget
     >>> from cpsskins.browser.rendering.interfaces import IFilter
 
     >>> ztapi.provideAdapter((IWidget,), IFilter, WidgetFilter)

Modified: z3lab/cpsskins/branches/jmo-perspectives/engines/default/engine.zcml
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/engines/default/engine.zcml        
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/engines/default/engine.zcml        
Wed Nov  2 22:33:35 2005
@@ -10,9 +10,6 @@
       for="cpsskins.elements.interfaces.ITheme"
   />
 
-
-  <!-- Canvas elements -->
-
   <renderer
       for="cpsskins.elements.interfaces.IThemePage"
       engine="default"
@@ -30,8 +27,11 @@
         name="style"
     />
 
-  </renderer>
+    <filter
+        name="accesskeys"
+    />
 
+  </renderer>
 
   <renderer
       for="cpsskins.elements.interfaces.IPageBlock
@@ -53,16 +53,10 @@
 
   </renderer>
 
-
   <renderer
       for="cpsskins.elements.interfaces.ISlot"
       engine="default"
-      >
-
-  </renderer>
-
-
-  <!-- Content elements -->
+  />
 
   <renderer
       for="cpsskins.elements.interfaces.IPortlet"
@@ -87,5 +81,4 @@
 
   </renderer>
 
-
 </configure>

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/accesskeys/__init__.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/accesskeys/__init__.py
     (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/engines/default/filters/accesskeys/__init__.py
     Wed Nov  2 22:33:35 2005
@@ -17,10 +17,14 @@
 """
 __docformat__ = "reStructuredText"
 
+import re
+
 from zope.interface import implements
 
 from cpsskins.browser.rendering.interfaces import IFilter
 
+startTag = re.compile('<.*?>')
+
 class AccessKeys(object):
     """Adds access keys above an element.
 
@@ -33,5 +37,11 @@
     def __call__(self, markup, info):
         """Apply the filter"""
 
-        # TODO: insert access keys herer
+        s = startTag.search(markup)
+        if s is None:
+            return markup
+
+        accesskey_markup = '<div><a accesskey="_" 
href="@@test.html"></a></div>'
+        markup = s.group() + accesskey_markup + markup[s.end():]
         return markup
+

Modified: z3lab/cpsskins/branches/jmo-perspectives/ftests/test_filters.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/ftests/test_filters.py     
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/ftests/test_filters.py     Wed Nov 
 2 22:33:35 2005
@@ -27,6 +27,7 @@
         DocTestSuite('cpsskins.engines.default.filters.layout'),
         DocTestSuite('cpsskins.engines.default.filters.style'),
         DocTestSuite('cpsskins.engines.default.filters.htmlcleaner'),
+        DocTestSuite('cpsskins.engines.default.filters.accesskeys'),
         ))
 
 if __name__ == '__main__':
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to