[z3-checkins] r14887 - in z3/Flon/trunk: . skins/flon tests tools

dreamcatcher at codespeak.net dreamcatcher at codespeak.net
Thu Jul 21 20:02:16 CEST 2005


Author: dreamcatcher
Date: Thu Jul 21 20:02:07 2005
New Revision: 14887

Removed:
   z3/Flon/trunk/tests/runalltests.py
   z3/Flon/trunk/tests/zopeconf.py
Modified:
   z3/Flon/trunk/makefile.in
   z3/Flon/trunk/skins/flon/edit_marker_form.cpt
   z3/Flon/trunk/tests/test_tool.py
   z3/Flon/trunk/tests/test_views.py
   z3/Flon/trunk/tools/interface.py
Log:

- Some testing cleanup and better form


Modified: z3/Flon/trunk/makefile.in
==============================================================================
--- z3/Flon/trunk/makefile.in	(original)
+++ z3/Flon/trunk/makefile.in	Thu Jul 21 20:02:07 2005
@@ -7,10 +7,9 @@
 PYTHON="/usr/bin/python"
 TMPDIR=~/tmp
 
-CURDIR=~/src/projects/Flon
-BASE_DIR=${CURDIR}/..
-SOFTWARE_HOME=~/src/zope/2_7/lib/python
-INSTANCE_HOME=~/src/instance/shellex
+CURDIR=$(shell pwd)
+BASE_DIR=$(shell dirname ${CURDIR})
+INSTANCE_HOME=~/src/instance/plone21
 PACKAGES=Flon
 
 
@@ -28,7 +27,7 @@
 .PHONY : default
 
 # default:     The default step (invoked when make is called without a target)
-default: clean test
+default: test
 
 clean :
 	find . \( -name '*~' -o -name '*.py[co]' -o -name '*.bak' \) -exec rm {} \; -print
@@ -37,9 +36,8 @@
 	~/src/reindent.py -r -v .
 
 test :
-	export INSTANCE_HOME=${INSTANCE_HOME}; \
-	export SOFTWARE_HOME=${SOFTWARE_HOME}; \
-	cd ${CURDIR}/tests && ${PYTHON} runalltests.py
+	cd $(INSTANCE_HOME) && \
+	./bin/zopectl test -v --keepbytecode --libdir Products/$(NAME)
 
 
 # sdist:       Create a source distribution file (implies clean).
@@ -53,8 +51,10 @@
           ${CURDIR}/version.txt
 	${MKDIR} ${TMPDIR}/${PACKAGE_NAME}
 	${CD} ${TMPDIR}/${PACKAGE_NAME} && \
-          for package in ${PACKAGES}; do ${LN} ${BASE_DIR}/$$package .; done && \
-          ${CD} ${TMPDIR} && ${TAR} czfh ${BASE_DIR}/${PACKAGE_NAME}.tgz ${PACKAGE_NAME} \
+          for package in ${PACKAGES}; \
+	  do ${LN} ${BASE_DIR}/$$package .; \
+          done && \
+          ${CD} ${TMPDIR} && ${TAR} \
            --exclude=${PACKAGE_NAME}.tgz\
            --exclude=CVS \
            --exclude=.cvsignore \
@@ -63,5 +63,6 @@
            --exclude=*.pyc \
            --exclude=TAGS \
            --exclude=*~ \
-           --exclude=.#*
+           --exclude=.#* \
+	czfh ${BASE_DIR}/${PACKAGE_NAME}.tgz ${PACKAGE_NAME}
 	${RMRF} ${TMPDIR}/${PACKAGE_NAME}

Modified: z3/Flon/trunk/skins/flon/edit_marker_form.cpt
==============================================================================
--- z3/Flon/trunk/skins/flon/edit_marker_form.cpt	(original)
+++ z3/Flon/trunk/skins/flon/edit_marker_form.cpt	Thu Jul 21 20:02:07 2005
@@ -13,20 +13,20 @@
       </h1>
 
       <p i18n:translate="description_edit_marker">
-        A marker interface is used to identify an instance of a piece of content.
-        When in conjunction with Five, this allows you to enable and disable
-        views based on marker interfaces for example.
+        A marker interface is used to set a marker on a piece of content.
+        This allows you to enable and disable functionality
+        based on the markers you've set.
       </p>
 
       <form name="edit_form"
             action="."
             method="post"
             enctype="multipart/form-data"
