[Checkins] SVN: z3ext.layout/trunk/src/z3ext/layout/ tests updated
Nikolay Kim
fafhrd at datacom.kz
Wed Apr 23 12:31:31 EDT 2008
Log message for revision 85656:
tests updated
Changed:
U z3ext.layout/trunk/src/z3ext/layout/README.txt
U z3ext.layout/trunk/src/z3ext/layout/pagelet.txt
U z3ext.layout/trunk/src/z3ext/layout/zcml.py
-=-
Modified: z3ext.layout/trunk/src/z3ext/layout/README.txt
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/README.txt 2008-04-23 15:49:06 UTC (rev 85655)
+++ z3ext.layout/trunk/src/z3ext/layout/README.txt 2008-04-23 16:31:29 UTC (rev 85656)
@@ -321,3 +321,74 @@
</body>
</html>
<BLANKLINE>
+
+Just tests
+
+We should provide template
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... layout="."
+ ... template="unknown.pt" />
+ ... </configure>""", context)
+ Traceback (most recent call last):
+ ...
+ ZopeXMLConfigurationError: ...
+ ... ConfigurationError: ('No such file', ...unknown.pt')
+
+We can register layout for context or for view
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... layout="."
+ ... template="%s" />
+ ... </configure>"""%layoutcontent1_1_1, context)
+ Traceback (most recent call last):
+ ...
+ ZopeXMLConfigurationError: ...
+ ... ConfigurationError: FOR or VIEW are required.
+
+We can register layout for view
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... layout="."
+ ... view="z3ext.layout.tests.IFolder1_1_1"
+ ... template="%s" />
+ ... </configure>"""%layoutcontent1_1_1, context)
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... name="layout1"
+ ... layout="."
+ ... view="z3ext.layout.tests.IFolder1_1_1"
+ ... template="%s" />
+ ... </configure>"""%layoutcontent1_1_1, context)
+
+We can add custom marker interface for layout
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... name="layout2"
+ ... layout="."
+ ... view="z3ext.layout.tests.IFolder1_1_1"
+ ... provides="z3ext.layout.tests.IFolder1"
+ ... template="%s" />
+ ... </configure>"""%layoutcontent1_1_1, context)
+
+We can use custom layout class
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:z3ext="http://namespaces.zope.org/z3ext">
+ ... <z3ext:layout
+ ... name="layout3"
+ ... layout="."
+ ... view="z3ext.layout.tests.IFolder1_1_1"
+ ... class="z3ext.layout.tests.MyLayout"
+ ... template="%s" />
+ ... </configure>"""%layoutcontent1_1_1, context)
Modified: z3ext.layout/trunk/src/z3ext/layout/pagelet.txt
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/pagelet.txt 2008-04-23 15:49:06 UTC (rev 85655)
+++ z3ext.layout/trunk/src/z3ext/layout/pagelet.txt 2008-04-23 16:31:29 UTC (rev 85656)
@@ -216,7 +216,7 @@
>>> print pagelet.render()
<div>My pagelet</div>
<BLANKLINE>
-
+
Now we need to clean up the custom module.
>>> del sys.modules['custom']
Modified: z3ext.layout/trunk/src/z3ext/layout/zcml.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/zcml.py 2008-04-23 15:49:06 UTC (rev 85655)
+++ z3ext.layout/trunk/src/z3ext/layout/zcml.py 2008-04-23 16:31:29 UTC (rev 85656)
@@ -158,9 +158,6 @@
contentType='text/html', class_ = None, layout = '',
title='', description='', **kwargs):
- if for_ is interface.Interface:
- raise ConfigurationError('for should be valid interface or object')
-
if not layout:
layout = None
elif layout == '.':
More information about the Checkins
mailing list