[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/ Backported
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 12 12:43:14 EDT 2004
Log message for revision 27062:
Backported
r26510 | srichter | 2004-07-13 17:49:44 -0400 (Tue, 13 Jul 2004) | 4 lines
r26511 | srichter | 2004-07-13 18:25:30 -0400 (Tue, 13 Jul 2004) | 2 lines
r26512 | srichter | 2004-07-13 18:27:31 -0400 (Tue, 13 Jul 2004) | 5 lines
r26513 | srichter | 2004-07-13 19:23:17 -0400 (Tue, 13 Jul 2004) | 2 lines
r26514 | srichter | 2004-07-13 19:25:04 -0400 (Tue, 13 Jul 2004) | 3 lines
r26515 | srichter | 2004-07-13 19:47:28 -0400 (Tue, 13 Jul 2004) | 2 lines
r26516 | srichter | 2004-07-13 19:48:45 -0400 (Tue, 13 Jul 2004) | 5 lines
r26518 | srichter | 2004-07-13 20:25:17 -0400 (Tue, 13 Jul 2004) | 3 lines
Changed:
U Zope3/branches/ZopeX3-3.0/src/zope/app/component/configure.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/component/hooks.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/meta.zcml
U Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py
U Zope3/branches/ZopeX3-3.0/src/zope/app/tests/setup.py
U Zope3/branches/ZopeX3-3.0/src/zope/component/__init__.py
U Zope3/branches/ZopeX3-3.0/src/zope/component/interfaces.py
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/backward.py
U Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/meta.zcml
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/metaconfigure.py
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backward.zcml
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkw.zcml
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkwextra.zcml
D Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/test_backward.py
-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/component/configure.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/component/configure.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/component/configure.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -32,21 +32,6 @@
factory="zope.app.utility.vocabulary.UtilityVocabulary"
interface="zope.interface.interfaces.IInterface" />
- <hook
- module="zope.component"
- name="getServices"
- implementation="zope.app.component.hooks.getServices_hook" />
-
- <hook
- module="zope.component"
- name="adapter_hook"
- implementation="zope.app.component.hooks.adapter_hook" />
-
- <hook
- module="zope.component"
- name="queryView"
- implementation="zope.app.component.hooks.queryView" />
-
<interface interface="zope.interface.Interface" />
<adapter
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/component/hooks.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/component/hooks.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/component/hooks.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -15,6 +15,7 @@
$Id$
"""
+import zope.component
from zope.component import getService
from zope.component.interfaces import IServiceService
from zope.app.site.interfaces import ISite
@@ -86,11 +87,18 @@
except ComponentLookupError:
return serviceManager
+# Hook up a new implementation of looking up services.
+zope.component.getServices.sethook(getServices_hook)
+
def adapter_hook(interface, object, name='', default=None):
try:
return siteinfo.adapter_hook(interface, object, name, default)
except ComponentLookupError:
return default
+
+# Hook up a new implementation of looking up adapters.
+zope.component.adapter_hook.sethook(adapter_hook)
+
def queryView(object, name, request, default=None,
providing=Interface, context=None):
@@ -101,3 +109,6 @@
locate(view, object, name)
return view
+
+# Hook up a new implementation of looking up views.
+zope.component.queryView.sethook(queryView)
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/component/tests/test_servicedirective.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -60,13 +60,12 @@
UndefinedService,
xmlconfig,
StringIO(template % (
- """
+ '''
<service
- serviceType="Foo"
- component="
- zope.app.component.tests.service.fooService"
- />
- """
+ serviceType="Foo"
+ component="zope.app.component.tests.service.fooService"
+ />
+ '''
)))
def testDuplicateServiceConfig(self):
@@ -74,39 +73,36 @@
ConfigurationConflictError,
xmlconfig,
StringIO(template % (
- """
- <serviceType id="Foo"
- interface="
- zope.app.component.tests.service.IFooService"
- />
+ '''
+ <serviceType
+ id="Foo"
+ interface="zope.app.component.tests.service.IFooService"
+ />
<service
serviceType="Foo"
- component="
- zope.app.component.tests.service.fooService"
+ component="zope.app.component.tests.service.fooService"
/>
<service
serviceType="Foo"
- component="
- zope.app.component.tests.service.foo2"
+ component="zope.app.component.tests.service.foo2"
/>
- """
+ '''
)))
def testServiceConfig(self):
self.assertRaises(ComponentLookupError, getService, "Foo")
xmlconfig(StringIO(template % (
- """
- <serviceType id="Foo"
- interface="
- zope.app.component.tests.service.IFooService"
- />
+ '''
+ <serviceType
+ id="Foo"
+ interface="zope.app.component.tests.service.IFooService"
+ />
<service
- serviceType="Foo"
- component="
- zope.app.component.tests.service.fooService"
- />
- """
+ serviceType="Foo"
+ component="zope.app.component.tests.service.fooService"
+ />
+ '''
)))
service = getService("Foo")
@@ -118,17 +114,16 @@
self.assertRaises(ComponentLookupError, getService, "Foo")
xmlconfig(StringIO(template % (
- """
- <serviceType id="Foo"
- interface="
- zope.app.component.tests.service.IFooService"
- />
+ '''
+ <serviceType
+ id="Foo"
+ interface="zope.app.component.tests.service.IFooService"
+ />
<service
- serviceType="Foo"
- factory="
- zope.app.component.tests.service.FooService"
- />
- """
+ serviceType="Foo"
+ factory="zope.app.component.tests.service.FooService"
+ />
+ '''
)))
service = getService("Foo")
@@ -140,18 +135,17 @@
self.assertRaises(ComponentLookupError, getService, "Foo")
xmlconfig(StringIO(template % (
- """
- <serviceType id="Foo"
- interface="
- zope.app.component.tests.service.IFooService"
- />
+ '''
+ <serviceType
+ id="Foo"
+ interface="zope.app.component.tests.service.IFooService"
+ />
<service
- serviceType="Foo"
- component="
- zope.app.component.tests.service.fooService"
- permission="zope.Public"
- />
- """
+ serviceType="Foo"
+ component="zope.app.component.tests.service.fooService"
+ permission="zope.Public"
+ />
+ '''
)))
service = getService("Foo")
@@ -164,30 +158,23 @@
self.assertRaises(ComponentLookupError, getService, "Foo")
xmlconfig(StringIO(template % (
- """
- <directives namespace="http://namespaces.zope.org/zope">
- <directive name="permission"
- attributes="id title description"
- handler="
- zope.app.security.metaconfigure.definePermission" />
- </directives>
+ '''
+ <include package="zope.app.security" file="meta.zcml" />
<permission id="zope.TestPermission" title="Test permission" />
- <serviceType id="Foo"
- interface="
- zope.app.component.tests.service.IFooService"
- />
+ <serviceType
+ id="Foo"
+ interface="zope.app.component.tests.service.IFooService"
+ />
<service
- serviceType="Foo"
- component="
- zope.app.component.tests.service.fooService"
- permission="zope.TestPermission"
- />
- """
+ serviceType="Foo"
+ component="zope.app.component.tests.service.fooService"
+ permission="zope.TestPermission"
+ />
+ '''
)))
-
# Need to "log someone in" to turn on checks
from zope.security.management import newInteraction, endInteraction
endInteraction()
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/meta.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/meta.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/meta.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -2,7 +2,6 @@
<!-- Standard configuration directives -->
<include package="zope.modulealias" file="meta.zcml" />
-<include package="zope.configuration" file="meta.zcml" />
<include package="zope.app.component" file="meta.zcml" />
<include package="zope.app.publisher" file="meta.zcml" />
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/tests/test_directives.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -15,7 +15,6 @@
$Id$
"""
-
import os
import unittest
from cStringIO import StringIO
@@ -111,14 +110,15 @@
None)
xmlconfig(StringIO(template % (
- """
- <browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- />
- """
+ '''
+ <browser:page
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ />
+ '''
)))
v = queryView(ob, 'test', request)
@@ -131,17 +131,19 @@
xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu" />
- <browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- menu="test_menu"
- title="Test View"
- />
- """ % testtemplate
+ '''
+ <browser:menu
+ id="test_menu" title="Test menu" />
+ <browser:page
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ template="%s"
+ menu="test_menu"
+ title="Test View"
+ />
+ ''' % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -158,16 +160,18 @@
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu"/>
- <browser:page name="test"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- menu="test_menu"
- title="Test View"
- />
- """ % testtemplate
+ '''
+ <browser:menu
+ id="test_menu" title="Test menu"/>
+ <browser:page
+ name="test"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ template="%s"
+ menu="test_menu"
+ title="Test View"
+ />
+ ''' % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -184,17 +188,20 @@
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu" />
- <browser:pages for="zope.app.component.tests.views.IC"
- permission="zope.Public">
- <browser:page name="test"
- template="%s"
- menu="test_menu"
- title="Test View"
- />
+ '''
+ <browser:menu
+ id="test_menu" title="Test menu" />
+ <browser:pages
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public">
+ <browser:page
+ name="test"
+ template="%s"
+ menu="test_menu"
+ title="Test View"
+ />
</browser:pages>
- """ % testtemplate
+ ''' % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -212,18 +219,21 @@
xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu" />
- <browser:pages for="zope.app.component.tests.views.IC"
- class="zope.app.component.tests.views.V1"
- permission="zope.Public">
- <browser:page name="test"
- template="%s"
- menu="test_menu"
- title="Test View"
- />
+ '''
+ <browser:menu
+ id="test_menu" title="Test menu" />
+ <browser:pages
+ for="zope.app.component.tests.views.IC"
+ class="zope.app.component.tests.views.V1"
+ permission="zope.Public">
+ <browser:page
+ name="test"
+ template="%s"
+ menu="test_menu"
+ title="Test View"
+ />
</browser:pages>
- """ % testtemplate
+ ''' % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -238,10 +248,11 @@
None), None)
xmlconfig(StringIO(template % (
- """
- <browser:defaultView name="test"
- for="zope.app.component.tests.views.IC" />
- """
+ '''
+ <browser:defaultView
+ name="test"
+ for="zope.app.component.tests.views.IC" />
+ '''
)))
self.assertEqual(getDefaultViewName(ob, request
@@ -256,12 +267,12 @@
<browser:layer name="zmi" />
<browser:skin name="zmi" layers="zmi default" />
<browser:resource
- name="test"
- factory="zope.app.component.tests.views.RZMI"
- layer="zmi" />
+ name="test"
+ factory="zope.app.component.tests.views.RZMI"
+ layer="zmi" />
<browser:resource
- name="test"
- factory="zope.app.component.tests.views.R1" />
+ name="test"
+ factory="zope.app.component.tests.views.R1" />
'''
)))
@@ -279,18 +290,18 @@
<browser:skin name="zmi" layers="zmi default" />
<browser:defaultSkin name="zmi" />
<browser:page name="test"
- class="zope.app.component.tests.views.VZMI"
- layer="zmi"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- />
+ class="zope.app.component.tests.views.VZMI"
+ layer="zmi"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ />
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- />
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ />
'''
)))
v = queryView(ob, 'test', TestRequest(skin=''))
@@ -300,23 +311,23 @@
self.assertEqual(queryView(ob, 'test', request, None), None)
xmlconfig(StringIO(template % (
- """
+ '''
<browser:layer name="zmi" />
<browser:skin name="zmi" layers="zmi default" />
<browser:page name="test"
- class="zope.app.component.tests.views.VZMI"
- layer="zmi"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- />
+ class="zope.app.component.tests.views.VZMI"
+ layer="zmi"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ />
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ />
+ '''
)))
v = queryView(ob, 'test', request)
@@ -331,12 +342,12 @@
path2 = os.path.join(tests_path, 'testfiles', 'test2.pt')
xmlconfig(StringIO(template % (
- """
+ '''
<browser:i18n-resource name="test" defaultLanguage="fr">
<browser:translation language="en" file="%s" />
<browser:translation language="fr" file="%s" />
</browser:i18n-resource>
- """ % (path1, path2)
+ ''' % (path1, path2)
)))
v = getResource('test', request)
@@ -348,37 +359,37 @@
# translation must be provided for the default language
config = StringIO(template % (
- """
+ '''
<browser:i18n-resource name="test" defaultLanguage="fr">
<browser:translation language="en" file="%s" />
<browser:translation language="lt" file="%s" />
</browser:i18n-resource>
- """ % (path1, path2)
+ ''' % (path1, path2)
))
self.assertRaises(ConfigurationError, xmlconfig, config)
# files and images can't be mixed
config = StringIO(template % (
- """
+ '''
<browser:i18n-resource name="test" defaultLanguage="fr">
<browser:translation language="en" file="%s" />
<browser:translation language="fr" image="%s" />
</browser:i18n-resource>
- """ % (path1, path2)
+ ''' % (path1, path2)
))
self.assertRaises(ConfigurationError, xmlconfig, config)
def testInterfaceProtectedPage(self):
xmlconfig(StringIO(template %
- """
+ '''
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- attribute="index"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- allowed_interface="zope.app.component.tests.views.IV"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ attribute="index"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ allowed_interface="zope.app.component.tests.views.IV"
+ />
+ '''
))
v = getView(ob, 'test', request)
@@ -388,15 +399,15 @@
def testAttributeProtectedPage(self):
xmlconfig(StringIO(template %
- """
+ '''
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- attribute="action"
- permission="zope.Public"
- allowed_attributes="action"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ attribute="action"
+ permission="zope.Public"
+ allowed_attributes="action"
+ />
+ '''
))
v = getView(ob, 'test', request)
@@ -406,16 +417,16 @@
def testInterfaceAndAttributeProtectedPage(self):
xmlconfig(StringIO(template %
- """
+ '''
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- attribute="index"
- allowed_attributes="action"
- allowed_interface="zope.app.component.tests.views.IV"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ attribute="index"
+ allowed_attributes="action"
+ allowed_interface="zope.app.component.tests.views.IV"
+ />
+ '''
))
v = getView(ob, 'test', request)
@@ -424,16 +435,16 @@
def testDuplicatedInterfaceAndAttributeProtectedPage(self):
xmlconfig(StringIO(template %
- """
+ '''
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- attribute="index"
- permission="zope.Public"
- allowed_attributes="action index"
- allowed_interface="zope.app.component.tests.views.IV"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ attribute="index"
+ permission="zope.Public"
+ allowed_attributes="action index"
+ allowed_interface="zope.app.component.tests.views.IV"
+ />
+ '''
))
v = getView(ob, 'test', request)
@@ -442,16 +453,16 @@
def test_class_w_implements(self):
xmlconfig(StringIO(template %
- """
+ '''
<browser:page
- name="test"
- class="
+ name="test"
+ class="
zope.app.publisher.browser.tests.test_directives.C_w_implements"
- for="zope.app.component.tests.views.IC"
- attribute="index"
- permission="zope.Public"
- />
- """
+ for="zope.app.component.tests.views.IC"
+ attribute="index"
+ permission="zope.Public"
+ />
+ '''
))
v = getView(ob, 'test', request)
@@ -463,14 +474,14 @@
ConfigurationError,
xmlconfig,
StringIO(template %
- """
+ '''
<browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- attribute="index"
- allowed_attributes="action index"
- />
- """
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ attribute="index"
+ allowed_attributes="action index"
+ />
+ '''
))
@@ -479,18 +490,18 @@
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
- """
+ '''
<browser:pages
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:pages>
- """ % test3
+ ''' % test3
))
v = getView(ob, 'index.html', request)
@@ -504,18 +515,18 @@
self.assertEqual(queryView(ob, 'test', request), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.publisher.browser.tests.test_directives.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
+ name="test"
+ class="zope.app.publisher.browser.tests.test_directives.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
</browser:view>
- """
+ '''
))
view = getView(ob, 'test', request)
@@ -535,14 +546,14 @@
self.assertEqual(queryView(ob, 'test', request), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.publisher.browser.tests.test_directives.CV"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- />
- """
+ name="test"
+ class="zope.app.publisher.browser.tests.test_directives.CV"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ />
+ '''
))
view = getView(ob, 'test', request)
@@ -553,14 +564,14 @@
self.assertEqual(queryView(ob, 'test', request), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.publisher.browser.tests.test_directives.NCV"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- />
- """
+ name="test"
+ class="zope.app.publisher.browser.tests.test_directives.NCV"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ />
+ '''
))
view = getView(ob, 'test', request)
@@ -572,19 +583,19 @@
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:view>
- """ % test3
+ ''' % test3
))
view = getView(ob, 'test', request)
@@ -607,20 +618,20 @@
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
-
- <browser:defaultPage name="test.html" />
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
+
+ <browser:defaultPage name="test.html" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:view>
- """ % test3
+ ''' % test3
))
view = getView(ob, 'test', request)
@@ -642,18 +653,18 @@
"""Tests proper traversal of a page defined for a view."""
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public" />
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public" />
<browser:page name="index.html"
for="zope.app.component.tests.views.IV"
class="zope.app.publisher.browser.tests.test_directives.CV"
permission="zope.Public" />
- """
+ '''
))
view = getView(ob, 'test', request)
@@ -669,18 +680,18 @@
case.
"""
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
- name="test"
- class="zope.app.publisher.browser.tests.test_directives.VT"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public" />
+ name="test"
+ class="zope.app.publisher.browser.tests.test_directives.VT"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public" />
<browser:page name="index.html"
for="zope.app.component.tests.views.IV"
class="zope.app.publisher.browser.tests.test_directives.CV"
permission="zope.Public" />
- """
+ '''
))
view = getView(ob, 'test', request)
@@ -695,26 +706,21 @@
None)
xmlconfig(StringIO(template %
- """
- <directives namespace="http://namespaces.zope.org/zope">
- <directive name="permission"
- attributes="id title description"
- handler="
- zope.app.security.metaconfigure.definePermission" />
- </directives>
-
+ '''
+ <include package="zope.app.security" file="meta.zcml" />
+
<permission id="zope.TestPermission" title="Test permission" />
<browser:pages
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.TestPermission"
- >
-
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.TestPermission"
+ >
+
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
</browser:pages>
- """
+ '''
))
v = getView(ob, 'index.html', request)
@@ -730,27 +736,22 @@
None)
xmlconfig(StringIO(template %
- """
- <directives namespace="http://namespaces.zope.org/zope">
- <directive name="permission"
- attributes="id title description"
- handler="
- zope.app.security.metaconfigure.definePermission" />
- </directives>
+ '''
+ <include package="zope.app.security" file="meta.zcml" />
<permission id="zope.TestPermission" title="Test permission" />
<browser:view
- name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
-
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
+ name="test"
+ class="zope.app.component.tests.views.V1"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
+
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
</browser:view>
- """
+ '''
))
view = getView(ob, 'test', request)
@@ -763,27 +764,27 @@
self.assertEqual(queryView(ob, 'test', request), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:layer name="layer" />
<browser:skin name="skinny" layers="layer default" />
<browser:pages
- for="*"
- class="zope.app.component.tests.views.V1"
- permission="zope.Public"
- >
-
- <browser:page name="index.html" attribute="index" />
+ for="*"
+ class="zope.app.component.tests.views.V1"
+ permission="zope.Public"
+ >
+
+ <browser:page name="index.html" attribute="index" />
</browser:pages>
<browser:pages
- for="*"
- class="zope.app.component.tests.views.V1"
- layer="layer"
- permission="zope.Public"
- >
-
- <browser:page name="index.html" attribute="action" />
+ for="*"
+ class="zope.app.component.tests.views.V1"
+ layer="layer"
+ permission="zope.Public"
+ >
+
+ <browser:page name="index.html" attribute="action" />
</browser:pages>
- """
+ '''
))
v = getView(ob, 'index.html', request)
@@ -797,12 +798,12 @@
self.assertEqual(queryResource('test', request), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:resource
- name="index.html"
- file="%s"
- />
- """ % path
+ name="index.html"
+ file="%s"
+ />
+ ''' % path
))
r = ProxyFactory(getResource('index.html', request))
@@ -827,12 +828,12 @@
path = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
- """
+ '''
<browser:layer name="zmi" />
<browser:skin name="zmi" layers="zmi default" />
<browser:resource name="test" file="%s"
layer="zmi" />
- """ % path
+ ''' % path
)))
self.assertEqual(queryResource('test', request), None)
@@ -848,13 +849,13 @@
None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:page
- name="index.html"
- template="%s"
- permission="zope.Public"
- for="zope.app.component.tests.views.IC" />
- """ % path
+ name="index.html"
+ template="%s"
+ permission="zope.Public"
+ for="zope.app.component.tests.views.IC" />
+ ''' % path
))
v = getView(ob, 'index.html', request)
@@ -867,14 +868,14 @@
None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:page
- name="index.html"
- template="%s"
- permission="zope.Public"
+ name="index.html"
+ template="%s"
+ permission="zope.Public"
class="zope.app.publisher.browser.tests.templateclass.templateclass"
- for="zope.app.component.tests.views.IC" />
- """ % path
+ for="zope.app.component.tests.views.IC" />
+ ''' % path
))
v = getView(ob, 'index.html', request)
@@ -889,32 +890,27 @@
None)
xmlconfig(StringIO(template %
- """
- <directives namespace="http://namespaces.zope.org/zope">
- <directive name="permission"
- attributes="id title description"
- handler="
- zope.app.security.metaconfigure.definePermission" />
- </directives>
+ '''
+ <include package="zope.app.security" file="meta.zcml" />
<permission id="zope.TestPermission" title="Test permission" />
<browser:page
- name="xxx.html"
- template="%s"
- permission="zope.TestPermission"
- for="zope.app.component.tests.views.IC" />
- """ % path
+ name="xxx.html"
+ template="%s"
+ permission="zope.TestPermission"
+ for="zope.app.component.tests.views.IC" />
+ ''' % path
))
xmlconfig(StringIO(template %
- """
+ '''
<browser:page
- name="index.html"
- template="%s"
- permission="zope.Public"
- for="zope.app.component.tests.views.IC" />
- """ % path
+ name="index.html"
+ template="%s"
+ permission="zope.Public"
+ for="zope.app.component.tests.views.IC" />
+ ''' % path
))
v = getView(ob, 'xxx.html', request)
@@ -933,12 +929,12 @@
ConfigurationError,
xmlconfig,
StringIO(template %
- """
+ '''
<browser:page
- template="%s"
- for="zope.app.component.tests.views.IC"
- />
- """ % path
+ template="%s"
+ for="zope.app.component.tests.views.IC"
+ />
+ ''' % path
))
def testtemplateAndPage(self):
@@ -947,16 +943,16 @@
ConfigurationError,
xmlconfig,
StringIO(template %
- """
+ '''
<browser:view
- name="index.html"
- template="%s"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- >
- <browser:page name="foo.html" attribute="index" />
+ name="index.html"
+ template="%s"
+ for="zope.app.component.tests.views.IC"
+ permission="zope.Public"
+ >
+ <browser:page name="foo.html" attribute="index" />
</browser:view>
- """ % path
+ ''' % path
))
def testViewThatProvidesAnInterface(self):
@@ -964,21 +960,21 @@
self.assertEqual(queryView(ob, 'test', request, None), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
name="test"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
/>
- """
+ '''
))
v = queryView(ob, 'test', request, None, providing=IV)
self.assertEqual(v, None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
name="test"
class="zope.app.component.tests.views.V1"
@@ -986,7 +982,7 @@
provides="zope.app.component.tests.views.IV"
permission="zope.Public"
/>
- """
+ '''
))
v = queryView(ob, 'test', request, None, providing=IV)
@@ -998,27 +994,27 @@
self.assertEqual(queryView(ob, '', request, None, providing=IV), None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
/>
- """
+ '''
))
v = queryView(ob, '', request, None, providing=IV)
self.assertEqual(v, None)
xmlconfig(StringIO(template %
- """
+ '''
<browser:view
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
provides="zope.app.component.tests.views.IV"
permission="zope.Public"
/>
- """
+ '''
))
v = queryView(ob, '', request, None, providing=IV)
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/tests/setup.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/tests/setup.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/tests/setup.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -89,13 +89,10 @@
#------------------------------------------------------------------------
# Placeful setup
-from zope.app.component.hooks import getServices_hook, adapter_hook
from zope.app.tests.placelesssetup import setUp as placelessSetUp
from zope.app.tests.placelesssetup import tearDown as placelessTearDown
def placefulSetUp(site=False):
placelessSetUp()
- zope.component.getServices.sethook(getServices_hook)
- zope.component.adapter_hook.sethook(adapter_hook)
setUpAnnotations()
setUpDependable()
setUpTraversal()
@@ -110,7 +107,6 @@
from zope.app.component.hooks import setSite
def placefulTearDown():
placelessTearDown()
- zope.component.getServices.reset()
setSite()
Modified: Zope3/branches/ZopeX3-3.0/src/zope/component/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/component/__init__.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/component/__init__.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -261,4 +261,4 @@
def queryResource(name, request, default=None, providing=Interface,
context=None):
s = getService(Presentation, context)
- return s.queryResource(name, request, default, providing=providing)
+ return s.queryResource(name, request, default=default, providing=providing)
Modified: Zope3/branches/ZopeX3-3.0/src/zope/component/interfaces.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/component/interfaces.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/component/interfaces.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -552,7 +552,7 @@
class IPresentationService(Interface):
"""A service to manage Presentation components."""
- def queryResource(name, request, providing=Interface, default=None):
+ def queryResource(name, request, default=None, providing=Interface):
"""Look up a named resource for a given request
The request must implement IPresentationRequest.
@@ -560,7 +560,7 @@
The default will be returned if the component can't be found.
"""
- def queryView(object, name, request, providing=Interface, default=None):
+ def queryView(object, name, request, default=None, providing=Interface):
"""Look for a named view for a given object and request
The request must implement IPresentationRequest.
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/backward.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/backward.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/backward.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,418 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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.
-#
-##############################################################################
-"""Pre-zcml-geddon backward compatability
-
-Rather than revisit all of the old meta configurations, we'll
-support the old configurations for a time until they can be converted.
-There are two aspects of this:
-
-1. Supporting complex directives (as opposed to simple and grouping
- directives). This support is actually provided in config.py.
- We'll probably support complex directives indefinately, as there
- are some pretty complicated handlers in place now that we don't
- want to take time to rewrite any time soon.
-
-2. Supporting the old-style meta-configuration ZCML directives:
- zope:directives, zope:directive, zope:description, and
- zope:attribute. Hopefully, we can get rid of these sooner by
- converting the existing meta configurations to use the new
- meta: directives and schema. Certainly directives with message ids
- will need to be converted.
-
-This file contains the implementations of the old-style meta
-configurations.
-
-$Id$
-"""
-
-from keyword import iskeyword
-from zope.configuration import config
-from zope import interface
-from zope import schema
-
-
-class IDescribed(interface.Interface):
-
- name = schema.TextLine(
- title=u"Directive name",
- description=u"The name of the directive being defined"
- )
-
- description = schema.Text(
- title=u"Directive discription",
- description=u"This should document how the directive is used.",
- default=u"",
- )
-
-class ISubdirectiveInfo(IDescribed):
- """Information common to all directive definitions have
- """
-
- attributes = schema.Bytes(
- title=u"Attribute names",
- description=u"This is a space-speratated list of attribute names. "
- u"This is used to provide a mimimal specification the "
- u"attributes used.",
- default="",
- )
-
-class IDirectiveInfo(ISubdirectiveInfo):
- """Information common to all directive definitions have
- """
-
- handler = config.fields.GlobalObject(
- title=u"Directive handler",
- description=u"The dotted name of the directive handler",
- )
-
-class ISubdirectiveContext(ISubdirectiveInfo, config.IConfigurationContext):
- pass
-
-class IDirectiveContext(IDirectiveInfo, ISubdirectiveContext):
- pass
-
-
-class Described:
-
- interface.implements(IDescribed)
-
- description = u''
-
- def _merge_description_and_info(self):
- r"""Combind a description, given as an attribute with info text
-
- >>> d = Described()
- >>> d.info = Described() # Any object with attributes will do
- >>> d.info.text = u''
- >>> d._merge_description_and_info()
- >>> d.info.text
- u''
-
- >>> d.info.text = u' \n '
- >>> d._merge_description_and_info()
- >>> d.info.text
- u' \n '
-
- >>> d.description = u'test directive'
- >>> d._merge_description_and_info()
- >>> d.info.text
- u'test directive'
-
- >>> d.info.text = u'blah\nblah'
- >>> d._merge_description_and_info()
- >>> d.info.text
- u'test directive\n\nblah\nblah'
-
- """
- if self.description:
- if self.info.text.strip():
- self.info.text = self.description + u"\n\n" + self.info.text
- else:
- self.info.text = self.description
-
-class Attributed(config.GroupingContextDecorator):
- """Compute schema definitions from simple attribute specifications
-
- The attribute specifications can be given as simple names in the
- constructor:
-
- >>> context = config.ConfigurationMachine()
- >>> x = Attributed(context, attributes=u"a b c")
-
- Or the can be provides as keys added to the attributes disctionary:
-
- >>> x.attributes['foo'] = schema.Int(title=u"Foo")
-
- When tha _schema_from_attrs method is called, a schema is computed:
-
- >>> x._schema_from_attrs()
- >>> for name in x.schema:
- ... f = x.schema[name]
- ... print f.__class__.__name__, f.__name__, f.title, int(f.required)
- Text a a 0
- Text c c 0
- Text b b 0
- Int foo Foo 1
-
- If you need to be able to accept arbritrary parameters, include an
- attribute named "*" in the list of attributes:
-
- >>> context = config.ConfigurationMachine()
- >>> x = Attributed(context, attributes=u"a b c *")
- >>> x._schema_from_attrs()
- >>> for name in x.schema:
- ... f = x.schema[name]
- ... print f.__class__.__name__, f.__name__, f.title, int(f.required)
- Text a a 0
- Text c c 0
- Text b b 0
-
- Note that we don't see "*" in the schema. Rather, we see that the
- schema as a tagged value:
-
- >>> x.schema.getTaggedValue("keyword_arguments")
- 1
-
- Indicating that the directive handler accepts extra keyword
- arguments, which means that arbitrary extra parameters can be given.
- """
-
- interface.implementsOnly(IDescribed)
-
- __keyword_arguments = False
-
- def attribute(self, name, required=False, description=u''):
- if name == '*':
- self.__keyword_arguments = True
- return
-
- aname = str(name)
- if iskeyword(name):
- aname += '_'
- self.attributes[aname] = schema.Text(
- title = unicode(aname),
- required = required,
- description = description,
- )
-
- def __init__(self, context, attributes=u'', **kw):
- config.GroupingContextDecorator.__init__(self, context, **kw)
- self.attributes = {}
- for name in attributes.strip().split():
- self.attribute(name)
-
- def _schema_from_attrs(self):
- schema = interface.Interface.__class__(
- "schema generated from attributes",
- (interface.Interface, ),
- self.attributes,
- )
- if not self.attributes:
- # No attribute definitions, allow keyword args
- schema.setTaggedValue('keyword_arguments', True)
- self.schema = schema
-
- if self.__keyword_arguments:
- schema.setTaggedValue('keyword_arguments', True)
-
-
-class Directive(Attributed, Described):
- """Handler for the directive directive
-
- Actual definition of the directive is delayed until
- sub(meta)directives have been handled.
-
- See the test in tests/test_backward
- """
- interface.implements(IDirectiveContext)
- usedIn = config.IConfigurationContext
-
- def __init__(self, context, **kw):
- Attributed.__init__(self, context, **kw)
- self.subdirectives = {}
-
- def after(self):
- self._schema_from_attrs()
- self._merge_description_and_info()
- if self.subdirectives:
- # we have subdirectives, so set up a complex directive
- complex = config.ComplexDirectiveDefinition(self)
- complex.handler = self.handler
- complex.update(self.subdirectives)
- complex.before()
- else:
- config.defineSimpleDirective(self, self.name, self.schema,
- self.handler, self.namespace)
-
-
-class Subdirective(Attributed, Described):
- """Handler for the directive directive
-
- Actual definition of the directive is delayed until
- sub(meta)directives have been handled.
-
- >>> context = config.ConfigurationMachine()
- >>> d = Directive(context)
- >>> len(d.subdirectives)
- 0
- >>> s = Subdirective(d, name="foo", attributes=u"a b")
- >>> len(d.subdirectives)
- 0
- >>> class Info:
- ... text=u'spam'
- >>> s.info = Info()
- >>> s.after()
- >>> len(d.subdirectives)
- 1
- >>> schema, info = d.subdirectives['foo']
-
- >>> def sorted(x):
- ... r = list(x)
- ... r.sort()
- ... return r
-
- >>> sorted(schema)
- ['a', 'b']
- >>> info.text
- u'spam'
-
- """
-
- interface.implements(ISubdirectiveContext)
-
- def after(self):
- self._schema_from_attrs()
- self._merge_description_and_info()
- self.context.subdirectives[self.name] = self.schema, self.info
-
-class IAttribute(IDescribed):
-
- required = config.fields.Bool(
- title=u"Required",
- description=u"Is the attribute required?",
- required=True,
- default=False,
- )
-
-class Attribute(config.GroupingContextDecorator, Described):
- r"""Simple attribute specification
-
- Provide a very simple specification of an attribute and add it to
- the attributes dictionary of the containing context.
-
- >>> context = config.ConfigurationMachine()
- >>> d = Directive(context, attributes=u"a")
- >>> len(d.attributes)
- 1
-
- >>> a = Attribute(d, name="a", description=u"blah")
- >>> class Info:
- ... text=u'spam'
- >>> a.info = Info()
- >>> d.attributes['a'].description
- u''
- >>> a.after()
- >>> d.attributes['a'].description
- u'blah\n\nspam'
- >>> d.attributes['a'].required
- 0
- >>> d.attributes['a'].__class__.__name__
- 'Text'
-
- >>> a = Attribute(d, name="b", description=u"eek", required=True)
- >>> class Info:
- ... text=u'spam'
- >>> a.info = Info()
- >>> a.after()
- >>> d.attributes['b'].description
- u'eek\n\nspam'
- >>> d.attributes['b'].required
- 1
-
- >>> len(d.attributes)
- 2
-
- """
-
- required = False
-
- def after(self):
- self._merge_description_and_info()
- self.context.attribute(self.name, self.required, self.info.text)
-
-class Description(config.GroupingContextDecorator):
- r"""Provide descriptions for surrounding directives
-
- This works a bit hard to be an effective noop, since
- it has the same effect as providing text data.
-
- >>> context = config.ConfigurationMachine()
- >>> d = Directive(context, attributes=u"a")
- >>> class Info:
- ... text=u'spam \n'
- >>> d.info = Info()
-
- >>> des = Description(d)
- >>> des.info = Info()
- >>> des.info.text = u"blah\nblah"
- >>> des.after()
-
- >>> d.info.text
- u'spam\n\nblah\nblah'
-
- """
-
- def after(self):
- """Merge our info with containing directive's info
- """
-
- if not self.info.text.strip():
- return
-
- context = self.context
- old = context.info.text.rstrip()
-
- if old:
- context.info.text = old + u"\n\n" + self.info.text
- else:
- context.info.text += self.info.text
-
-
-def bootstrap(context):
-
- # zope:directives
- context((config.metans, 'groupingDirective'),
- name='directives',
- namespace=config.zopens,
- handler="zope.configuration.config.DirectivesHandler",
- schema="zope.configuration.config.IDirectivesInfo"
- )
-
- # zope:directive
- context((config.metans, 'groupingDirective'),
- name='directive',
- namespace=config.zopens,
- usedIn="zope.configuration.config.IDirectivesContext",
- handler="zope.configuration.backward.Directive",
- schema="zope.configuration.backward.IDirectiveInfo"
- )
-
- # zope:subdirective
- context((config.metans, 'groupingDirective'),
- name='subdirective',
- namespace=config.zopens,
- usedIn="zope.configuration.backward.IDirectiveContext",
- handler="zope.configuration.backward.Subdirective",
- schema="zope.configuration.backward.ISubdirectiveInfo"
- )
-
- # zope:attribute
- context((config.metans, 'groupingDirective'),
- name='attribute',
- namespace=config.zopens,
- usedIn="zope.configuration.backward.ISubdirectiveContext",
- handler="zope.configuration.backward.Attribute",
- schema="zope.configuration.backward.IAttribute"
- )
-
- # zope:discription
- context((config.metans, 'groupingDirective'),
- name='description',
- namespace=config.zopens,
- usedIn="zope.configuration.backward.IDescribed",
- handler="zope.configuration.backward.Description",
- schema="zope.interface.Interface"
- )
-
-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/config.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1568,6 +1568,3 @@
handler="zope.configuration.config.subdirective",
schema="zope.configuration.config.IDirectiveInfo"
)
-
- import zope.configuration.backward
- zope.configuration.backward.bootstrap(context)
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/meta.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/meta.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/meta.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,9 +0,0 @@
-<configure xmlns='http://namespaces.zope.org/zope'>
-
- <!-- zope.configure -->
- <directives namespace="http://namespaces.zope.org/zope">
- <directive name="hook" attributes="name implementation module"
- handler="zope.configuration.metaconfigure.hook" />
- </directives>
-
-</configure>
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/metaconfigure.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/metaconfigure.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/metaconfigure.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,30 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""
-$Id$
-"""
-
-def hook(_context, name, implementation, module=None):
- if module:
- name = "%s.%s" % (module, name)
- hook = _context.resolve(name)
- sethook = getattr(hook, 'sethook', None)
- if sethook is None:
- raise TypeError(name,'is not hookable')
- implementation = _context.resolve(implementation)
- _context.action(
- discriminator=('http://namespaces.zope.org/zope/hook', name),
- callable=sethook,
- args=(implementation, )
- )
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backward.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backward.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backward.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,56 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:test="http://namespaces.zope.org/test"
- package="zope.configuration.tests.directives"
- >
-
- <directives namespace="http://namespaces.zope.org/test">
-
- <directive name="simple" attributes="a b c"
- handler=".simple" description="simple example" />
-
-
- <directive name="newsimple" handler=".newsimple">
-
- <attribute name="a" description="a descr" required="yes" />
- <attribute name="b">
- <description>b descr</description>
- </attribute>
- <attribute name="c" required="yes" >
- c descr
- </attribute>
-
- </directive>
- </directives>
-
- <test:simple a="aa" c="cc">first</test:simple>
- <test:newsimple a="naa" c="ncc" b="nbb">second</test:newsimple>
-
- <directives namespace="http://namespaces.zope.org/test">
-
- <directive name="testc" handler=".Complex">
-
- <attribute name="a" description="a descr" required="yes" />
- <attribute name="b">
- <description>b descr</description>
- </attribute>
- <attribute name="c" required="yes">
- c descr
- </attribute>
-
- <subdirective name="factory">
- <attribute name="factory" required="yes" />
- </subdirective>
- </directive>
-
- </directives>
-
- <test:testc a="ca" c="cc">
- Third
- <test:factory factory=".f">
- Fourth
- </test:factory>
- </test:testc>
-
-</configure>
-
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkw.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkw.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkw.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,30 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:test="http://namespaces.zope.org/test"
- package="zope.configuration.tests.directives"
- >
-
- <directives namespace="http://namespaces.zope.org/test">
-
- <directive name="k" attributes="for class x"
- handler=".k" description="simple example w python keywords" />
-
-
- <directive name="k2" handler=".k">
-
- <attribute name="for" description="for descr" required="yes" />
- <attribute name="class">
- <description>class descr</description>
- </attribute>
- <attribute name="x" required="yes" >
- x descr
- </attribute>
-
- </directive>
- </directives>
-
- <test:k for="f" class="c" x="x" >first</test:k>
- <test:k2 for="ff" class="cc" x="xx">second</test:k2>
-
-</configure>
-
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkwextra.zcml
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkwextra.zcml 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/backwardkwextra.zcml 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,17 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:test="http://namespaces.zope.org/test"
- package="zope.configuration.tests.directives"
- >
-
- <directives namespace="http://namespaces.zope.org/test">
-
- <directive name="k" attributes="for * class x"
- handler=".kkw" />
-
- </directives>
-
- <test:k for="f" class="c" x="x" a="a" b="b" />
-
-</configure>
-
Deleted: Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/test_backward.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/test_backward.py 2004-08-12 16:36:24 UTC (rev 27061)
+++ Zope3/branches/ZopeX3-3.0/src/zope/configuration/tests/test_backward.py 2004-08-12 16:43:14 UTC (rev 27062)
@@ -1,122 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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.
-#
-##############################################################################
-"""Test backward-compatiblity.
-
-$Id$
-"""
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-from zope.configuration import config, xmlconfig
-from zope.configuration.tests.test_xmlconfig import clean_text_w_paths
-
-def test_directive_and_integration():
- r"""
-
- To see if the backward compatability meta configurations are
- working, well evaluate a test zcml file and see if we get the
- expected actions:
-
- >>> from zope.configuration import tests
- >>> context = xmlconfig.file("backward.zcml", tests, execute=False)
- >>> for action in context.actions:
- ... print action[:2]
- ... print action[2]
- ... print clean_text_w_paths(unicode(action[5]))
- ... if action[5].text.strip():
- ... print action[5].text.strip()
- (('simple', u'aa', u'xxx', u'cc'), f)
- (u'aa', u'xxx', u'cc')
- File "tests/backward.zcml", line 26.2-26.34
- <test:simple a="aa" c="cc">first</test:simple>
- first
- (('newsimple', u'naa', u'nbb', u'ncc'), f)
- (u'naa', u'nbb', u'ncc')
- File "tests/backward.zcml", line 27.2-27.48
- <test:newsimple a="naa" c="ncc" b="nbb">second</test:newsimple>
- second
- ('Complex.__init__', None)
- ()
- File "tests/backward.zcml", line 48.2-53.2
- <test:testc a="ca" c="cc">
- Third
- <test:factory factory=".f">
- Fourth
- </test:factory>
- </test:testc>
- Third
- (('Complex.factory', 1, 2), u'.f')
- (u'ca',)
- File "tests/backward.zcml", line 50.5-52.5
- <test:factory factory=".f">
- Fourth
- </test:factory>
- Fourth
- (('Complex', 1, 2), f)
- (u'xxx', u'cc')
- File "tests/backward.zcml", line 48.2-53.2
- <test:testc a="ca" c="cc">
- Third
- <test:factory factory=".f">
- Fourth
- </test:factory>
- </test:testc>
- Third
-
- """
-
-def test_directive_and_integration_w_python_keywords():
- r"""
-
- >>> from zope.configuration import tests
- >>> context = xmlconfig.file("backwardkw.zcml", tests, execute=False)
- >>> for action in context.actions:
- ... print action[:2]
- ... print action[2]
- ... print clean_text_w_paths(unicode(action[5]))
- ... print action[5].text.strip()
- (('k', u'f'), f)
- (u'f', u'c', u'x')
- File "tests/backwardkw.zcml", line 26.2-26.43
- <test:k for="f" class="c" x="x" >first</test:k>
- first
- (('k', u'ff'), f)
- (u'ff', u'cc', u'xx')
- File "tests/backwardkw.zcml", line 27.2-27.44
- <test:k2 for="ff" class="cc" x="xx">second</test:k2>
- second
-
- """
-
-def test_directive_and_integration_w_extra_arguments():
- r"""
-
- >>> from zope.configuration import tests
- >>> context = xmlconfig.file("backwardkwextra.zcml", tests, execute=False)
- >>> for action in context.actions:
- ... print action[:2]
- ... print action[2]
- ... print clean_text_w_paths(unicode(action[5]))
- (('k', u'f'), f)
- (u'f', u'c', u'x', {'a': u'a', 'b': u'b'})
- File "tests/backwardkwextra.zcml", line 14.2-14.51
- <test:k for="f" class="c" x="x" a="a" b="b" />
- """
-
-def test_suite():
- return unittest.TestSuite((
- DocTestSuite('zope.configuration.backward'),
- DocTestSuite(),
- ))
-
-if __name__ == '__main__': unittest.main()
More information about the Zope3-Checkins
mailing list