-            tal:attributes="action string:${context/getId}/${template/getId}"
+            tal:attributes="action string:${context/absolute_url}/${template/getId}"
             tal:define="iface_tool iface_tool|portal/portal_interface|nothing;
-provided python:iface_tool.getDirectlyProvidedNames(context);
-                              available python:iface_tool.getMarkerInterfaceNames(context);
-                              impl python:iface_tool.getProvidedNames(context)"
+                        provided python:iface_tool.getDirectlyProvidedNames(context);
+                        available python:iface_tool.getMarkerInterfaceNames(context);
+                        impl python:iface_tool.getProvidedNames(context)"
             tal:condition="iface_tool">
 
         <fieldset>
@@ -53,34 +53,51 @@
 
             <div tal:content="error">Validation error output</div>
 
+            <table class="listing"
+                   tal:define="ifaces python:iface_tool.getReadableInterfaces(provided)">
+              <thead>
+                <tr>
+                  <th>&nbsp;</th>
+                  <th>Interface</th>
+                  <th>Description</th>
+                </tr>
+              </thead>
+
+              <tbody>
+                <tal:rows tal:repeat="info ifaces">
+                  <tr tal:define="oddrow repeat/info/odd;
+                                  iface info/dotted_name;
+                                  name info/name;
+                                  doc info/doc;"
+                      tal:attributes="class python:test(oddrow, 'even', 'odd')">
+                    <td>
+                      <input type="checkbox"
+                             id="iface-name"
+                             name="remove:list"
+                             value=""
+                             size="40"
+                             tabindex=""
+                             tal:attributes="value iface;
+                                             id iface;
+                                             tabindex tabindex/next;
+                                             checked python:iface in remove and 'checked'"
+                             />
+                    </td>
+                    <td>
+                      <label for=""
+                             i18n:translate=""
+                             tal:attributes="for iface"
+                             tal:content="name" />
+                    </td>
+                    <td tal:content="doc">
+                      doc string description
+                    </td>
+                  </tr>
+                </tal:rows>
+              </tbody>
 
-            <tal:block tal:repeat="iface provided">
+            </table>
 
-              <input type="checkbox"
-                     id="iface-name"
-                     name="remove:list"
-                     value=""
-                     size="40"
-                     tabindex=""
-                     tal:attributes="value iface;
-                                     id iface;
-                                     tabindex tabindex/next;
-                                     checked python:iface in remove and 'checked'"
-                     />
-
-              <label for=""
-                     i18n:translate=""
-                     tal:attributes="for iface"
-                     tal:content="iface" />
-
-              [<a href=""
-                   tal:attributes="href string:${here_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
-                  Views
-              </a>]
-
-              <br />
-
-            </tal:block>
           </div>
 
           <div class="field"
@@ -99,34 +116,50 @@
             <div tal:content="error">Validation error output</div>
 
 
-            <tal:block tal:repeat="iface available">
-
-              <input type="checkbox"
-                     id="iface-name"
-                     name="add:list"
-                     value=""
-                     size="40"
-                     tabindex=""
-                     tal:attributes="value iface;
-                                     id iface;
-                                     tabindex tabindex/next;
-                                     checked python:iface in add and 'checked'"
-                     />
-
-              <label for=""
-                     i18n:translate=""
-                     tal:attributes="for iface"
-                     tal:content="iface"
-                     />
-
-              [<a href=""
-                   tal:attributes="href string:${context/absolute_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
-                  Views
-              </a>]
+            <table class="listing"
+                   tal:define="ifaces python:iface_tool.getReadableInterfaces(available)">
+              <thead>
+                <tr>
+                  <th>&nbsp;</th>
+                  <th>Interface</th>
+                  <th>Description</th>
+                </tr>
+              </thead>
+
+              <tbody>
+                <tal:rows tal:repeat="info ifaces">
+                  <tr tal:define="oddrow repeat/info/odd;
+                                  iface info/dotted_name;
+                                  name info/name;
+                                  doc info/doc;"
+                      tal:attributes="class python:test(oddrow, 'even', 'odd')">
+                    <td>
+                      <input type="checkbox"
+                             id="iface-name"
+                             name="add:list"
+                             value=""
+                             size="40"
+                             tabindex=""
+                             tal:attributes="value iface;
+                                             id iface;
+                                             tabindex tabindex/next;
+                                             checked python:iface in add and 'checked'"
+                             />
+                    </td>
+                    <td>
+                      <label for=""
+                             i18n:translate=""
+                             tal:attributes="for iface"
+                             tal:content="name" />
+                    </td>
+                    <td tal:content="doc">
+                      doc string description
+                    </td>
+                  </tr>
+                </tal:rows>
+              </tbody>
 
