[Checkins] SVN: zc.catalog/trunk/src/zc/catalog/ - add minimal
(equivalent to zope.app.catalog indexes) TTW UI for zc.catalog
Benji York
benji at zope.com
Wed Sep 20 14:18:27 EDT 2006
Log message for revision 70258:
- add minimal (equivalent to zope.app.catalog indexes) TTW UI for zc.catalog
indexes
- test the TTW UI
- minor whitespace tweaks
Changed:
A zc.catalog/trunk/src/zc/catalog/browser/
A zc.catalog/trunk/src/zc/catalog/browser/README.txt
A zc.catalog/trunk/src/zc/catalog/browser/__init__.py
A zc.catalog/trunk/src/zc/catalog/browser/configure.zcml
A zc.catalog/trunk/src/zc/catalog/browser/ftests.py
U zc.catalog/trunk/src/zc/catalog/configure.zcml
-=-
Added: zc.catalog/trunk/src/zc/catalog/browser/README.txt
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/README.txt 2006-09-20 18:14:32 UTC (rev 70257)
+++ zc.catalog/trunk/src/zc/catalog/browser/README.txt 2006-09-20 18:18:27 UTC (rev 70258)
@@ -0,0 +1,88 @@
+zc.catalog
+==========
+
+The zc.catalog.browser package adds simple TTW addition/inspection for SetIndex
+and ValueIndex.
+
+First, we need a browser so we can test the web UI.
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> browser = Browser()
+ >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+ >>> browser.addHeader('Accept-Language', 'en-US')
+ >>> browser.open('http://localhost')
+
+Now we need to add the catalog that these indexes are going to reside within.
+
+ >>> browser.open('/++etc++site/default/@@contents.html')
+ >>> browser.getLink('Add').click()
+ >>> browser.getControl('Catalog').click()
+ >>> browser.getControl(name='id').value = 'catalog'
+ >>> browser.getControl('Add').click()
+
+
+SetIndex
+--------
+
+Add the SetIndex to the catalog.
+
+ >>> browser.getLink('Add').click()
+ >>> browser.getControl('Set Index').click()
+ >>> browser.getControl(name='id').value = 'set_index'
+ >>> browser.getControl('Add').click()
+
+The add form needs values for what interface to adapt candidate objects to, and
+what field name to use, and whether-or-not that field is a callable. (We'll use
+a simple interfaces for demonstration purposes, it's not really significant.)
+
+ >>> browser.getControl('Interface', index=0).displayValue = [
+ ... 'zope.size.interfaces.ISized']
+ >>> browser.getControl('Field Name').value = 'sizeForSorting'
+ >>> browser.getControl('Field Callable').click()
+ >>> browser.getControl(name='add_input_name').value = 'set_index'
+ >>> browser.getControl('Add').click()
+
+Now we can look at the index and see how is is configured.
+
+ >>> browser.getLink('set_index').click()
+ >>> print browser.contents
+ <...
+ ...Interface...zope.size.interfaces.ISized...
+ ...Field Name...sizeForSorting...
+ ...Field Callable...True...
+
+We need to go back to the catalog so we can add a different index.
+
+ >>> browser.goBack()
+
+
+ValueIndex
+----------
+
+Add the ValueIndex to the catalog.
+
+ >>> browser.getLink('Add').click()
+ >>> browser.getControl('Value Index').click()
+ >>> browser.getControl(name='id').value = 'value_index'
+ >>> browser.getControl('Add').click()
+
+The add form needs values for what interface to adapt candidate objects to, and
+what field name to use, and whether-or-not that field is a callable. (We'll use
+a simple interfaces for demonstration purposes, it's not really significant.)
+
+ >>> browser.getControl('Interface', index=0).displayValue = [
+ ... 'zope.size.interfaces.ISized']
+ >>> browser.getControl('Field Name').value = 'sizeForSorting'
+ >>> browser.getControl('Field Callable').click()
+ >>> browser.getControl(name='add_input_name').value = 'value_index'
+ >>> browser.getControl('Add').click()
+
+Now we can look at the index and see how is is configured.
+
+ >>> browser.getLink('value_index').click()
+ >>> print browser.contents
+ <...
+ ...Interface...zope.size.interfaces.ISized...
+ ...Field Name...sizeForSorting...
+ ...Field Callable...True...
+
Property changes on: zc.catalog/trunk/src/zc/catalog/browser/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: zc.catalog/trunk/src/zc/catalog/browser/__init__.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/__init__.py 2006-09-20 18:14:32 UTC (rev 70257)
+++ zc.catalog/trunk/src/zc/catalog/browser/__init__.py 2006-09-20 18:18:27 UTC (rev 70258)
@@ -0,0 +1 @@
+#
Property changes on: zc.catalog/trunk/src/zc/catalog/browser/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zc.catalog/trunk/src/zc/catalog/browser/configure.zcml
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/configure.zcml 2006-09-20 18:14:32 UTC (rev 70257)
+++ zc.catalog/trunk/src/zc/catalog/browser/configure.zcml 2006-09-20 18:18:27 UTC (rev 70258)
@@ -0,0 +1,65 @@
+<zope:configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ >
+
+<!-- UI for SetIndex -->
+
+<addform
+ name="AddSetIndex"
+ label="Add a set index"
+ schema="zope.app.catalog.interfaces.IAttributeIndex"
+ permission="zope.ManageServices"
+ content_factory="..catalogindex.SetIndex"
+ arguments="field_name"
+ keyword_arguments="interface field_callable"
+ />
+
+<addMenuItem
+ title="Set Index"
+ description="Index items based on a set of values"
+ class="..catalogindex.SetIndex"
+ permission="zope.ManageServices"
+ view="AddSetIndex"
+ />
+
+<schemadisplay
+ name="index.html"
+ schema="..interfaces.ICatalogSetIndex"
+ label="Set Index"
+ fields="interface field_name field_callable"
+ permission="zope.ManageServices"
+ menu="zmi_views" title="Configuration"
+ />
+
+<!-- UI for ValueIndex -->
+
+<addform
+ name="AddValueIndex"
+ label="Add a set index"
+ schema="zope.app.catalog.interfaces.IAttributeIndex"
+ permission="zope.ManageServices"
+ content_factory="..catalogindex.ValueIndex"
+ arguments="field_name"
+ keyword_arguments="interface field_callable"
+ />
+
+<addMenuItem
+ title="Value Index"
+ description="Index items based on a set of values"
+ class="..catalogindex.ValueIndex"
+ permission="zope.ManageServices"
+ view="AddValueIndex"
+ />
+
+<schemadisplay
+ name="index.html"
+ schema="..interfaces.ICatalogValueIndex"
+ label="Value Index"
+ fields="interface field_name field_callable"
+ permission="zope.ManageServices"
+ menu="zmi_views" title="Configuration"
+ />
+
+</zope:configure>
Property changes on: zc.catalog/trunk/src/zc/catalog/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: zc.catalog/trunk/src/zc/catalog/browser/ftests.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/browser/ftests.py 2006-09-20 18:14:32 UTC (rev 70257)
+++ zc.catalog/trunk/src/zc/catalog/browser/ftests.py 2006-09-20 18:18:27 UTC (rev 70258)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation 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.
+#
+##############################################################################
+"""Functional tests for xmlrpc
+
+$Id$
+"""
+from zope.app.testing.functional import FunctionalDocFileSuite
+from zope.testing import doctest
+
+def test_suite():
+ return FunctionalDocFileSuite('README.txt',
+ optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE)
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main(defaultTest='test_suite')
Property changes on: zc.catalog/trunk/src/zc/catalog/browser/ftests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: zc.catalog/trunk/src/zc/catalog/configure.zcml
===================================================================
--- zc.catalog/trunk/src/zc/catalog/configure.zcml 2006-09-20 18:14:32 UTC (rev 70257)
+++ zc.catalog/trunk/src/zc/catalog/configure.zcml 2006-09-20 18:18:27 UTC (rev 70258)
@@ -68,4 +68,6 @@
/>
</class>
+ <include package=".browser" />
+
</configure>
More information about the Checkins
mailing list