-              <br />
-
-            </tal:block>
+            </table>
           </div>
 
           <div class="formControls">
@@ -143,8 +176,8 @@
           <input type="hidden" name="form.submitted" value="1" />
 
         </fieldset>
-<fieldset>
-  <legend i18n:translate="legend_marker_additional">Additional Info</legend>
+        <fieldset>
+          <legend i18n:translate="legend_marker_additional">Additional Info</legend>
           <div class="field"
                tal:condition="impl">
 
@@ -155,25 +188,40 @@
               directly or through its base classes.
             </div>
 
-            <tal:block tal:repeat="iface impl">
+            <table class="listing"
+                   tal:define="ifaces python:iface_tool.getReadableInterfaces(impl)">
+              <thead>
+                <tr>
+                  <th>Interface</th>
+                  <th>Description</th>
+                </tr>
+              </thead>
+
+              <tbody>
+                <tal:rows tal:repeat="info ifaces">
+                  <tr tal:define="oddrow repeat/info/odd;
+                                  iface info/name;
+                                  doc info/doc;"
+                      tal:attributes="class python:test(oddrow, 'even', 'odd')">
+                    <td>
+                      <label for=""
+                             i18n:translate=""
+                             tal:attributes="for iface"
+                             tal:content="iface" />
+                    </td>
+                    <td tal:content="doc">
+                      doc string description
+                    </td>
+                  </tr>
+                </tal:rows>
+              </tbody>
 
-              <label for=""
-                     i18n:translate=""
-                     tal:attributes="for iface"
-                     tal:content="iface" />
-
-              [<a href=""
-                   tal:attributes="href string:${context/absolute_url}/view_details?iface=${iface}&type=zope.publisher.interfaces.browser.IBrowserRequest">
-                  Views
-              </a>]
-
-              <br />
-
-            </tal:block>
+            </table>
           </div>
 
-</fieldset>
+        </fieldset>
+
       </form>
     </div>
   </body>
-</html>
\ No newline at end of file
+</html>

Deleted: /z3/Flon/trunk/tests/runalltests.py
==============================================================================
--- /z3/Flon/trunk/tests/runalltests.py	Thu Jul 21 20:02:07 2005
+++ (empty file)
@@ -1,27 +0,0 @@
-#
-# Runs all tests in the current directory
-#
-# Execute like:
-#   python runalltests.py
-#
-# Alternatively use the testrunner:
-#   python /path/to/Zope/utilities/testrunner.py -qa
-#
-
-import os, sys
-if __name__ == '__main__':
-    execfile(os.path.join(sys.path[0], 'framework.py'))
-
-import unittest
-suite = unittest.TestSuite()
-
-tests = os.listdir(os.curdir)
-tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
-
-for test in tests:
-    m = __import__(test)
-    if hasattr(m, 'test_suite'):
-        suite.addTest(m.test_suite())
-
-if __name__ == '__main__':
-    TestRunner().run(suite)

Modified: z3/Flon/trunk/tests/test_tool.py
==============================================================================
--- z3/Flon/trunk/tests/test_tool.py	(original)
+++ z3/Flon/trunk/tests/test_tool.py	Thu Jul 21 20:02:07 2005
@@ -33,37 +33,12 @@
 ZopeTestCase.installProduct('Flon')
 ZopeTestCase.installProduct('Five')
 
-from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
-from Products.Five.interfaces import IObjectManager
 from zope.interface import implements, Interface
 from zope.app.component.interface import provideInterface
 
-class IDummy(Interface):
-    """A dummy interface
-    """
-    def foo():
-        """ """
-
-class IAdvancedDummy(IDummy):
-    """A marker interface for advanced dummy
-    """
-
-class ISpecialDummy(IDummy):
-    """A marker interface for special dummy
-    """
-
-class IExtraSpecialDummy(ISpecialDummy):
-    """A marker interface for special dummy
-    """
-
-class INonMarkerDummy(IDummy):
-    """A non-marker interface for dummy
-    """
-    def bar():
-        """ """
-class IFolderMarker(IObjectManager):
-    """A Folder Marker"""
+from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
+from Products.Flon.tests.interfaces import *
 
 class Dummy:
     implements(IDummy)
@@ -76,47 +51,77 @@
         self.qi.installProduct('Flon')
         self.ct = getToolByName(self.portal, 'portal_catalog')
         self.it = getToolByName(self.portal, 'portal_interface')
-        provideInterface('test_tool.IAdvancedDummy', IAdvancedDummy)
-        provideInterface('test_tool.IExtraSpecialDummy', IExtraSpecialDummy)
-        provideInterface('test_tool.ISpecialDummy', ISpecialDummy)
-        provideInterface('test_tool.INonMarkerDummy', INonMarkerDummy)
-        provideInterface('test_tool.IDummy', IDummy)
-        provideInterface('test_tool.IFolderMarker', IFolderMarker)
+        provideInterface('Products.Flon.tests.interfaces.IAdvancedDummy',
+                         IAdvancedDummy)
+        provideInterface('Products.Flon.tests.interfaces.IExtraSpecialDummy',
+                         IExtraSpecialDummy)
+        provideInterface('Products.Flon.tests.interfaces.ISpecialDummy',
+                         ISpecialDummy)
+        provideInterface('Products.Flon.tests.interfaces.INonMarkerDummy',
+                         INonMarkerDummy)
+        provideInterface('Products.Flon.tests.interfaces.IDummy', IDummy)
+        provideInterface('Products.Flon.tests.interfaces.IFolderMarker',
+                         IFolderMarker)
         self.dummy = Dummy()
 
     def test_marker_names(self):
         foo = self.dummy
         iface_names = self.it.getMarkerInterfaceNames(foo)
-        self.failUnless('test_tool.IAdvancedDummy' in iface_names)
-        self.failUnless('test_tool.ISpecialDummy' in iface_names)
-        self.failUnless('test_tool.IExtraSpecialDummy' in iface_names)
-        self.failIf('test_tool.INonMarkerDummy' in iface_names)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in iface_names)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in iface_names)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.IExtraSpecialDummy' in iface_names)
+        self.failIf(
+            'Products.Flon.tests.interfaces.INonMarkerDummy' in iface_names)
+
+    def test_get_readable_names(self):
+        foo = self.dummy
+        expected = [
+            {'doc': 'A marker interface for advanced dummy',
+             'name': 'IAdvancedDummy',
+             'dotted_name': 'Products.Flon.tests.interfaces.IAdvancedDummy'}
+            ]
+        ifaces = ['Products.Flon.tests.interfaces.IAdvancedDummy']
+        self.assertEquals(self.it.getReadableInterfaces(ifaces), expected)
 
     def test_provided_names(self):
         foo = self.dummy
         provided = self.it.getDirectlyProvidedNames(foo)
-        self.failIf('test_tool.IDummy' in provided)
-        self.failIf('test_tool.ISpecialDummy' in provided)
-        self.failIf('test_tool.IAdvancedDummy' in provided)
-        self.failIf('test_tool.IExtraSpecialDummy' in provided)
+        self.failIf(
+            'Products.Flon.tests.interfaces.IDummy' in provided)
+        self.failIf(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
+        self.failIf(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
+        self.failIf(
+            'Products.Flon.tests.interfaces.IExtraSpecialDummy' in provided)
 
     def test_add_markers(self):
         foo = self.dummy
 
         provided = self.it.getDirectlyProvidedNames(foo)
-        self.failIf('test_tool.ISpecialDummy' in provided)
-        self.it.update(foo, add=['test_tool.ISpecialDummy'])
-        provided = self.it.getDirectlyProvidedNames(foo)
-        self.failUnless('test_tool.ISpecialDummy' in provided)
-
-        self.it.update(foo, add=['test_tool.IAdvancedDummy'])
-        provided = self.it.getDirectlyProvidedNames(foo)
-        self.failUnless('test_tool.IAdvancedDummy' in provided)
-        self.failUnless('test_tool.ISpecialDummy' in provided)
-
+        self.failIf(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
+        self.it.update(
+            foo, add=['Products.Flon.tests.interfaces.ISpecialDummy'])
+        provided = self.it.getDirectlyProvidedNames(foo)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
+
+        self.it.update(
+            foo, add=['Products.Flon.tests.interfaces.IAdvancedDummy'])
+        provided = self.it.getDirectlyProvidedNames(foo)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
         provided = self.it.getProvidedNames(foo)
-        self.failUnless('test_tool.IAdvancedDummy' in provided)
-        self.failUnless('test_tool.ISpecialDummy' in provided)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
 
         provided = self.it.getProvided(foo)
         self.failUnless(IAdvancedDummy in provided)
@@ -128,18 +133,22 @@
         self.it.update(foo, add=iface_names)
 
         provided = self.it.getDirectlyProvidedNames(foo)
-        self.failUnless('test_tool.ISpecialDummy' in provided)
-        self.it.update(foo, remove=['test_tool.ISpecialDummy'])
+        self.failUnless(
+            'Products.Flon.tests.interfaces.ISpecialDummy' in provided)
+        self.it.update(
+            foo, remove=['Products.Flon.tests.interfaces.ISpecialDummy'])
+        provided = self.it.getDirectlyProvidedNames(foo)
+        self.failIf('Products.Flon.tests.interfaces.ISpecialDummy' in provided)
+        self.failUnless(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
+        self.it.update(
+            foo, remove=['Products.Flon.tests.interfaces.IAdvancedDummy'])
         provided = self.it.getDirectlyProvidedNames(foo)
-        self.failIf('test_tool.ISpecialDummy' in provided)
-
-        self.failUnless('test_tool.IAdvancedDummy' in provided)
-        self.it.update(foo, remove=['test_tool.IAdvancedDummy'])
-        provided = self.it.getDirectlyProvidedNames(foo)
-        self.failIf('test_tool.IAdvancedDummy' in provided)
-
+        self.failIf(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
         provided = self.it.getProvidedNames(foo)
-        self.failIf('test_tool.IAdvancedDummy' in provided)
+        self.failIf(
+            'Products.Flon.tests.interfaces.IAdvancedDummy' in provided)
 
         provided = self.it.getProvided(foo)
         self.failIf(IAdvancedDummy in provided)
@@ -149,11 +158,12 @@
         addPloneFolder(self.portal, 'dummy')
         foo = self.portal.dummy
         ct = self.ct._catalog
-        provided = 'test_tool.IFolderMarker'
+        provided = 'Products.Flon.tests.interfaces.IFolderMarker'
         self.assertEquals(len(ct(directly_provided=[provided])), 0)
         self.it.update(foo, add=[provided])
 
         # Test for directly_provided index
+        # XXX Currently failing, might be a bug in ProxyIndex?
         res = ct(directly_provided=[provided])
         self.assertEquals(len(res), 1)
         self.assertEquals(res[0]['directly_provided'], [provided])

Modified: z3/Flon/trunk/tests/test_views.py
==============================================================================
--- z3/Flon/trunk/tests/test_views.py	(original)
+++ z3/Flon/trunk/tests/test_views.py	Thu Jul 21 20:02:07 2005
@@ -36,7 +36,7 @@
 from Products.CMFCore.utils import getToolByName
 from Products.CMFPlone.tests.testContentTypeScripts import TestDefaultPage
 from Products.Five.traversable import FakeRequest
-from Products.Five.api import BrowserView
+from Products.Five import BrowserView
 from zope.interface import implements, Interface, directlyProvides
 from zope.app.component.interface import provideInterface
 from zope.interface import Interface
@@ -92,9 +92,15 @@
         [v.sort() for k, v in skins.items()]
         layers = lambda s: [l.name for l in s]
         self.assertEquals(layers(skins['skinA']), ['default'])
-        self.assertEquals(layers(skins['skinB']), ['layer5', 'layer4', 'default'])
-        self.assertEquals(layers(skins['skinC']), ['layer4', 'layer2',
-                                                   'layer1', 'default'])
+        l = layers(skins['skinB'])
+        l.sort()
+        l.reverse()
+        self.assertEquals(l, ['layer5', 'layer4', 'default'])
+        l = layers(skins['skinC'])
+        l.sort()
+        l.reverse()
+        self.assertEquals(l, ['layer4', 'layer2',
+                              'layer1', 'default'])
         # Test view details
         request = self.it.REQUEST
         request['iface'] = 'IFoo'
@@ -106,7 +112,7 @@
         info = dict(view)
         self.assertEquals(info['name'], 'index.html')
         finfo = dict(info['factory'])
-        self.assertEquals(finfo['path'], 'test_views.FooView')
+        self.failUnless(finfo['path'].endswith('test_views.FooView'))
         self.assertEquals(finfo['template'], None)
 
 class TestDefaultView(TestDefaultPage):

Deleted: /z3/Flon/trunk/tests/zopeconf.py
==============================================================================
--- /z3/Flon/trunk/tests/zopeconf.py	Thu Jul 21 20:02:07 2005
+++ (empty file)
@@ -1,23 +0,0 @@
-import os
-from os.path import join, abspath, dirname, split
-
-
-def process():
-    """Read in zope.conf configuration file.
-
-    This is a hack but there doesn't seem to be a better way.
-    """
-    _prefix = os.environ.get('INSTANCE_HOME')
-    if not _prefix:
-        try:
-            __file__
-        except NameError:
-            # Test was called directly, so no __file__ global exists.
-            _prefix = abspath(os.curdir)
-        else:
-            # Test was called by another test.
-            _prefix = abspath(dirname(__file__))
-        _prefix = join(_prefix, '..', '..', '..')
-
-    from Zope.Startup.run import configure
-    configure(join(_prefix, 'etc', 'zope.conf'))

Modified: z3/Flon/trunk/tools/interface.py
==============================================================================
--- z3/Flon/trunk/tools/interface.py	(original)
+++ z3/Flon/trunk/tools/interface.py	Thu Jul 21 20:02:07 2005
@@ -19,14 +19,16 @@
 $Id: __init__.py,v 1.2 2004/07/14 22:23:16 dreamcatcher Exp $
 """
 
-from Products.CMFPlone.InterfaceTool import InterfaceTool as BaseTool
-from Products.Flon.interfaces import IInterfaceTool, ICMFCatalogAware
 from zope.interface import directlyProvides, directlyProvidedBy, implements
 from zope.interface import providedBy
 from zope.app.introspector.interfaces import IIntrospector
 from zope.app.component.interface import getInterface
 from zope.app.apidoc.viewmodule import ViewModule
 
+from Acquisition import aq_base
+from Products.CMFPlone.InterfaceTool import InterfaceTool as BaseTool
+from Products.Flon.interfaces import IInterfaceTool, ICMFCatalogAware
+
 class InterfaceTool(BaseTool):
     """An improved interface tool, with support for
     introspecting both Zope2 and Zope3 interfaces.
@@ -78,5 +80,31 @@
                     directlyProvides(ob, directlyProvidedBy(ob)-interface)
         if ICMFCatalogAware.providedBy(ob):
             ob.reindexObject(idxs=['directly_provided', 'provided'])
+        # If the object is having it's interfaces changed, then its
+        # modification date should be changed as well
+        if hasattr(aq_base(ob), 'notifyModified'):
+            ob.notifyModified()
+        if hasattr(aq_base(ob), 'reindexObject'):
+            ob.reindexObject(idxs=['modified'])
 
     getSkins = ViewModule.getSkins.im_func
+
+    def getReadableInterfaces(self, ifaces):
+        """
+        Return marker interface names and descriptions as a list of
+        names and descriptions.
+        """
+        readable = []
+        request = self.REQUEST
+        for name in ifaces:
+            parts = name.split('.')
+            k_name = parts[-1]
+            try:
+                klass = getInterface(self, name)
+            except:
+                continue
+            readable.append(
+                {'name': k_name,
+                 'doc':klass.getDoc().strip(),
+                 'dotted_name':name})
+        return readable


More information about the z3-checkins mailing list