[Zope3-checkins]
SVN: Zope3/branches/srichter-blow-services/src/zope/app/
Deactivted all BBB to ensure that we use only the latest code
in zope.app
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Jan 9 13:18:05 EST 2005
Log message for revision 28772:
Deactivted all BBB to ensure that we use only the latest code in zope.app
Made almost all tests pass again, except the few that heavily depended on
the old way of doing things: apidoc, module, presentation
Changed:
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/browser.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/configure.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/browser.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/index.pt
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/tests.py
D Zope3/branches/srichter-blow-services/src/zope/app/apidoc/servicemodule/
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilities.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/viewmodule/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/apidoc/zcmlmodule/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py
U Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py
U Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
U Zope3/branches/srichter-blow-services/src/zope/app/appsetup/bootstrap.py
U Zope3/branches/srichter-blow-services/src/zope/app/appsetup/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/basicskin/standardmacros.py
U Zope3/branches/srichter-blow-services/src/zope/app/basicskin/tests/test_standardmacros.py
D Zope3/branches/srichter-blow-services/src/zope/app/bundle/
U Zope3/branches/srichter-blow-services/src/zope/app/cache/interfaces/ram.py
U Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_annotationcacheable.py
U Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_caching.py
U Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_ramcache.py
U Zope3/branches/srichter-blow-services/src/zope/app/catalog/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/catalog/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/adapter.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/__init__.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/meta.zcml
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metaconfigure.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metadirectives.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_changeregistrations.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_directives.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_editregistration.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_registrationview.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_toolbacklink.py
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tool.pt
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tools.pt
A Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tools.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/fields.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/site.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/testing.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_contentdirective.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_fields.py
U Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_site.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/browser/adding.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/browser/contents.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_adding.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_contents.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_directive.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/contained.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_btree.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_contained.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_containertraverser.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_icontainer.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectcopier.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectmover.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_ordered.py
U Zope3/branches/srichter-blow-services/src/zope/app/container/traversal.py
U Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_clipboard.py
U Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_rename.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/propfind.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/proppatch.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_adapter.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_mkcol.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_propfind.py
U Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_proppatch.py
U Zope3/branches/srichter-blow-services/src/zope/app/demo/insensitivefolder/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/demo/jobboard/browser.py
U Zope3/branches/srichter-blow-services/src/zope/app/demo/pageletchooser/adapters.py
U Zope3/branches/srichter-blow-services/src/zope/app/dependable/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/dtmlpage/tests/test_dtmlpage.py
U Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_creatorannotator.py
U Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py
U Zope3/branches/srichter-blow-services/src/zope/app/error/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/event/dispatching.py
U Zope3/branches/srichter-blow-services/src/zope/app/event/tests/test_objectevent.py
U Zope3/branches/srichter-blow-services/src/zope/app/exception/browser/tests/test_unauthorized.py
U Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/browser/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/tests/test_external_edit.py
U Zope3/branches/srichter-blow-services/src/zope/app/folder/folder.py
U Zope3/branches/srichter-blow-services/src/zope/app/folder/fssync/adapter.py
U Zope3/branches/srichter-blow-services/src/zope/app/folder/interfaces.py
U Zope3/branches/srichter-blow-services/src/zope/app/folder/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/add.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/editview.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/itemswidgets.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/sequencewidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.txt
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_add.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_browserwidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicecollections.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicewidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editview.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editwizardview.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_itemswidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_objectwidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_registrations.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_sequencewidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_source.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_textwidget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_widgetdirective.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/browser/widget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_utility.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_widget.py
U Zope3/branches/srichter-blow-services/src/zope/app/form/utility.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/configure.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/fsregistry.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/interfaces.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/syncer.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_committer.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsdirective.py
U Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsregistry.py
U Zope3/branches/srichter-blow-services/src/zope/app/ftp/tests/test_ftpview.py
U Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managerdetails.py
U Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managers.py
U Zope3/branches/srichter-blow-services/src/zope/app/generations/generations.py
U Zope3/branches/srichter-blow-services/src/zope/app/homefolder/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/homefolder/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_delete.py
U Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_put.py
U Zope3/branches/srichter-blow-services/src/zope/app/i18n/browser/tests/test_translate.py
U Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_filters.py
U Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_translationdomain.py
U Zope3/branches/srichter-blow-services/src/zope/app/i18n/translationdomain.py
U Zope3/branches/srichter-blow-services/src/zope/app/interface/tests/test_vocabulary.py
U Zope3/branches/srichter-blow-services/src/zope/app/intid/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/introspector/browser.py
U Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspector.py
U Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspectorview.py
U Zope3/branches/srichter-blow-services/src/zope/app/location/traversing.py
U Zope3/branches/srichter-blow-services/src/zope/app/mail/metaconfigure.py
U Zope3/branches/srichter-blow-services/src/zope/app/mail/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/meta.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/module/tests/test_modulelookup.py
U Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/onlinehelp.py
U Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_helpdirectives.py
U Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_onlinehelp.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagelet/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/pagelet/collector.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagelet/metaconfigure.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tales.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tests/test_pagelet.py
U Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/adapters.py
U Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/collector.py
U Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/vocabulary.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/engine.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_binding.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_viewzpt.py
U Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/viewpagetemplatefile.py
U Zope3/branches/srichter-blow-services/src/zope/app/pau/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/pau/browser/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/pau/browserplugins.py
U Zope3/branches/srichter-blow-services/src/zope/app/pau/groupfolder.txt
U Zope3/branches/srichter-blow-services/src/zope/app/pau/pau.py
U Zope3/branches/srichter-blow-services/src/zope/app/pau/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/authsetup.py
U Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagefolder.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/presentation.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_pagefolder.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_presentation.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_zpt.py
U Zope3/branches/srichter-blow-services/src/zope/app/presentation/zpt.py
U Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/browser.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/http.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/httpfactory.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/publicationtraverse.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_browserpublication.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_http.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_httpfactory.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_simplecomponenttraverser.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_xmlrpcpublication.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_zopepublication.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/traversers.py
U Zope3/branches/srichter-blow-services/src/zope/app/publication/zopepublication.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/fields.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/i18nresourcemeta.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/icon.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/menu.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/metaconfigure.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resourcemeta.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resources.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/support.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_addMenuItem.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directoryresource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fields.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fileresource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_icondirective.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menu.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menudirectives.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resources.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/testi18nfileresource.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/viewmeta.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/metaconfigure.py
U Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/rdb/metaconfigure.py
U Zope3/branches/srichter-blow-services/src/zope/app/rdb/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/renderer/tests/test_vocabulary.py
U Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py
U Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/xmlobject.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/browser/configure.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/schema/configure.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/schema/schema.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/fields.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_field.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_interfaceutility.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautility.py
U Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautilitypersistence.py
U Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/content.py
U Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/tests/test_content.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/browser/principalterms.txt
U Zope3/branches/srichter-blow-services/src/zope/app/security/browser/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/configure.zcml
U Zope3/branches/srichter-blow-services/src/zope/app/security/permission.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_directives.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_principalregistry.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectclass.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectsubclass.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_securitydirectives.py
U Zope3/branches/srichter-blow-services/src/zope/app/security/vocabulary.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/granting.txt
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_granting.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/role.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_securitydirectives.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_zopepolicy.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/vocabulary.py
U Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/zopepolicy.txt
U Zope3/branches/srichter-blow-services/src/zope/app/session/http.py
U Zope3/branches/srichter-blow-services/src/zope/app/session/session.py
U Zope3/branches/srichter-blow-services/src/zope/app/sqlexpr/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/browser/sqlscript.py
U Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/tests/test_sqlscript.py
U Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py
U Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py
U Zope3/branches/srichter-blow-services/src/zope/app/traversing/namespace.py
U Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_conveniencefunctions.py
U Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_namespacetrversal.py
U Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_physicallocationadapters.py
U Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_traverser.py
U Zope3/branches/srichter-blow-services/src/zope/app/tree/adapters.py
U Zope3/branches/srichter-blow-services/src/zope/app/tree/browser/cookie.py
U Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/basetest.py
U Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/test_adapters.py
U Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_undoview.py
U Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_zodbundomanager.py
U Zope3/branches/srichter-blow-services/src/zope/app/versioncontrol/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/instance.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_contentworkflow.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_definition.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_instance.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/test_instance.py
U Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/workflowsetup.py
U Zope3/branches/srichter-blow-services/src/zope/app/zapi/README.txt
U Zope3/branches/srichter-blow-services/src/zope/app/zapi/tests.py
U Zope3/branches/srichter-blow-services/src/zope/app/zptpage/tests/test_zptpage.py
-=-
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/browser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/browser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -117,7 +117,8 @@
klass = zapi.traverse(classModule, p.replace('.', '/'))
results.append(
{'path': p,
- 'url': zapi.getView(klass, 'absolute_url', self.request)()
+ 'url': zapi.getMultiAdapter(
+ (klass, self.request), name='absolute_url')()
})
results.sort(lambda x, y: cmp(x['path'], y['path']))
return results
@@ -168,7 +169,8 @@
'http://127.0.0.1'
"""
m = zapi.getUtility(IDocumentationModule, "Class")
- return zapi.getView(zapi.getParent(m), 'absolute_url', self.request)()
+ return zapi.getMultiAdapter(
+ (zapi.getParent(m), self.request), name='absolute_url')()
def getHTMLContents(self):
"""Return an HTML markup version of the ZCML file with links to other
@@ -477,7 +479,8 @@
path = getPythonPath(unwrapped_cls)
try:
klass = zapi.traverse(classModule, path.replace('.', '/'))
- url = zapi.getView(klass, 'absolute_url', self.request)()
+ url = zapi.getMultiAdapter(
+ (klass, self.request), name='absolute_url')()
except TraversalError:
# If one of the classes is implemented in C, we will not
# be able to find it.
@@ -501,7 +504,8 @@
'http://127.0.0.1'
"""
m = zapi.getUtility(IDocumentationModule, "Class")
- return zapi.getView(zapi.getParent(m), 'absolute_url', self.request)()
+ return zapi.getMultiAdapter(
+ (zapi.getParent(m), self.request), name='absolute_url')()
def getInterfaces(self):
@@ -684,7 +688,8 @@
('url', 'http://127.0.0.1/zope/app/apidoc/classmodule/cleanUp')]]
"""
entries = [{'name': name,
- 'url': zapi.getView(obj, 'absolute_url', self.request)(),
+ 'url': zapi.getMultiAdapter(
+ (obj, self.request), name='absolute_url')(),
'ismodule': zapi.isinstance(obj, Module),
'isclass': zapi.isinstance(obj, Class),
'isfunction': zapi.isinstance(obj, Function),
@@ -723,13 +728,15 @@
while removeSecurityProxy(module).__class__ is Module:
crumbs.append(
{'name': zapi.name(module),
- 'url': zapi.getView(module, 'absolute_url', self.request)()}
+ 'url': zapi.getMultiAdapter(
+ (module, self.request), name='absolute_url')()}
)
module = zapi.getParent(module)
crumbs.append(
{'name': _('[top]'),
- 'url': zapi.getView(module, 'absolute_url', self.request)()} )
+ 'url': zapi.getMultiAdapter(
+ (module, self.request), name='absolute_url')()} )
crumbs.reverse()
return crumbs
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/classmodule/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,7 @@
from zope.app.renderer.stx import StructuredTextSourceFactory
from zope.app.renderer.stx import IStructuredTextSource
from zope.app.renderer.stx import StructuredTextToHTMLRenderer
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.traversing.browser import AbsoluteURL, SiteAbsoluteURL
from zope.app.traversing.interfaces import ITraversable, ITraverser
from zope.app.traversing.interfaces import IPhysicallyLocatable
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/configure.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,6 @@
<!-- API Documentation Modules -->
<include package=".classmodule" />
<include package=".ifacemodule" />
- <include package=".servicemodule" />
<include package=".utilitymodule" />
<include package=".viewmodule" />
<include package=".zcmlmodule" />
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/browser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/browser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -447,12 +447,12 @@
'zope.app.traversing.interfaces.IPhysicallyLocatable'),
('required', [])]]
"""
- service = zapi.getService('Adapters')
+ sm = zapi.getSiteManager()
# Must remove security proxies, so that we have access to the API
# methods.
iface = removeSecurityProxy(self.context)
adapters = []
- for reg in service.registrations():
+ for reg in sm.registrations():
# Only grab the adapters for which this interface is required
if reg.required and reg.required[0] is not None and \
iface not in reg.required:
@@ -495,12 +495,12 @@
('name', ''),
('required', ['zope.app.apidoc.ifacemodule.tests.IBar'])]]
"""
- service = zapi.getService('Adapters')
+ sm = zapi.getSiteManager()
# Must remove security and location proxies, so that we have access to
# the API methods and class representation.
iface = removeAllProxies(self.context)
adapters = []
- for reg in service.registrations():
+ for reg in sm.registrations():
# Only grab adapters for which this interface is provided
if iface is not reg.provided:
continue
@@ -596,10 +596,10 @@
('url', 'zope/app/apidoc/ifacemodule/tests/Foo'),
('url_name', u'The Foo')]]
"""
- service = zapi.getService('Utilities')
+ sm = zapi.getSiteManager()
# Must remove security and location proxies, so that we have access to
# the API methods and class representation.
- utils = service.getUtilitiesFor(removeAllProxies(self.context))
+ utils = sm.getUtilitiesFor(removeAllProxies(self.context))
info = []
for name, util in utils:
if type(util) in (ClassType, TypeType):
@@ -612,20 +612,3 @@
'path': path,
'url': path.replace('.', '/')})
return info
-
- def getServices(self):
- """Return all services (at most one) that provide this interface.
-
- Example::
-
- >>> from tests import getInterfaceDetails
- >>> details = getInterfaceDetails()
- >>> details.getServices()
- ['Foo']
- """
- # Must remove security and location proxies, so that we have access to
- # the API methods and class representation.
- iface = removeAllProxies(self.context)
- service = zapi.getService('Services')
- services = service.getServiceDefinitions()
- return [ser[0] for ser in services if ser[1] is iface]
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/index.pt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/index.pt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/index.pt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -196,9 +196,8 @@
<div tal:define="factories view/getFactories;
utilities view/getUtilitiesFor;
- services view/getServices;
classes view/getClasses"
- tal:condition="python: factories or utilities or services or classes">
+ tal:condition="python: factories or utilities or classes">
<h2 class="details-section" i18n:translate="">Other Information</h2>
@@ -248,29 +247,12 @@
</div>
</tal:block>
- <tal:block condition="services">
- <h3 class="details-section" i18n:translate="">Service</h3>
- <div class="indent">
- <div class="small" i18n:translate="">
- A list of services (usually just one) that are are registered to
- provide this interface.
- </div>
- <ul>
- <li tal:repeat="service services">
- <a href=""
- tal:attributes="href string:../../Service/$service/"
- tal:content="service" />
- </li>
- </ul>
- </div>
- </tal:block>
-
<tal:block condition="classes">
<h3 class="details-section" i18n:translate="">Classes</h3>
<div class="indent">
<div class="small" i18n:translate="">
A list of classes that implement this interface. This might
- duplicate the entries in Utilities and Services.
+ duplicate the entries in Utilities.
</div>
<ul>
<li tal:repeat="klass classes">
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/ifacemodule/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -35,7 +35,7 @@
from zope.app.renderer.stx import StructuredTextSourceFactory
from zope.app.renderer.stx import IStructuredTextSource
from zope.app.renderer.stx import StructuredTextToHTMLRenderer
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.tree.interfaces import IUniqueId
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.component.interfaces import IFactory
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.location import LocationProxy
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.interface import implements
from zope.app.apidoc.interfaces import IDocumentationModule
from zope.app.apidoc.ifacemodule import InterfaceModule
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilities.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilities.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilities.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -544,7 +544,7 @@
if text:
source = zapi.createObject(None, format, text)
- renderer = zapi.getView(source, '', TestRequest())
+ renderer = zapi.getMultiAdapter((source, TestRequest()))
return renderer.render()
else:
return u''
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,9 +21,8 @@
from zope.app import zapi
from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.component.localservice import queryNextService
+from zope.app.component import queryNextSiteManager
from zope.app.location.interfaces import ILocation
-from zope.app.servicenames import Utilities
from zope.app.apidoc.interfaces import IDocumentationModule
from zope.app.apidoc.utilities import ReadContainerBase, getPythonPath
@@ -83,20 +82,20 @@
def get(self, key, default=None):
"""See zope.app.container.interfaces.IReadContainer"""
- service = zapi.getService(Utilities)
+ sm = zapi.getSiteManager()
if key == NONAME:
key = ''
utils = [Utility(self, reg)
- for reg in service.registrations()
+ for reg in sm.registrations()
if reg.name == key and reg.provided == self.interface]
return utils and utils[0] or default
def items(self):
"""See zope.app.container.interfaces.IReadContainer"""
- service = zapi.getService(Utilities)
+ sm = zapi.getSiteManager()
items = [(reg.name or NONAME, Utility(self, reg))
- for reg in service.registrations()
+ for reg in sm.registrations()
if self.interface == reg.provided]
items.sort()
return items
@@ -150,13 +149,13 @@
return UtilityInterface(self, key, getattr(mod, parts[-1], default))
def items(self):
- service = zapi.getService(Utilities)
+ sm = zapi.getSiteManager()
ifaces = {}
- while service is not None:
- for reg in service.registrations():
+ while sm is not None:
+ for reg in sm.registrations():
path = getPythonPath(reg.provided)
ifaces[path] = UtilityInterface(self, path, reg.provided)
- service = queryNextService(service, Utilities)
+ sm = queryNextSiteManager(sm)
items = ifaces.items()
items.sort(lambda x, y: cmp(x[0].split('.')[-1], y[0].split('.')[-1]))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/utilitymodule/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,7 +22,7 @@
from zope.testing.doctestunit import DocTestSuite
from zope.app import zapi
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.apidoc.interfaces import IDocumentationModule
from zope.app.apidoc.tests import Root
@@ -40,9 +40,9 @@
def setUp(test):
placelesssetup.setUp()
- service = zapi.getGlobalService('Utilities')
- service.provideUtility(IDocumentationModule, InterfaceModule(), '')
- service.provideUtility(IDocumentationModule, ClassModule(), 'Classes')
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IDocumentationModule, InterfaceModule(), '')
+ gsm.provideUtility(IDocumentationModule, ClassModule(), 'Classes')
ztapi.provideAdapter(None, IUniqueId, LocationUniqueId)
ztapi.provideAdapter(None, IPhysicallyLocatable,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/viewmodule/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/viewmodule/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/viewmodule/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.testing.doctestunit import DocTestSuite
from zope.app import zapi
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.component.interface import provideInterface
class IFoo(Interface):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/apidoc/zcmlmodule/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/apidoc/zcmlmodule/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/apidoc/zcmlmodule/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
import os
import unittest
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.apidoc.tests import Root
import zope.app.appsetup.appsetup
Modified: Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,14 +17,14 @@
"""
import unittest
from types import DictType
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.applicationcontrol.applicationcontrol import applicationController
from zope.app.applicationcontrol.runtimeinfo import RuntimeInfo
from zope.app.applicationcontrol.browser.runtimeinfo import RuntimeInfoView
from zope.app.applicationcontrol.interfaces import \
IApplicationControl, IRuntimeInfo
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
class Test(PlacefulSetup, unittest.TestCase):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.app.applicationcontrol.browser.servercontrol import ServerControlView
from zope.app.applicationcontrol.interfaces import IServerControl
from zope.app.servicenames import Utilities
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
class ServerControlStub(object):
implements(IServerControl)
@@ -47,8 +47,7 @@
def test_ServerControlView(self):
control = ServerControlStub()
- zapi.getGlobalService(Utilities).provideUtility(
- IServerControl, control)
+ zapi.getGlobalSiteManager().provideUtility(IServerControl, control)
test_serverctrl = self._TestView__newView(
applicationController,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,12 +22,12 @@
except ImportError:
locale = None
-from zope.component import getService
+from zope.app import zapi
from zope.interface import implements
from zope.interface.verify import verifyObject
from zope.app.applicationcontrol.applicationcontrol import applicationController
from zope.app.applicationcontrol.interfaces import IRuntimeInfo, IZopeVersion
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
# seconds, time values may differ in order to be assumed equal
time_tolerance = 2
@@ -80,8 +80,7 @@
# we expect that there is no utility
self.assertEqual(runtime_info.getZopeVersion(), "")
- getService('Utilities').provideUtility(IZopeVersion,
- TestZopeVersion())
+ zapi.getSiteManager().provideUtility(IZopeVersion, TestZopeVersion())
self.assertEqual(runtime_info.getZopeVersion(),
stupid_version_string)
def test_PythonVersion(self):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/appsetup/bootstrap.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/appsetup/bootstrap.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -14,27 +14,19 @@
"""Bootstrap code.
This module contains code to bootstrap a Zope3 instance. For example
-it makes sure a root folder exists and creates and configures some
-essential services.
+it makes sure a root folder exists and creates one if necessary.
$Id$
"""
__docformat__ = 'restructuredtext'
-
from transaction import get_transaction
-from zope.app.publication.zopepublication import ZopePublication
-from zope.interface import implements
-from zope.app.traversing.interfaces import TraversalError
-from zope.app import zapi
-from zope.app.traversing.api import traverse, traverseName
-from zope.app.publication.zopepublication import ZopePublication
-from zope.app.folder import rootFolder
-from zope.app.servicenames import Utilities
-from zope.app.site.service import ServiceManager, ServiceRegistration
+from zope.app.component.interfaces import ISite
+from zope.app.component import site
from zope.app.container.interfaces import INameChooser
-from zope.app.utility import UtilityRegistration, LocalUtilityService
-from zope.app.utility.interfaces import ILocalUtilityService
+from zope.app.folder import rootFolder
+from zope.app.publication.zopepublication import ZopePublication
+from zope.app.traversing.api import traverse
def ensureObject(root_folder, object_name, object_type, object_factory):
"""Check that there's a basic object in the service
@@ -42,7 +34,7 @@
Return the name abdded, if we added an object, otherwise None.
"""
- package = getServiceManagerDefault(root_folder)
+ package = getSiteManagerDefault(root_folder)
valid_objects = [ name
for name in package
if object_type.providedBy(package[name]) ]
@@ -53,33 +45,15 @@
package[name] = obj
return name
-def ensureService(service_manager, root_folder, service_type,
- service_factory, **kw):
- """Add and configure a service to the root folder if it's
- not yet provided.
-
- Returns the name added or None if nothing was added.
- """
- if not service_manager.queryLocalService(service_type):
- # The site-manager may have chosen to disable one of the
- # core services. Their loss. The alternative is that when
- # they restart, they get a new service of the one that
- # they chose to disable.
- reg = service_manager.queryRegistrations(service_type)
- if reg is None:
- return addConfigureService(root_folder, service_type,
- service_factory, **kw)
- else:
- return None
-
def ensureUtility(root_folder, interface, utility_type,
utility_factory, name='', **kw):
"""Add a utility to the top Utility Service
Returns the name added or ``None`` if nothing was added.
"""
- utility_manager = zapi.getService(Utilities, root_folder)
- utils = list(utility_manager.getLocalUtilitiesFor(interface))
+ sm = root_folder.getSiteManager()
+ utils = [reg for reg in sm.utilities.registrations()
+ if reg.provided.isOrExtends(interface)]
if len(utils) == 0:
return addConfigureUtility(
root_folder, interface, utility_type, utility_factory,
@@ -88,46 +62,6 @@
else:
return None
-def addConfigureService(root_folder, service_type, service_factory, **kw):
- """Add and configure a service to the root folder."""
- name = addService(root_folder, service_type, service_factory, **kw)
- configureService(root_folder, service_type, name)
- return name
-
-def addService(root_folder, service_type, service_factory, **kw):
- """Add a service to the root folder.
-
- The service is added to the default package and activated.
- This assumes the root folder already has a service manager,
- and that we add at most one service of each type.
-
- Returns the name of the service implementation in the default package.
- """
- # The code here is complicated by the fact that the registry
- # calls at the end require a fully context-wrapped
- # registration; hence all the traverse() and traverseName() calls.
- package = getServiceManagerDefault(root_folder)
- chooser = INameChooser(package)
- service = service_factory()
- name = chooser.chooseName(service_type, service)
- package[name] = service
-
- # Set additional attributes on the service
- for k, v in kw.iteritems():
- setattr(service, k, v)
- return name
-
-def configureService(root_folder, service_type, name, initial_status=u'Active'):
- """Configure a service in the root folder."""
- package = getServiceManagerDefault(root_folder)
- registration_manager = package.getRegistrationManager()
- registration = ServiceRegistration(service_type,
- package[name],
- registration_manager)
- key = registration_manager.addRegistration(registration)
- registration = traverseName(registration_manager, key)
- registration.status = initial_status
-
def addConfigureUtility(
root_folder, interface, utility_type, utility_factory, name='', **kw):
"""Add and configure a service to the root folder."""
@@ -141,7 +75,7 @@
The utility is added to the default package and activated.
This assumes that the root folder already has a Utility Service.
"""
- package = getServiceManagerDefault(root_folder)
+ package = getSiteManagerDefault(root_folder)
chooser = INameChooser(package)
utility = utility_factory()
name = chooser.chooseName(utility_type, utility)
@@ -155,13 +89,13 @@
root_folder, interface, utility_type, name, folder_name,
initial_status=u'Active'):
"""Configure a utility in the root folder."""
- package = getServiceManagerDefault(root_folder)
- registration_manager = package.getRegistrationManager()
- registration = UtilityRegistration(name, interface, package[folder_name])
- key = registration_manager.addRegistration(registration)
- registration.status = initial_status
+ package = getSiteManagerDefault(root_folder)
+ registration_manager = package.registrationManager
+ reg = site.UtilityRegistration(name, interface, package[folder_name])
+ key = registration_manager.addRegistration(reg)
+ reg.status = initial_status
-def getServiceManagerDefault(root_folder):
+def getSiteManagerDefault(root_folder):
package_name = '/++etc++site/default'
package = traverse(root_folder, package_name)
return package
@@ -182,15 +116,6 @@
root_folder = root.get(ZopePublication.root_name, None)
return db, connection, root, root_folder
-def getServiceManager(root_folder):
- """ Returns the Service Manager from the root_folder object
- """
- try:
- service_manager = traverse(root_folder, '++etc++site')
- except TraversalError:
- service_manager = ServiceManager(root_folder)
- root_folder.setSiteManager(service_manager)
- return service_manager
######################################################################
######################################################################
@@ -199,9 +124,8 @@
"""The actual subscriber to the bootstrap IDataBaseOpenedEvent
Boostrap a Zope3 instance given a database object This first checks if the
- root folder exists and has a service manager. If it exists, nothing else
- is changed. If no root folder exists, one is added, and several essential
- services are added and configured.
+ root folder exists and has a site manager. If it exists, nothing else
+ is changed. If no root folder exists, one is added.
"""
db, connection, root, root_folder = getInformationFromEvent(event)
@@ -212,12 +136,10 @@
# ugh... we depend on the root folder implementation
root_folder = rootFolder()
root[ZopePublication.root_name] = root_folder
- service_manager = getServiceManager(root_folder)
+ if not ISite.providedBy(root_folder):
+ site_manager = site.LocalSiteManager(root_folder)
+ root_folder.setSiteManager(site_manager)
- # Sundry other services
- ensureService(service_manager, root_folder, Utilities,
- LocalUtilityService)
-
get_transaction().commit()
connection.close()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/appsetup/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/appsetup/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/appsetup/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,21 +19,18 @@
from transaction import get_transaction
from ZODB.tests.util import DB
+from zope.app.component.testing import PlacefulSetup
from zope.app.error.error import ErrorReportingUtility
from zope.app.error.interfaces import IErrorReportingUtility
from zope.app.folder import rootFolder
from zope.app.folder.interfaces import IRootFolder
from zope.app.publication.zopepublication import ZopePublication
-from zope.app.servicenames import Utilities
-from zope.app.site.service import ServiceManager
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.site import LocalSiteManager
from zope.app.traversing.api import traverse
-from zope.app.utility.utility import LocalUtilityService
from zope.app.appsetup.bootstrap import bootStrapSubscriber
-from zope.app.appsetup.bootstrap import addService, configureService, \
- ensureService, getInformationFromEvent, getServiceManager, ensureObject,\
- ensureUtility
+from zope.app.appsetup.bootstrap import getInformationFromEvent, \
+ ensureObject, ensureUtility
class EventStub(object):
@@ -41,7 +38,7 @@
self.database = db
#
-# XXX some methods from the boostap modue are not tested
+# TODO: some methods from the boostap modue are not tested
#
class TestBootstrapSubscriber(PlacefulSetup, unittest.TestCase):
@@ -67,8 +64,8 @@
root = cx.root()
self.root_folder = rootFolder()
root[ZopePublication.root_name] = self.root_folder
- self.service_manager = ServiceManager(self.root_folder)
- self.root_folder.setSiteManager(self.service_manager)
+ self.site_manager = LocalSiteManager(self.root_folder)
+ self.root_folder.setSiteManager(self.site_manager)
get_transaction().commit()
cx.close()
@@ -86,16 +83,12 @@
def test_ensureUtility(self):
self.createRFAndSM()
- self.createRootFolder()
db, connection ,root, root_folder = getInformationFromEvent(
EventStub(self.db))
- # XXX check EventSub
+ # TODO: check EventSub
root_folder = self.root_folder
- service_manager = getServiceManager(root_folder)
- ensureService(service_manager, root_folder, Utilities,
- LocalUtilityService)
for i in range(2):
cx = self.db.open()
name = ensureUtility(root_folder, IErrorReportingUtility,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/basicskin/standardmacros.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/basicskin/standardmacros.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/basicskin/standardmacros.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,14 +18,13 @@
$Id$
"""
__docformat__ = 'restructuredtext'
+import zope.interface
-from zope.interface import implements
-from zope.interface.common.mapping import IItemMapping
-from zope.component import getView
+from zope.app import zapi
from zope.app.publisher.browser import BrowserView
class Macros(object):
- implements(IItemMapping)
+ zope.interface.implements(zope.interface.common.mapping.IItemMapping)
macro_pages = ()
aliases = {
@@ -39,7 +38,7 @@
context = self.context
request = self.request
for name in self.macro_pages:
- page = getView(context, name, request)
+ page = zapi.getMultiAdapter((context, request), name=name)
try:
v = page[key]
except KeyError:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/basicskin/tests/test_standardmacros.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/basicskin/tests/test_standardmacros.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/basicskin/tests/test_standardmacros.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,13 +16,13 @@
$Id$
"""
import unittest
-from zope.app.tests import ztapi
-from zope.interface import implements
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.interface import implements, Interface
from zope.publisher.browser import TestRequest
+
+from zope.app.basicskin.standardmacros import Macros
+from zope.app.component.testing import PlacefulSetup
from zope.app.publisher.interfaces.browser import IBrowserView
-from zope.interface import Interface
-from zope.app.basicskin.standardmacros import Macros
+from zope.app.testing import ztapi
class ViewWithMacros(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/cache/interfaces/ram.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/cache/interfaces/ram.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/cache/interfaces/ram.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
from zope.interface import Attribute
from zope.app.cache.interfaces import ICache
-from zope.app.registration.interfaces import IRegisterable
+from zope.app.component.interfaces.registration import IRegisterable
class IRAMCache(ICache, IRegisterable):
"""Interface for the RAM Cache."""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_annotationcacheable.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_annotationcacheable.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_annotationcacheable.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,7 @@
import unittest
from zope.interface import implements
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi, placelesssetup
from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
from zope.app.annotation.attribute import AttributeAnnotations
from zope.app.cache.annotationcacheable import AnnotationCacheable
@@ -38,7 +37,8 @@
self.invalidated.append(obj)
-class TestAnnotationCacheable(PlacelessSetup, unittest.TestCase):
+class TestAnnotationCacheable(placelesssetup.PlacelessSetup,
+ unittest.TestCase):
def setUp(self):
super(TestAnnotationCacheable, self).setUp()
ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_caching.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_caching.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_caching.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,14 +18,13 @@
import unittest
from zope.interface import implements
-from zope.app.tests import ztapi, setup
-from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable
from zope.app.annotation.attribute import AttributeAnnotations
from zope.app.cache.interfaces import ICacheable, ICache
from zope.app.cache.caching import getCacheForObject
from zope.app.cache.annotationcacheable import AnnotationCacheable
+from zope.app.testing import ztapi, setup, placelesssetup
class ObjectStub(object):
implements(IAttributeAnnotatable)
@@ -33,7 +32,7 @@
class CacheStub(object):
implements(ICache)
-class Test(PlacelessSetup, unittest.TestCase):
+class Test(placelesssetup.PlacelessSetup, unittest.TestCase):
def setUp(self):
super(Test, self).setUp()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_ramcache.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_ramcache.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/cache/tests/test_ramcache.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.app.cache.interfaces import ICache
from zope.app.cache.interfaces.ram import IRAMCache
from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
class Locatable(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/catalog/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/catalog/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/catalog/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -195,7 +195,7 @@
... return self.data.iterkeys()
>>> ids = Ids({1: o1, 2: o2, 3: o3, 4: o4, 5: o5, 6: o6})
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(zope.app.intid.interfaces.IIntIds, ids)
With this utility in place, catalogs can recompute indexes:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/catalog/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/catalog/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/catalog/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,8 +25,7 @@
from zope.interface import implements
from zope.interface.verify import verifyObject
-from zope.app.tests import ztapi, setup
-import zope.app.tests.placelesssetup
+from zope.app.testing import ztapi, setup, placelesssetup
from BTrees.IFBTree import IFSet
from zope.app.intid.interfaces import IIntIds
@@ -35,10 +34,6 @@
from zope.app.catalog.catalog import Catalog
from zope.app import zapi
-from zope.app.utility import LocalUtilityService
-from zope.app.servicenames import Utilities
-
-
class ReferenceStub:
def __init__(self, obj):
self.obj = obj
@@ -118,7 +113,7 @@
self.__dict__ = kw
-class Test(zope.app.tests.placelesssetup.PlacelessSetup, unittest.TestCase):
+class Test(placelesssetup.PlacelessSetup, unittest.TestCase):
def test_catalog_add_del_indexes(self):
catalog = Catalog()
@@ -229,10 +224,8 @@
def setUp(self):
self.root = setup.placefulSetUp(True)
- sm = zapi.getServices(self.root)
- setup.addService(sm, Utilities, LocalUtilityService())
- self.utility = setup.addUtility(
- sm, '', IIntIds, IntIdsStub())
+ sm = self.root.getSiteManager()
+ self.utility = setup.addUtility(sm, '', IIntIds, IntIdsStub())
self.cat = setup.addUtility(sm, '', ICatalog, CatalogStub())
def tearDown(self):
@@ -299,8 +292,8 @@
suite.addTest(doctest.DocTestSuite('zope.app.catalog.attribute'))
suite.addTest(doctest.DocFileSuite(
'README.txt',
- setUp=zope.app.tests.placelesssetup.setUp,
- tearDown=zope.app.tests.placelesssetup.tearDown,
+ setUp=placelesssetup.setUp,
+ tearDown=placelesssetup.tearDown,
))
return suite
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -24,20 +24,20 @@
import sys
import zope.app
-from zope.app.component.bbb import registration as bbb_registration
-sys.modules['zope.app.registration'] = bbb_registration
-zope.app.registration = bbb_registration
-from zope.app.component.bbb import localservice
-sys.modules['zope.app.component.localservice'] = localservice
-from zope.app.component.bbb import site
-sys.modules['zope.app.site'] = site
-zope.app.site = site
-from zope.app.component.bbb import adapter as bbb_adapter
-sys.modules['zope.app.adapter'] = bbb_adapter
-zope.app.adapter = bbb_adapter
-from zope.app.component.bbb import utility
-sys.modules['zope.app.utility'] = utility
-zope.app.utility = utility
+#from zope.app.component.bbb import registration as bbb_registration
+#sys.modules['zope.app.registration'] = bbb_registration
+#zope.app.registration = bbb_registration
+#from zope.app.component.bbb import localservice
+#sys.modules['zope.app.component.localservice'] = localservice
+#from zope.app.component.bbb import site
+#sys.modules['zope.app.site'] = site
+#zope.app.site = site
+#from zope.app.component.bbb import adapter as bbb_adapter
+#sys.modules['zope.app.adapter'] = bbb_adapter
+#zope.app.adapter = bbb_adapter
+#from zope.app.component.bbb import utility
+#sys.modules['zope.app.utility'] = utility
+#zope.app.utility = utility
##############################################################################
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/adapter.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/adapter.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/adapter.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,9 +23,7 @@
import zope.schema
from zope.security.proxy import removeSecurityProxy
-import zope.app.component.localservice
import zope.app.container.contained
-import zope.app.site.interfaces
from zope.app import zapi
from zope.app.component import registration
from zope.app.component import interfaces
@@ -96,11 +94,6 @@
self.next = next
self.adaptersChanged()
- def _getKey(self, registration):
- """Return the key of a registration."""
- return (False, registration.with,
- registration.name, registration.provided)
-
def register(self, registration):
"""See zope.app.component.interfaces.registration.IRegistry"""
self._registrations += (registration,)
@@ -138,6 +131,13 @@
"""Used by LocalSurrogate"""
return self.base.get(spec)
+ def _updateAdaptersFromRegistration(self, radapters, registration):
+ """Only to be used by _updateAdaptersFromLocalData, but can be
+ overridden to implement custom behavior."""
+ key = (False, registration.with, registration.name,
+ registration.provided)
+ radapters[key] = removeSecurityProxy(registration.component)
+
def _updateAdaptersFromLocalData(self, adapters):
"""Update all adapter surrogates locally."""
for registration in self._registrations:
@@ -154,8 +154,7 @@
# storing the value amd we can't store proxies.
# (Why can't we?) we need to think more about
# why/if this is truly safe
- key = self._getKey(registration)
- radapters[key] = removeSecurityProxy(registration.component)
+ self._updateAdaptersFromRegistration(radapters, registration)
def adaptersChanged(self):
@@ -173,7 +172,7 @@
# Throw away all of our surrogates, rather than dirtrying
# them individually
super(LocalAdapterRegistry, self).__init__()
-
+
for sub in self.subs:
sub.adaptersChanged()
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/__init__.py (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/__init__.py)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/__init__.py 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,355 @@
+##############################################################################
+#
+# Copyright (c) 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.
+#
+##############################################################################
+"""View support for adding and configuring utilities and adapters.
+
+$Id$
+"""
+from zope.component.interfaces import ISiteManager
+from zope.security.proxy import removeSecurityProxy
+from zope.app import zapi
+from zope.app.container.browser.adding import Adding
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.container.interfaces import INameChooser
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.interfaces.registration import InactiveStatus
+from zope.app.component.interfaces import ILocalUtility
+from zope.app.publisher.browser import BrowserView
+from zope.app.component.interfaces import ISite
+from zope.app.component.site import LocalSiteManager
+from zope.component.exceptions import ComponentLookupError
+from zope.component.interfaces import IFactory
+from zope.interface.interfaces import IMethod
+from zope.schema.interfaces import IField
+from zope.app.interface.interfaces import IInterfaceBasedRegistry
+from zope.app.component.interface import searchInterface
+from zope.app.component.interface import getInterface
+from zope.app.component.interface import provideInterface
+
+class ComponentAdding(Adding):
+ """Adding subclass used for registerable components."""
+
+ menu_id = "add_component"
+
+ def add(self, content):
+ # Override so as to save a reference to the added object
+ self.added_object = super(ComponentAdding, self).add(content)
+ return self.added_object
+
+ def nextURL(self):
+ v = zapi.queryView(
+ self.added_object, "registration.html", self.request)
+ if v is not None:
+ url = str(
+ zapi.getView(self.added_object, 'absolute_url', self.request))
+ return url + "/@@registration.html"
+
+ return super(ComponentAdding, self).nextURL()
+
+ def action(self, type_name, id=''):
+ # For special case of that we want to redirect to another adding view
+ # (usually another menu such as AddUtility)
+ if type_name.startswith("../"):
+ # Special case
+ url = type_name
+ if id:
+ url += "?id=" + id
+ self.request.response.redirect(url)
+ return
+
+ # Call the superclass action() method.
+ # As a side effect, self.added_object is set by add() above.
+ super(ComponentAdding, self).action(type_name, id)
+
+ _addFilterInterface = None
+
+ def addingInfo(self):
+ # A site management folder can have many things. We only want
+ # things that implement a particular interface
+ info = super(ComponentAdding, self).addingInfo()
+ if self._addFilterInterface is None:
+ return info
+ out = []
+ for item in info:
+ extra = item.get('extra')
+ if extra:
+ factoryname = extra.get('factory')
+ if factoryname:
+ factory = zapi.getUtility(IFactory, factoryname)
+ intf = factory.getInterfaces()
+ if not intf.extends(self._addFilterInterface):
+ # We only skip new addMenuItem style objects
+ # that don't implement our wanted interface.
+ continue
+
+ out.append(item)
+
+ return out
+
+
+class UtilityAdding(ComponentAdding):
+ """Adding subclass used for adding utilities."""
+
+ menu_id = None
+ title = _("Add Utility")
+
+ _addFilterInterface = ILocalUtility
+
+ def add(self, content):
+ # Override so as to check the type of the new object.
+ if not ILocalUtility.providedBy(content):
+ raise TypeError("%s is not a local utility" % content)
+ return super(UtilityAdding, self).add(content)
+
+ def nextURL(self):
+ v = zapi.queryView(
+ self.added_object, "addRegistration.html", self.request)
+ if v is not None:
+ url = str(
+ zapi.getView(self.added_object, 'absolute_url', self.request))
+ return url + "/addRegistration.html"
+
+ return super(UtilityAdding, self).nextURL()
+
+
+class MakeSite(BrowserView):
+ """View for converting a possible site to a site."""
+
+ def addSiteManager(self):
+ """Convert a possible site to a site
+
+ >>> from zope.app.traversing.interfaces import IContainmentRoot
+ >>> from zope.interface import implements
+
+ >>> class PossibleSite(object):
+ ... implements(IContainmentRoot)
+ ... def setSiteManager(self, sm):
+ ... from zope.interface import directlyProvides
+ ... directlyProvides(self, ISite)
+
+
+ >>> folder = PossibleSite()
+
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+
+ Now we'll make our folder a site:
+
+ >>> MakeSite(folder, request).addSiteManager()
+
+ Now verify that we have a site:
+
+ >>> ISite.providedBy(folder)
+ 1
+
+ Note that we've also redirected the request:
+
+ >>> request.response.getStatus()
+ 302
+
+ >>> request.response.getHeader('location')
+ '++etc++site/@@SelectedManagementView.html'
+
+ If we try to do it again, we'll fail:
+
+ >>> MakeSite(folder, request).addSiteManager()
+ Traceback (most recent call last):
+ ...
+ UserError: This is already a site
+
+ """
+ if ISite.providedBy(self.context):
+ raise zapi.UserError('This is already a site')
+
+ # We don't want to store security proxies (we can't,
+ # actually), so we have to remove proxies here before passing
+ # the context to the SiteManager.
+ bare = removeSecurityProxy(self.context)
+ sm = LocalSiteManager(bare)
+ self.context.setSiteManager(sm)
+ self.request.response.redirect(
+ "++etc++site/@@SelectedManagementView.html")
+
+
+class Interfaces(object):
+ """Interface service view
+
+ >>> from zope.interface import Interface
+ >>> from zope.app.content.interfaces import IContentType
+ >>> class DCInterface(Interface):
+ ... '''DCInterfaceDoc
+ ...
+ ... This is a multi-line doc string.
+ ... '''
+ ...
+ >>> class DummyInterface(object):
+ ... def items(self):
+ ... return [('DCInterface', DCInterface)]
+ ...
+ >>> provideInterface('', DCInterface, IContentType)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+ >>> interface_view = Interfaces(DummyInterface(), request)
+ >>> from pprint import PrettyPrinter
+ >>> pprint=PrettyPrinter(width=50).pprint
+ >>> pprint(interface_view.getInterfaces())
+ [{'doc': 'DCInterfaceDoc',
+ 'id': 'zope.app.site.browser.DCInterface',
+ 'name': 'DCInterface'}]
+
+
+ """
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def getInterfaces(self):
+ L = [(iface.__name__, iface.__module__+'.'+iface.__name__,
+ getattr(iface, '__doc__', '').split('\n')[0].strip()
+ )
+ for iface in searchInterface(self.context)]
+ L.sort()
+ return [{"id": id, "name": name, "doc": doc} for name, id, doc in L]
+
+class Detail(object):
+ """Interface Details
+
+ >>> from zope.schema import TextLine
+ >>> from zope.interface import Interface
+ >>> from zope.app.content.interfaces import IContentType
+ >>> from zope.i18n import MessageIDFactory
+ >>> from zope.interface.interfaces import IInterface
+ >>> _ = MessageIDFactory('zope')
+ >>> class TestInterface(Interface):
+ ... '''Test Interface'''
+ ... test_field = TextLine(title = _(u'Test Name'))
+ ... def testMethod():
+ ... 'Returns test name'
+ ...
+ >>> class TestClass(object):
+ ... def getInterface(self, id=None):
+ ... return TestInterface
+ ...
+ >>> IInterface.providedBy(TestInterface)
+ True
+ >>> provideInterface('', TestInterface, IContentType)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+ >>> form = {'id': 'zope.app.site.browser.TestInterface'}
+ >>> request.form = form
+ >>> interface_details = Detail(TestClass(), request)
+ >>> interface_details.setup()
+ >>> interface_details.name
+ 'TestInterface'
+ >>> interface_details.doc
+ 'Test Interface'
+ >>> interface_details.iface.__name__
+ 'TestInterface'
+ >>> [method['method'].__name__ for method in
+ ... interface_details.methods]
+ ['testMethod']
+ >>> [field.__name__ for field in interface_details.schema]
+ ['test_field']
+
+ """
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def setup(self):
+ try:
+ id = self.request["id"]
+ except KeyError:
+ raise zapi.UserError("Please click on an interface name to view"
+ " details.")
+
+ iface = getInterface(self.context, id)
+
+ from zope.proxy import getProxiedObject
+ self.iface = getProxiedObject(iface)
+
+ self.name = self.iface.__name__
+ self.doc = getattr(self.iface, '__doc__', '')
+ self.methods = []
+ self.schema = []
+
+ for name in self.iface:
+ defn = self.iface[name]
+ if IMethod.providedBy(defn):
+ title = defn.__doc__.split('\n')[0].strip()
+ self.methods.append({'method': defn, 'title': title})
+ elif IField.providedBy(defn):
+ self.schema.append(defn)
+
+class MethodDetail(object):
+ """Interface Method Details
+
+ >>> from zope.interface import Interface
+ >>> from zope.i18n import MessageIDFactory
+ >>> _ = MessageIDFactory('zope')
+ >>> class TestInterface(Interface):
+ ... '''Test Interface'''
+ ... def testMethod():
+ ... 'Returns test name'
+ ...
+ >>> class TestClass(object):
+ ... def getInterface(self, id=None):
+ ... return TestInterface
+ ...
+ >>> provideInterface('', TestInterface)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+ >>> form = {
+ ... 'interface_id': 'zope.app.site.browser.TestInterface',
+ ... 'method_id': 'testMethod'}
+ >>> request.form = form
+ >>> imethod_details = MethodDetail(TestClass(), request)
+ >>> imethod_details.setup()
+ >>> imethod_details.name
+ 'testMethod'
+ >>> imethod_details.doc
+ 'Returns test name'
+ >>> imethod_details.iface.__name__
+ 'TestInterface'
+ >>> imethod_details.method.__name__
+ 'testMethod'
+
+ """
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def setup(self):
+ try:
+ interface_id = self.request["interface_id"]
+ except KeyError:
+ raise zapi.UserError("Please click on a method name in the Detail"
+ " tab to view method details.")
+ try:
+ method_id = self.request["method_id"]
+ except KeyError:
+ raise zapi.UserError("Please click on a method name to view"
+ " details.")
+
+ iface = getInterface(self.context, interface_id)
+
+ from zope.proxy import getProxiedObject
+ self.iface = getProxiedObject(iface)
+
+ self.method = self.iface[method_id]
+ self.name = self.method.__name__
+ self.doc = self.method.__doc__
+
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/configure.zcml)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/configure.zcml 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,240 @@
+<zope:configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser">
+
+<!-- SiteManagementFolder -->
+
+ <addMenuItem
+ class="zope.app.site.folder.SiteManagementFolder"
+ permission="zope.ManageServices"
+ title="Site-Management Folder"
+ />
+
+ <page
+ for="zope.app.site.interfaces.ISiteManagementFolder"
+ permission="zope.ManageServices"
+ class="zope.app.container.browser.contents.JustContents"
+ name="index.html" attribute="index" />
+
+ <page
+ name="contents.html"
+ for="zope.app.site.interfaces.ISiteManagementFolder"
+ menu="zmi_views" title="Contents"
+ permission="zope.ManageServices"
+ class="zope.app.container.browser.contents.Contents"
+ attribute="contents" />
+
+ <view
+ name="+"
+ menu="zmi_actions" title="Add"
+ for="zope.app.site.interfaces.ISiteManagementFolder"
+ permission="zope.ManageServices"
+ class="zope.app.site.browser.ComponentAdding">
+
+ <page name="index.html" attribute="index" />
+ <page name="action.html" attribute="action" />
+
+ </view>
+
+<!-- For services, just treat @@manage as @@index.html by default -->
+
+ <!-- Get first accessable item from zmi_views menu -->
+ <page
+ for="zope.app.site.interfaces.ILocalService"
+ name="index.html"
+ permission="zope.ManageServices"
+ class="zope.app.publisher.browser.managementviewselector.ManagementViewSelector"
+ allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
+ />
+
+<!-- Service Manager navigation action -->
+
+ <page
+ for="zope.app.site.interfaces.IPossibleSite"
+ name="addServiceManager.html"
+ permission="zope.ManageServices"
+ class=".MakeSite"
+ attribute="addSiteManager"
+ />
+
+ <menuItem
+ menu="zmi_actions" title="Make a site"
+ for="zope.app.site.interfaces.IPossibleSite"
+ action="addServiceManager.html"
+ filter="python:
+ not modules['zope.app.site.interfaces'].ISite.providedBy(context)"
+ permission="zope.ManageServices"
+ />
+
+ <menuItem
+ menu="zmi_actions"
+ title="Manage Site"
+ for="zope.app.site.interfaces.ISite"
+ action="++etc++site/@@SelectedManagementView.html"
+ permission="zope.ManageServices"
+ />
+
+<!-- ServiceManager -->
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="tasks.html"
+ menu="zmi_views" title="Tasks"
+ template="tasks.pt"
+ permission="zope.ManageServices" />
+
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="services.html"
+ menu="zmi_views" title="Services"
+ template="services.pt"
+ class=".ServiceSummary"
+ permission="zope.ManageServices" />
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="serviceActivation.html"
+ template="serviceactivation.pt"
+ class=".ServiceActivation"
+ permission="zope.ManageServices" />
+
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="interfacebrowse.html"
+ template="interfacebrowse.pt"
+ class=".Interfaces"
+ permission="zope.ManageServices"
+ menu="zmi_views" title="Interface Browse"
+ />
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="interfacedetail.html"
+ template="interfacedetail.pt"
+ class=".Detail"
+ permission="zope.ManageServices"
+ />
+
+ <page
+ for="zope.app.site.interfaces.ISiteManager"
+ name="interfacemethoddetail.html"
+ template="interfacemethoddetail.pt"
+ class=".MethodDetail"
+ permission="zope.ManageServices"
+ />
+
+
+ <icon
+ name="zmi_icon"
+ for="zope.app.site.interfaces.ISiteManager"
+ file="service_manager.gif" />
+
+ <menuItems
+ menu="zmi_actions"
+ for="zope.app.site.interfaces.ISiteManager">
+
+ <menuItem
+ title="Visit default folder"
+ action="default/@@SelectedManagementView.html"
+ permission="zope.ManageServices" />
+ <menuItem
+ title="Add service"
+ action="default/AddService"
+ permission="zope.ManageServices" />
+
+ <!-- Does not work -->
+ <!--menuItem
+ title="Add utility"
+ action="default/AddUtility"
+ permission="zope.ManageServices" /-->
+
+ </menuItems>
+
+ <page
+ name="contents.html"
+ for="zope.app.site.interfaces.ISiteManager"
+ menu="zmi_views" title="Software"
+ permission="zope.ManageServices"
+ class="zope.app.container.browser.contents.Contents"
+ attribute="contents" />
+
+ <view
+ name="+"
+ menu="zmi_actions" title="Add Site Management Folder"
+ for="zope.app.site.interfaces.ISiteManager"
+ permission="zope.ManageServices"
+ class="zope.app.container.browser.adding.Adding"
+ >
+
+ <page name="index.html" attribute="index"/>
+ <page name="action.html" attribute="action"/>
+ </view>
+
+ <pages
+ for="zope.app.site.interfaces.ISiteManager"
+ permission="zope.ManageServices"
+ class="zope.app.container.browser.contents.JustContents">
+
+ <page name="index.html" attribute="index" />
+
+ </pages>
+
+<!-- Adapter Registration -->
+
+ <editform
+ schema="..interfaces.IAdapterRegistration"
+ name="index.html"
+ menu="zmi_views"
+ label="Change adapter"
+ permission="zope.ManageServices"
+ />
+
+ <addform
+ schema="..interfaces.IAdapterRegistration"
+ name="AdapterRegistration"
+ content_factory="..site.AdapterRegistration"
+ arguments="provided factoryName"
+ keyword_arguments="required name permission"
+ label="Register an adapter"
+ permission="zope.ManageServices"
+ fields="required provided name permission factoryName"
+ menu="add_registration" title="Adapter Registration"
+ />
+
+<!-- Tools Views -->
+
+ <servicetool
+ title="Service Tools"
+ description="Service tool management."
+ />
+
+ <page
+ name="tools.html"
+ for="zope.app.site.interfaces.ISiteManager"
+ permission="zope.ManageContent"
+ template="tools.pt"
+ menu="zmi_views" title="Tools"
+ class=".tools.ToolsOverview"
+ />
+
+ <page
+ name="tools.html"
+ for="zope.app.utility.interfaces.ILocalUtility"
+ permission="zope.ManageContent"
+ class=".tools.ToolsBacklink"
+ attribute="getLink"
+ menu="zmi_actions" title="Tools"
+ />
+
+ <page
+ name="tools.html"
+ for="zope.app.site.interfaces.ILocalService"
+ permission="zope.ManageContent"
+ class=".tools.ToolsBacklink"
+ attribute="getLink"
+ menu="zmi_actions" title="Tools"
+ />
+
+</zope:configure>
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/meta.zcml (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/meta.zcml)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/meta.zcml 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/meta.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,11 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
+
+ <meta:directive
+ namespace="http://namespaces.zope.org/browser"
+ name="tool"
+ schema=".metadirectives.IUtilityToolDirective"
+ handler=".metaconfigure.tool"/>
+
+</configure>
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metaconfigure.py (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/metaconfigure.py)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/metaconfigure.py 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Configuration handlers for 'tools' directive.
+
+$Id$
+"""
+from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserPublisher
+from zope.app.component.metaconfigure import view, interface as ifaceDirective
+from zope.app.publisher.browser.viewmeta import view as complexView
+
+from zope.component.interfaces import ISiteManager
+from tools import IToolView, IUtilityToolView, IToolType
+from tools import UtilityToolAdding, UtilityToolView
+
+
+def tool(_context, interface, folder="tools", title=None, description=None):
+ name = "manage" + interface.getName() + "Tool.html"
+ addName = "Add" + interface.getName() + "Tool"
+
+ permission = 'zope.ManageContent'
+
+ ifaceDirective(_context, interface, IToolType)
+
+ class_ = type("UtilityToolView for %s" % interface.getName(),
+ (UtilityToolView,),
+ {'interface':interface,
+ 'folder':folder,
+ 'title':title,
+ 'description':description})
+
+ view(_context, [class_], IBrowserRequest, name, [ISiteManager],
+ permission=permission,
+ allowed_interface=[IUtilityToolView, IBrowserPublisher],
+ allowed_attributes=['__call__', '__getitem__'])
+
+ class_ = type("UtilityToolAdding for %s" % interface.getName(),
+ (UtilityToolAdding,),
+ {'_addFilterInterface': interface,
+ 'folder':folder,
+ 'title':'Add %s Tool' % interface.getName()} )
+
+ addView = complexView(_context, ISiteManager, permission, addName,
+ class_=class_)
+ addView.page(_context, 'index.html', 'index')
+ addView.page(_context, 'action.html', 'action')
+
+ addView()
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metadirectives.py (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/metadirectives.py)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/metadirectives.py 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/metadirectives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""`tool` directive for `browser` namespace
+
+$Id$
+"""
+import zope.configuration.fields
+from zope.interface import Interface
+
+
+class IUtilityToolDirective(Interface):
+ """Directive for creating new utility-based tools."""
+ folder = zope.configuration.fields.PythonIdentifier(
+ title=u"Destination Folder",
+ description=u"""Destination Folder in which the tool instances are
+ placed.""",
+ required=False,
+ default=u"tools")
+
+ title = zope.configuration.fields.MessageID(
+ title=u"Title",
+ description=u"""The title of the tool.""",
+ required=False
+ )
+
+ description = zope.configuration.fields.MessageID(
+ title=u"Description",
+ description=u"Narrative description of what the tool represents.",
+ required=False
+ )
+
+ interface = zope.configuration.fields.GlobalInterface(
+ title=u"Interface",
+ description=u"Interface used to filter out the available entries in a \
+ tool",
+ required=True)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_changeregistrations.py (from rev 28760, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration/browser/xxx_tests/test_changeregistrations.py)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_directives.py (from rev 28762, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/xxx_tests/test_directives.py)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_editregistration.py (from rev 28760, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration/browser/xxx_tests/test_editregistration.py)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_registrationview.py (from rev 28760, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration/browser/xxx_tests/test_registrationview.py)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tests/test_toolbacklink.py (from rev 28762, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/xxx_tests/test_toolbacklink.py)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tool.pt (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/tool.pt)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tools.pt (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/tools.pt)
Copied: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tools.py (from rev 28753, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/tools.py)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site/browser/tools.py 2005-01-07 00:05:02 UTC (rev 28753)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/tools.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -0,0 +1,245 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Tools View
+
+$Id$
+"""
+from zope.interface import implements, Attribute
+from zope.interface.interfaces import IInterface
+from zope.app.pagetemplate.simpleviewclass import simple as SimpleView
+from zope.app.publisher.interfaces.browser import IBrowserView
+from zope.app import zapi
+from zope.app.copypastemove import rename
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+#from zope.app.component.browser import AddRegistration
+from zope.app.component.browser import ComponentAdding
+from zope.app.component.site import UtilityRegistration
+from zope.app.component.site import SiteManagementFolder
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.interfaces.registration import InactiveStatus
+
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+
+class IToolType(IInterface):
+ """Interfaces implementing the tool type are considered tools."""
+
+class IToolView(IBrowserView):
+
+ title = Attribute("Title for the view.")
+ description = Attribute("Description for the view.")
+
+ def update(self):
+ """Update the data."""
+
+ def getComponents(self):
+ """Return a list of components."""
+
+
+class IUtilityToolView(IToolView):
+
+ interface = Attribute("Interface the utility provides.")
+
+
+class ToolsOverview(object):
+ def getTools(self):
+ tools = []
+ for n, iface in zapi.getUtilitiesFor(IToolType):
+ name = iface.getName()
+ view = zapi.getView(self.context, 'manage%sTool.html' % name,
+ self.request)
+ tools.append({'title':view.title,
+ 'description':view.description,
+ 'action':'./@@manage%sTool.html' % name })
+ tools.sort(lambda x, y: cmp(x['title'], y['title']))
+ return tools
+
+class ToolsBacklink(object):
+ def getLink(self):
+ sm = zapi.getSiteManager()
+ iface = zapi.queryType(self.context, IToolType)
+ url = '%s/manage%sTool.html' %(zapi.getPath(sm), iface.getName())
+
+ return self.request.response.redirect(url)
+
+class AbstractToolView(SimpleView):
+ """Abstract tools view."""
+
+ index = ViewPageTemplateFile('tool.pt')
+
+ title = None
+ description = None
+
+ can_rename = False
+
+ def update(self):
+ status = ''
+ self.renameList = []
+
+ has_key = self.request.form.has_key
+ selected = self.request.form.get('selected', [])
+ doAdd = has_key('ADD')
+ doDelete = has_key('DELETE')
+ doRename = has_key('RENAME')
+ applyRename = has_key('APPLY_RENAME')
+ doActivate = has_key('ACTIVATE')
+ doDeactivate = has_key('DEACTIVATE')
+
+ if doAdd:
+ self.add()
+ elif not selected:
+ if (doDelete or doRename or applyRename
+ or doActivate or doDeactivate):
+ status = _('Please select at least one checkbox')
+ elif doDelete:
+ self.delete()
+ status = _('Deleted selected tools.')
+ elif doRename:
+ self.renameList = selected
+ elif applyRename:
+ self.rename()
+ status = _('Renamed selected tools.')
+ elif doActivate:
+ self.activate()
+ status = _('Activated registrations.')
+ elif doDeactivate:
+ self.deactivate()
+ status = _('Deactivated registrations.')
+
+ return status
+
+
+class UtilityToolView(AbstractToolView):
+ """Tools view for utilities."""
+
+ implements(IUtilityToolView)
+
+ can_rename = True
+
+ def delete(self):
+ for name in self.request.form['selected']:
+ utils = zapi.getService(Utilities)
+ reg = utils.queryRegistrations(name, self.interface)
+
+ del_objs = []
+
+ # Delete registrations
+ for info in reg.info():
+ conf = info['registration']
+ obj = conf.component
+ conf.status = UnregisteredStatus
+ reg_folder = zapi.getParent(conf)
+ name = zapi.name(conf)
+ del reg_folder[name]
+ if obj not in [c.component
+ for c in reg_folder.values()]:
+ del_objs.append(obj)
+
+ # Delete object, if no other registration is available.
+ for obj in del_objs:
+ parent = zapi.getParent(obj)
+ name = zapi.name(obj)
+ del parent[name]
+
+ def rename(self):
+ for name in self.request.form['old_names']:
+ newname = self.request.form['new_names'][
+ self.request.form['old_names'].index(name)]
+
+ utils = zapi.getService('Utilities')
+ reg = utils.queryRegistrations(name, self.interface)
+
+ # Rename registrations
+ for info in reg.info():
+ conf = info['registration']
+ orig_status = conf.status
+ conf.status = UnregisteredStatus
+ conf.name = newname
+ conf.status = orig_status
+
+ def activate(self):
+ for name in self.request.form['selected']:
+ utils = zapi.getService('Utilities')
+ reg = utils.queryRegistrations(name, self.interface)
+
+ # Activate registrations
+ for info in reg.info():
+ conf = info['registration']
+ conf.status = ActiveStatus
+
+ def deactivate(self):
+ for name in self.request.form['selected']:
+ utils = zapi.getService('Utilities')
+ reg = utils.queryRegistrations(name, self.interface)
+
+ # Deactivate registrations
+ for info in reg.info():
+ conf = info['registration']
+ conf.status = RegisteredStatus
+
+ def add(self):
+ self.request.response.redirect('./Add%sTool' %
+ self.interface.getName())
+
+ def getComponents(self):
+ utils = zapi.getService(Utilities)
+ items = []
+ for registration in [reg for reg in utils.registrations(localOnly=True)
+ if reg.provided == self.interface]:
+
+ stack = utils.queryRegistrationsFor(registration)
+ parent = zapi.getParent(registration.component)
+ items.append({
+ 'name': registration.name,
+ 'url': zapi.getPath(registration.component),
+ 'parent_url': zapi.getPath(parent),
+ 'parent_name': zapi.name(parent),
+ 'active': stack.active()})
+
+ return items
+
+
+class UtilityToolAdding(ComponentAdding):
+ """Adding subclass used for adding utilities."""
+
+ menu_id = None
+ title = "Add Tool"
+ folder = "tools"
+ _addFilterInterface = None
+
+
+ def addingInfo(self):
+ if self.folder not in self.context:
+ self.context[self.folder] = SiteManagementFolder()
+ self.context = self.context[self.folder]
+ return super(UtilityToolAdding, self).addingInfo()
+
+ def add(self, content):
+ if not self._addFilterInterface.providedBy(content):
+ raise TypeError("%s is not a %s" %(
+ content, self._addFilterInterface.getName()))
+ self.context = self.context[self.folder]
+ util = super(UtilityToolAdding, self).add(content)
+
+ # Add registration
+ registration = UtilityRegistration(self.contentName,
+ self._addFilterInterface,
+ util)
+ reg_view = AddRegistration(util, self.request)
+ reg_view.add(registration)
+
+ return util
+
+ def nextURL(self):
+ return '../@@manage%sTool.html' %self._addFilterInterface.getName()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/fields.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/fields.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/fields.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -81,7 +81,7 @@
Test 3: Get the layer from the utility service
----------------------------------------------
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(ILayer, layer1, 'layer1')
>>> field.fromUnicode('layer1') is layer1
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/site.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/site.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/site.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,6 +30,7 @@
import zope.interface
import zope.component
from zope.component.exceptions import ComponentLookupError
+from zope.security.proxy import removeSecurityProxy
from zope.app import zapi
from zope.app.component import adapter
@@ -98,12 +99,31 @@
# we're the root site, return None
return None
- site = zapi.getParent(site)
+ try:
+ site = zapi.getParent(site)
+ except TypeError:
+ # there was not enough context; probably run from a test
+ return None
if interfaces.ISite.providedBy(site):
return site.getSiteManager()
-
+
+class LocalUtilityRegistry(adapter.LocalAdapterRegistry):
+ """Custom local adapter registry for utilities, since utilities do not
+ just register themselves as null adapters, but also as subscribers."""
+
+ def _updateAdaptersFromRegistration(self, radapters, registration):
+ # Register as null adapter
+ key = (False, registration.with, registration.name,
+ registration.provided)
+ radapters[key] = removeSecurityProxy(registration.component)
+ # Register as subscriber
+ key = (True, registration.with, '', registration.provided)
+ radapters[key] = radapters.get(key, ()) + (
+ removeSecurityProxy(registration.component), )
+
+
class LocalSiteManager(BTreeContainer,
zope.component.site.SiteManager):
"""Local Site Manager implementation"""
@@ -127,7 +147,7 @@
# Set up adapter registries
gsm = zapi.getGlobalSiteManager()
self.adapters = adapter.LocalAdapterRegistry(gsm.adapters)
- self.utilities = adapter.LocalAdapterRegistry(gsm.utilities)
+ self.utilities = LocalUtilityRegistry(gsm.utilities)
# Setup located registry attributes
next = _findNextSiteManager(site)
@@ -286,8 +306,9 @@
return current.getSiteManager()
current = getattr(current, '__parent__', None)
if current is None:
- raise ComponentLookupError(
- "Could not adapt %r to ISiteManager" %ob)
+ # It is not a location or has no parent, so we return the global
+ # site manager
+ return zapi.getGlobalSiteManager()
def threadSiteSubscriber(event):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/testing.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/testing.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/testing.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,6 +15,8 @@
$Id$
"""
+import zope.interface
+from zope.component.interfaces import ISiteManager
from zope.app import zapi
from zope.app.testing import setup
from zope.app.testing.placelesssetup import PlacelessSetup
@@ -71,19 +73,32 @@
def makeSite(self, path='/'):
folder = zapi.traverse(self.rootFolder, path)
- return setup.createServiceManager(folder, True)
+ return setup.createSiteManager(folder, True)
def createRootFolder(self):
self.rootFolder = rootFolder()
- def createStandardServices(self):
- '''Create a bunch of standard placeful services'''
- setup.createStandardServices(self.rootFolder)
+class SiteManagerStub(object):
+ zope.interface.implements(ISiteManager)
+
+ next = None
+ def __init__(self):
+ self._utils = {}
+ def setNext(self, next):
+ self.next = next
+
+ def provideUtility(self, iface, util, name=''):
+ self._utils[(iface, name)] = util
+
+ def queryUtility(self, iface, name='', default=None):
+ return self._utils.get((iface, name), default)
+
+
def testingNextUtility(utility, nextutility, interface, name='',
- service=None, nextservice=None):
+ sitemanager=None, nextsitemanager=None):
"""Provide a next utility for testing.
Since utilities must be registered in services, we really provide a next
@@ -138,16 +153,15 @@
True
"""
- UtilityService = type('UtilityService', (GlobalUtilityService,),
- {'__parent__': None})
- if service is None:
- service = UtilityService()
- if nextservice is None:
- nextservice = UtilityService()
- from zope.app.component.localservice import testingNextService
- testingNextService(service, nextservice, zapi.servicenames.Utilities)
+ if sitemanager is None:
+ sitemanager = SiteManagerStub()
+ if nextsitemanager is None:
+ nextsitemanager = SiteManagerStub()
+ sitemanager.setNext(nextsitemanager)
- service.provideUtility(interface, utility, name)
- utility.__parent__ = service
- nextservice.provideUtility(interface, nextutility, name)
- nextutility.__parent__ = nextservice
+ sitemanager.provideUtility(interface, utility, name)
+ utility.__conform__ = \
+ lambda iface: iface.isOrExtends(ISiteManager) and sitemanager or None
+ nextsitemanager.provideUtility(interface, nextutility, name)
+ nextutility.__conform__ = \
+ lambda iface: iface.isOrExtends(ISiteManager) and nextsitemanager or None
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_contentdirective.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_contentdirective.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_contentdirective.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
from zope.component.interfaces import IFactory
from zope.component.exceptions import ComponentLookupError
from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.component.interface import queryInterface
# explicitly import ExampleClass and IExample using full paths
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -39,7 +39,7 @@
from zope.component.exceptions import ComponentLookupError
from zope.app import zapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.component.metaconfigure import interface
from zope.app.component.tests.views import IV, IC, V1, VZMI, R1, RZMI, IR
from zope.app.content.interfaces import IContentType
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_fields.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_fields.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_fields.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
def test_suite():
return unittest.TestSuite((
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_site.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_site.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_site.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,8 +22,9 @@
from zope.testing import doctest
from zope.app.testing import setup
-from zope.app.component import interfaces
+from zope.app.component import interfaces, site
from zope.app.folder import folder
+import zope.app.publication.interfaces
class SiteManagerStub(object):
zope.interface.implements(interfaces.ILocalSiteManager)
@@ -126,6 +127,40 @@
True
"""
+class BaseTestSiteManagerContainer(unittest.TestCase):
+ """This test is for objects that don't have site managers by
+ default and that always give back the site manager they were
+ given.
+
+ Subclasses need to define a method, 'makeTestObject', that takes no
+ arguments and that returns a new site manager
+ container that has no site manager."""
+
+ def test_IPossibleSite_verify(self):
+ zope.interface.verify.verifyObject(interfaces.IPossibleSite,
+ self.makeTestObject())
+
+ def test_get_and_set(self):
+ smc = self.makeTestObject()
+ self.failIf(interfaces.ISite.providedBy(smc))
+ sm = site.LocalSiteManager(smc)
+ smc.setSiteManager(sm)
+ self.failUnless(interfaces.ISite.providedBy(smc))
+ self.failUnless(smc.getSiteManager() is sm)
+ zope.interface.verify.verifyObject(interfaces.ISite, smc)
+
+ def test_set_w_bogus_value(self):
+ smc=self.makeTestObject()
+ self.assertRaises(Exception, smc.setSiteManager, self)
+
+
+
+class SiteManagerContainerTest(BaseTestSiteManagerContainer):
+ def makeTestObject(self):
+ from zope.app.component.site import SiteManagerContainer
+ return SiteManagerContainer()
+
+
def setUp(test):
setup.placefulSetUp()
@@ -135,6 +170,7 @@
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
+ unittest.makeSuite(SiteManagerContainerTest),
doctest.DocFileSuite('../site.txt',
setUp=setUp, tearDown=tearDown),
))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/browser/adding.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/browser/adding.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/browser/adding.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -78,7 +78,8 @@
def nextURL(self):
"""See zope.app.container.interfaces.IAdding"""
- return (str(zapi.getView(self.context, "absolute_url", self.request))
+ return (str(
+ zapi.getMultiAdapter((self.context, self.request), "absolute_url"))
+ '/@@contents.html')
# set in BrowserView.__init__
@@ -98,14 +99,14 @@
if view_name.startswith('@@'):
view_name = view_name[2:]
- return zapi.getView(self, view_name, request)
+ return zapi.getMultiAdapter((self, request), name=view_name)
if name.startswith('@@'):
view_name = name[2:]
else:
view_name = name
- view = zapi.queryView(self, view_name, request)
+ view = zapi.queryMultiAdapter((self, request), name=view_name)
if view is not None:
return view
@@ -127,9 +128,10 @@
else:
view_name = type_name
- if zapi.queryView(self, view_name, self.request) is not None:
+ if zapi.queryMultiAdapter((self, self.request),
+ name=view_name) is not None:
url = "%s/%s=%s" % (
- zapi.getView(self, "absolute_url", self.request),
+ zapi.getMultiAdapter((self, self.request), name="absolute_url"),
type_name, id)
self.request.response.redirect(url)
return
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/browser/contents.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/browser/contents.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -156,7 +156,7 @@
info['retitle'] = id == retitle_id
- zmi_icon = zapi.queryView(obj, 'zmi_icon', self.request)
+ zmi_icon = zapi.queryMultiAdapter((obj, self.request), name='zmi_icon')
if zmi_icon is None:
info['icon'] = None
else:
@@ -221,7 +221,7 @@
def hasAdding(self):
"""Returns true if an adding view is available."""
- adding = zapi.queryView(self.context, "+", self.request)
+ adding = zapi.queryMultiAdapter((self.context, self.request), name="+")
return (adding is not None)
def addObject(self):
@@ -231,7 +231,7 @@
else:
new = request["new_value"]
- adding = zapi.queryView(self.context, "+", request)
+ adding = zapi.queryMultiAdapter((self.context, self.request), name="+")
if adding is None:
adding = Adding(self.context, request)
else:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_adding.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_adding.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_adding.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -28,8 +28,8 @@
from zope.testing.doctestunit import DocTestSuite
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup, setUp, tearDown
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup, setUp, tearDown
from zope.app.traversing.browser import AbsoluteURL
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.exception.interfaces import UserError
@@ -80,8 +80,8 @@
if IContainmentRoot.providedBy(self.context):
return ''
name = self.context.__name__
- url = str(zapi.getView(
- zapi.getParent(self.context), 'absolute_url', self.request))
+ url = str(zapi.getMultiAdapter(
+ (zapi.getParent(self.context), self.request), name='absolute_url'))
url += '/' + name
return url
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_contents.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_contents.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,27 +16,23 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.tests import ztapi
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.copypastemove.interfaces import IObjectMover
-
-from zope.app.traversing.api import traverse
-from zope.app.copypastemove.interfaces import IObjectMover, IObjectCopier
-
-from zope.app.copypastemove import ObjectMover, ObjectCopier
-
-from zope.app.container.interfaces import IObjectRemovedEvent
from zope.interface import Interface, implements
-from zope.app.copypastemove.interfaces import IPrincipalClipboard
+from zope.app.annotation.interfaces import IAnnotations
+from zope.app.component.testing import PlacefulSetup
+from zope.app.container.contained import contained
+from zope.app.container.interfaces import IObjectRemovedEvent
+from zope.app.copypastemove import ObjectMover, ObjectCopier
from zope.app.copypastemove import PrincipalClipboard
-from zope.component import getGlobalServices
+from zope.app.copypastemove.interfaces import IObjectMover, IObjectCopier
+from zope.app.copypastemove.interfaces import IPrincipalClipboard
from zope.app.principalannotation import PrincipalAnnotationUtility
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-from zope.app.annotation.interfaces import IAnnotations
-from zope.app.container.contained import contained
+from zope.app.testing import ztapi
+from zope.app.traversing.api import traverse
+
class BaseTestContentsBrowserView(PlacefulSetup):
"""Base class for testing browser contents.
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_directive.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_directive.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/browser/tests/test_directive.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -63,8 +63,7 @@
<InterfaceClass zope.app.menus.zmi_views>,
u'Contents'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.menus.zmi_views>,
@@ -124,8 +123,7 @@
<InterfaceClass zope.app.menus.zmi_actions>,
u'Add'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.menus.zmi_actions>,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/contained.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/contained.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/contained.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -142,7 +142,7 @@
Now we'll register it:
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.handle([None, IObjectMovedEvent], handler)
We also register our dispatcher:
@@ -375,7 +375,7 @@
>>> from zope.app.container.interfaces import IObjectAddedEvent
>>> from zope.app.container.interfaces import IObjectMovedEvent
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.handle([IItem, IObjectAddedEvent],
... lambda obj, event: obj.setAdded(event))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_btree.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_btree.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_btree.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
from unittest import TestCase, main, makeSuite, TestSuite
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing import placelesssetup
from test_icontainer import TestSampleContainer
class TestBTreeContainer(TestSampleContainer, TestCase):
@@ -31,7 +31,8 @@
return TestSuite((
makeSuite(TestBTreeContainer),
DocTestSuite('zope.app.container.btree',
- setUp=setUp, tearDown=tearDown),
+ setUp=placelesssetup.setUp,
+ tearDown=placelesssetup.tearDown),
))
if __name__=='__main__':
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_contained.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_contained.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_contained.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -11,6 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+"""Contained Tests
+
+$Id$
+"""
import unittest
import gc
from ZODB.DemoStorage import DemoStorage
@@ -21,8 +25,8 @@
import zope.interface
from zope.testing import doctest
-from zope.app.tests.placelesssetup import setUp, tearDown
from zope.app.container.contained import ContainedProxy
+from zope.app.testing import placelesssetup
class MyOb(Persistent):
pass
@@ -290,7 +294,8 @@
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite('zope.app.container.contained',
- setUp=setUp, tearDown=tearDown),
+ setUp=placelesssetup.setUp,
+ tearDown=placelesssetup.tearDown),
doctest.DocTestSuite(optionflags=doctest.NORMALIZE_WHITESPACE),
))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_containertraverser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_containertraverser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_containertraverser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,7 @@
import unittest
from zope.app.container.traversal import ContainerTraverser
from zope.app.container.interfaces import IReadContainer
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi, placelesssetup
from zope.publisher.interfaces import NotFound
from zope.publisher.browser import TestRequest
from zope.interface import implements
@@ -42,7 +41,7 @@
self.request = request
-class TraverserTest(PlacelessSetup, unittest.TestCase):
+class TraverserTest(placelesssetup.PlacelessSetup, unittest.TestCase):
# The following two methods exist, so that other container traversers can
# use these tests as a base.
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_icontainer.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_icontainer.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_icontainer.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,16 +16,17 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
+
+from zope.interface.verify import verifyObject
from zope.app.container.interfaces import IContainer
-from zope.interface.verify import verifyObject
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import placelesssetup
def DefaultTestData():
return [('3', '0'), ('2', '1'), ('4', '2'), ('6', '3'), ('0', '4'),
('5', '5'), ('1', '6'), ('8', '7'), ('7', '8'), ('9', '9')]
-class BaseTestIContainer(PlacelessSetup):
+class BaseTestIContainer(placelesssetup.PlacelessSetup):
"""Base test cases for containers.
Subclasses must define a makeTestObject that takes no
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectcopier.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectcopier.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectcopier.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,11 +16,12 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
+
+from zope.app.component.testing import PlacefulSetup
+from zope.app.copypastemove import ObjectCopier
+from zope.app.copypastemove.interfaces import IObjectCopier
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import ztapi
-from zope.app.copypastemove.interfaces import IObjectCopier
-from zope.app.copypastemove import ObjectCopier
class File(object):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectmover.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectmover.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_objectmover.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,11 +17,11 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
+from zope.app.component.testing import PlacefulSetup
+from zope.app.copypastemove import ObjectMover
+from zope.app.copypastemove.interfaces import IObjectMover
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import ztapi
-from zope.app.copypastemove.interfaces import IObjectMover
-from zope.app.copypastemove import ObjectMover
class File(object):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_ordered.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_ordered.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/tests/test_ordered.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,20 +13,19 @@
##############################################################################
"""Test the OrderedContainer.
-
$Id$
"""
-
import unittest
-from zope.interface import *
+
from zope.testing.doctestunit import DocTestSuite
from zope.interface import Interface
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing import placelesssetup
def test_suite():
suite = unittest.TestSuite()
suite.addTest(DocTestSuite("zope.app.container.ordered",
- setUp=setUp, tearDown=tearDown))
+ setUp=placelesssetup.setUp,
+ tearDown=placelesssetup.tearDown))
return suite
Modified: Zope3/branches/srichter-blow-services/src/zope/app/container/traversal.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/container/traversal.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/container/traversal.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -46,7 +46,7 @@
"""See zope.publisher.interfaces.IPublishTraverse"""
subob = self.context.get(name, None)
if subob is None:
- view = zapi.queryView(self.context, name, request)
+ view = zapi.queryMultiAdapter((self.context, request), name=name)
if view is not None:
return view
@@ -72,7 +72,7 @@
try:
return self.context[name]
except KeyError:
- view = zapi.queryView(self.context, name, request)
+ view = zapi.queryMultiAdapter((self.context, request), name=name)
if view is not None:
return view
Modified: Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_clipboard.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_clipboard.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_clipboard.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.principalannotation import PrincipalAnnotationUtility
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.app.annotation.interfaces import IAnnotations
Modified: Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_rename.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_rename.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/copypastemove/tests/test_rename.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,12 +18,12 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests.placelesssetup import setUp, tearDown
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import setUp, tearDown
+from zope.app.testing import ztapi
from zope.exceptions import NotFoundError, DuplicationError
from zope.app.traversing.api import traverse
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.container.interfaces import IContainer
from zope.app.copypastemove.interfaces import IObjectMover
from zope.app.copypastemove import ObjectMover
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/propfind.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/propfind.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -66,8 +66,8 @@
self.request.response.setStatus(400)
return ''
- resource_url = str(zapi.getView(self.context, 'absolute_url',
- self.request))
+ resource_url = str(zapi.getMultiAdapter((self.context, self.request),
+ name='absolute_url'))
if IReadContainer.providedBy(self.context):
resource_url += '/'
@@ -101,7 +101,7 @@
return
subdepth = (depth == '1') and '0' or 'infinity'
for id, obj in self.context.items():
- pfind = zapi.queryView(obj, 'PROPFIND', self.request, None)
+ pfind = zapi.queryMultiAdapter((obj, self.request), name='PROPFIND')
if pfind is None:
continue
pfind.setDepth(subdepth)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/proppatch.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/proppatch.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/proppatch.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -59,8 +59,8 @@
self.request.response.setStatus(400)
return ''
- resource_url = str(zapi.getView(self.context, 'absolute_url',
- self.request))
+ resource_url = str(zapi.getMultiAdapter((self.context, self.request),
+ name='absolute_url'))
if IReadContainer.providedBy(self.context):
resource_url += '/'
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_adapter.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_adapter.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_adapter.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
from zope.interface import Interface, implements
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import setUp, tearDown
from zope.app.size.interfaces import ISized
from zope.app.filerepresentation.interfaces import IReadDirectory
from zope.app.i18n import ZopeMessageIDFactory as _
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,7 @@
from zope.interface import Interface
from zope.app import zapi
-from zope.app.servicenames import Utilities
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.dav.interfaces import IDAVNamespace
import zope.app.dav.tests
@@ -34,10 +33,10 @@
class DirectivesTest(PlacelessSetup, unittest.TestCase):
def test_provideInterface(self):
- utils = zapi.getGlobalService(Utilities)
- self.assertEqual(utils.queryUtility(IDAVNamespace, ns), None)
+ sm = zapi.getGlobalSiteManager()
+ self.assertEqual(sm.queryUtility(IDAVNamespace, ns), None)
self.context = xmlconfig.file("dav.zcml", zope.app.dav.tests)
- self.assertEqual(utils.queryUtility(IDAVNamespace, ns), ISchema)
+ self.assertEqual(sm.queryUtility(IDAVNamespace, ns), ISchema)
def test_suite():
return unittest.TestSuite((
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_mkcol.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_mkcol.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_mkcol.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,9 +16,9 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.container.interfaces import IWriteContainer
from zope.app.filerepresentation.interfaces import IWriteDirectory
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_propfind.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_propfind.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_propfind.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -29,12 +29,12 @@
from zope.schema.interfaces import IText, ITextLine, IDatetime, ISequence
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
from zope.app.container.interfaces import IReadContainer
from zope.publisher.browser import TestRequest
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.traversing.browser import AbsoluteURL
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
@@ -111,12 +111,12 @@
ZDCAnnotatableAdapter)
ztapi.provideAdapter(IAnnotatable, IDAVOpaqueNamespaces,
DAVOpaqueNamespacesAdapter)
- utils = zapi.getGlobalService('Utilities')
+ sm = zapi.getGlobalSiteManager()
directlyProvides(IDAVSchema, IDAVNamespace)
- utils.provideUtility(IDAVNamespace, IDAVSchema, 'DAV:')
+ sm.provideUtility(IDAVNamespace, IDAVSchema, 'DAV:')
directlyProvides(IZopeDublinCore, IDAVNamespace)
- utils.provideUtility(IDAVNamespace, IZopeDublinCore,
- 'http://www.purl.org/dc/1.1')
+ sm.provideUtility(IDAVNamespace, IZopeDublinCore,
+ 'http://www.purl.org/dc/1.1')
def test_contenttype1(self):
file = self.file
@@ -226,7 +226,8 @@
''' % req
request = _createRequest(body=body, headers={
'Content-type': 'text/xml', 'Depth': depth})
- resource_url = str(zapi.getView(obj, 'absolute_url', request))
+ resource_url = str(zapi.getMultiAdapter((obj, request),
+ name='absolute_url'))
if IReadContainer.providedBy(obj):
resource_url += '/'
if resp is None:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_proppatch.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_proppatch.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dav/tests/test_proppatch.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,11 +30,11 @@
from ZODB.tests.util import DB
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
from zope.publisher.browser import TestRequest
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.traversing.browser import AbsoluteURL
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
@@ -158,14 +158,14 @@
ztapi.provideAdapter(IAnnotatable, IDAVOpaqueNamespaces,
DAVOpaqueNamespacesAdapter)
ztapi.provideAdapter(IAnnotatable, ITestSchema, TestSchemaAdapter)
- utils = zapi.getGlobalService('Utilities')
+ sm = zapi.getGlobalSiteManager()
directlyProvides(IDAVSchema, IDAVNamespace)
- utils.provideUtility(IDAVNamespace, IDAVSchema, 'DAV:')
+ sm.provideUtility(IDAVNamespace, IDAVSchema, 'DAV:')
directlyProvides(IZopeDublinCore, IDAVNamespace)
- utils.provideUtility(IDAVNamespace, IZopeDublinCore,
+ sm.provideUtility(IDAVNamespace, IZopeDublinCore,
'http://www.purl.org/dc/1.1')
directlyProvides(ITestSchema, IDAVNamespace)
- utils.provideUtility(IDAVNamespace, ITestSchema, TestURI)
+ sm.provideUtility(IDAVNamespace, ITestSchema, TestURI)
self.db = DB()
self.conn = self.db.open()
root = self.conn.root()
@@ -234,7 +234,8 @@
def _checkProppatch(self, obj, ns=(), set=(), rm=(), extra='', expect=''):
request = _createRequest(namespaces=ns, set=set, remove=rm,
extra=extra)
- resource_url = str(zapi.getView(obj, 'absolute_url', request))
+ resource_url = str(
+ zapi.getMultiAdapter((obj, request), name='absolute_url'))
expect = '''<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:"><response>
<href>%%(resource_url)s</href>
Modified: Zope3/branches/srichter-blow-services/src/zope/app/demo/insensitivefolder/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/demo/insensitivefolder/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/demo/insensitivefolder/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -36,7 +36,7 @@
"""See zope.publisher.interfaces.browser.IBrowserPublisher"""
subob = self._guessTraverse(name)
if subob is None:
- view = zapi.queryView(self.context, name, request)
+ view = zapi.queryMultiAdapter((self.context, request), name=name)
if view is not None:
return view
Modified: Zope3/branches/srichter-blow-services/src/zope/app/demo/jobboard/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/demo/jobboard/browser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/demo/jobboard/browser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,7 @@
>>> from job import JobList
>>> from zope.publisher.browser import TestRequest
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> class TestJobList:
... context = None
@@ -68,7 +68,7 @@
>>> from job import JobList
>>> from zope.publisher.browser import TestRequest
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>>
>>> request = TestRequest(form={'1':'approve','2':'discard'})
Modified: Zope3/branches/srichter-blow-services/src/zope/app/demo/pageletchooser/adapters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/demo/pageletchooser/adapters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/demo/pageletchooser/adapters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""PageletChooser Demo
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -44,7 +44,7 @@
>>> from zope.interface import directlyProvides
>>> from zope.interface import Interface
- >>> from zope.app.tests import placelesssetup, ztapi
+ >>> from zope.app.testing import placelesssetup, ztapi
>>> from zope.app.annotation.interfaces import IAnnotations
>>> from zope.app.annotation.interfaces import IAttributeAnnotatable
>>> from zope.app.annotation.attribute import AttributeAnnotations
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dependable/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dependable/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dependable/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
class C(object):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dtmlpage/tests/test_dtmlpage.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dtmlpage/tests/test_dtmlpage.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dtmlpage/tests/test_dtmlpage.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,10 +19,10 @@
from zope.security.checker import NamesChecker, defineChecker
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.traversing.adapters import Traverser, DefaultTraversable
from zope.app.traversing.interfaces import ITraverser, ITraversable
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.container.contained import contained
from zope.app.dtmlpage.dtmlpage import DTMLPage
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_creatorannotator.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_creatorannotator.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_creatorannotator.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,11 +16,11 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.testing.cleanup import CleanUp
from zope.interface import Interface, implements
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.dublincore.creatorannotator import CreatorAnnotator
from zope.app.dublincore.interfaces import IZopeDublinCore
Modified: Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,11 +15,10 @@
$Id$
"""
-
import unittest
from zope.app.annotation.interfaces import IAnnotations
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.interface import implements
class TestAnnotations(dict):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/error/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/error/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/error/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
from zope.exceptions.exceptionformatter import format_exception
from zope.publisher.tests.httprequest import TestRequest
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.error.error import ErrorReportingUtility
Modified: Zope3/branches/srichter-blow-services/src/zope/app/event/dispatching.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/event/dispatching.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/event/dispatching.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
So, to subscribe to an event, use a subscription adapter to ``None``:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> class E1(object):
@@ -34,7 +34,7 @@
>>> def handler2(event):
... called.append(2)
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.interface import implementedBy
>>> ztapi.handle([implementedBy(E1)], handler1)
>>> ztapi.handle([implementedBy(E2)], handler2)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/event/tests/test_objectevent.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/event/tests/test_objectevent.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/event/tests/test_objectevent.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -27,8 +27,8 @@
from zope.app.container.interfaces import IContained, IObjectRemovedEvent
from zope.app.container.interfaces import IObjectEvent
from zope.app.container.sample import SampleContainer
-from zope.app.tests.placelesssetup import setUp, tearDown
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import setUp, tearDown
+from zope.app.testing import ztapi
class TestObjectModifiedEvent(unittest.TestCase):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/exception/browser/tests/test_unauthorized.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/exception/browser/tests/test_unauthorized.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/exception/browser/tests/test_unauthorized.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,11 +19,11 @@
from zope.interface import implements
from zope.publisher.browser import TestRequest
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.security.interfaces import IAuthenticationUtility, IPrincipal
from zope.app.container.contained import contained
from zope.app.exception.browser.unauthorized import Unauthorized
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
class Unauthorized(Unauthorized):
"""Unusually done by ZCML."""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/browser/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/browser/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/browser/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,7 @@
response = request.response
r = []
- url = zapi.getView(context, 'absolute_url', request)()
+ url = zapi.getMultiAdapter((context, request), name='absolute_url')()
r.append('url:%s' % url)
adapted = IReadFile(context)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/tests/test_external_edit.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/tests/test_external_edit.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/externaleditor/tests/test_external_edit.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
from zope.publisher.browser import TestRequest
from zope.app import zapi
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import ztapi
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import ztapi
from zope.app.container.contained import contained
from zope.app.content.interfaces import IContentType
from zope.app.filerepresentation.interfaces import IReadFile
@@ -65,7 +65,7 @@
self.assertEqual(file.contentType, 'text/plain')
self.assertEqual(file.data, 'Foobar')
file = contained(file, container, 'file')
- view = zapi.queryView(file, 'external_edit', request, None)
+ view = zapi.queryMultiAdapter((file, request), name='external_edit')
self.failIf(view is None)
expected = """\
url:http://127.0.0.1/folder1/file
Modified: Zope3/branches/srichter-blow-services/src/zope/app/folder/folder.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/folder/folder.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/folder/folder.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -126,8 +126,8 @@
[]
>>> sm = Contained()
- >>> from zope.component.interfaces import IServiceService
- >>> directlyProvides(sm, IServiceService)
+ >>> from zope.component.interfaces import ISiteManager
+ >>> directlyProvides(sm, ISiteManager)
>>> folder.setSiteManager(sm)
>>> directlyProvides(folder, ISite)
>>> subs = list(FolderSublocations(folder).sublocations())
Modified: Zope3/branches/srichter-blow-services/src/zope/app/folder/fssync/adapter.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/folder/fssync/adapter.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/folder/fssync/adapter.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
__docformat__ = 'restructuredtext'
from zope.fssync.server.entryadapter import DirectoryAdapter
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
class FolderAdapter(DirectoryAdapter):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/folder/interfaces.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/folder/interfaces.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/folder/interfaces.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,7 +19,7 @@
from zope.app.container.interfaces import IContainer, IContentContainer
from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.site.interfaces import IPossibleSite
+from zope.app.component.interfaces import IPossibleSite
from zope.app.annotation.interfaces import IAttributeAnnotatable
class IFolder(IContainer, IContentContainer, IPossibleSite,
Modified: Zope3/branches/srichter-blow-services/src/zope/app/folder/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/folder/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/folder/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,18 +20,17 @@
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.folder.interfaces import IFolder
from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.component.tests.test_servicemanagercontainer \
- import BaseTestServiceManagerContainer
+from zope.app.component.testing import PlacefulSetup
+from zope.app.component.tests.test_site import BaseTestSiteManagerContainer
from zope.app.container.tests.test_icontainer import BaseTestIContainer
from zope.app.container.tests.test_icontainer import DefaultTestData
-class Test(BaseTestIContainer, BaseTestServiceManagerContainer, TestCase):
+class Test(BaseTestIContainer, BaseTestSiteManagerContainer, TestCase):
def makeTestObject(self):
from zope.app.folder import Folder
@@ -56,7 +55,7 @@
def test_suite():
from zope.testing.doctestunit import DocTestSuite
- from zope.app.tests.placelesssetup import setUp, tearDown
+ from zope.app.testing.placelesssetup import setUp, tearDown
return TestSuite((
makeSuite(Test),
makeSuite(FolderMetaDataTest),
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/add.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/add.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/add.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -167,5 +167,5 @@
if layer is None:
layer = IDefaultBrowserLayer
- s = zapi.getGlobalService(zapi.servicenames.Adapters)
- s.register((for_, layer), Interface, name, class_)
+ s = zapi.getGlobalSiteManager()
+ s.provideAdapter((for_, layer), Interface, name, class_)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/editview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/editview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/editview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -149,5 +149,5 @@
if layer is None:
layer = IDefaultBrowserLayer
- s = zapi.getGlobalService(zapi.servicenames.Adapters)
- s.register((for_, layer), Interface, name, class_)
+ s = zapi.getGlobalSiteManager()
+ s.provideAdapter((for_, layer), Interface, name, class_)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/itemswidgets.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/itemswidgets.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -35,31 +35,35 @@
# For choices, we want to make the widget a view of the field and vocabulary.
def ChoiceDisplayWidget(field, request):
- return zapi.getMultiView((field, field.vocabulary), request, IDisplayWidget)
+ return zapi.getMultiAdapter((field, field.vocabulary, request),
+ IDisplayWidget)
def ChoiceInputWidget(field, request):
- return zapi.getMultiView((field, field.vocabulary), request, IInputWidget)
+ return zapi.getMultiAdapter((field, field.vocabulary, request),
+ IInputWidget)
# for collections, we want to make the widget a view of the field and the
# value_type. If the value_type is None we may fall over. We may
# not be able to do any better than that.
def CollectionDisplayWidget(field, request):
- return zapi.getMultiView((field, field.value_type), request, IDisplayWidget)
+ return zapi.getMultiAdapter((field, field.value_type, request),
+ IDisplayWidget)
def CollectionInputWidget(field, request):
- return zapi.getMultiView((field, field.value_type), request, IInputWidget)
+ return zapi.getMultiAdapter((field, field.value_type, request),
+ IInputWidget)
# for collections of choices, we want to make the widget a view of the field,
# the value type, and the vocabulary.
def ChoiceCollectionDisplayWidget(field, value_type, request):
- return zapi.getMultiView(
- (field, value_type.vocabulary), request, IDisplayWidget)
+ return zapi.getMultiAdapter((field, value_type.vocabulary, request),
+ IDisplayWidget)
def ChoiceCollectionInputWidget(field, value_type, request):
- return zapi.getMultiView(
- (field, value_type.vocabulary), request, IInputWidget)
+ return zapi.getMultiAdapter((field, value_type.vocabulary, request),
+ IInputWidget)
class TranslationHook(object):
"""A mixin class that provides the translation capabilities."""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/sequencewidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/sequencewidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/sequencewidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -104,7 +104,7 @@
if self.subwidget:
widget = self.subwidget(field, self.request)
else:
- widget = zapi.getViewProviding(field, IInputWidget, self.request)
+ widget = zapi.getMultiAdapter((field, self.request), IInputWidget)
widget.setPrefix('%s.%d.'%(self.name, i))
return widget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -137,8 +137,8 @@
def error(self):
if self._error:
- return zapi.getViewProviding(self._error, IWidgetInputErrorView,
- self.request).snippet()
+ return zapi.getMultiAdapter((self._error, self.request),
+ IWidgetInputErrorView).snippet()
return ""
def __call__(self):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/source.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -61,7 +61,7 @@
... def getValue(self, token):
... return token.decode('base64')
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.publisher.interfaces.browser import IBrowserRequest
>>> import zope.app.form.browser.interfaces
>>> ztapi.provideAdapter((SourceList, IBrowserRequest),
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_add.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_add.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_add.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,13 +17,13 @@
"""
import unittest
-from zope.app.tests import ztapi
+from zope.app import zapi
+from zope.app.testing import ztapi
from zope.interface import Interface, implements
from zope.publisher.interfaces.browser import IBrowserRequest
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.publisher.browser import TestRequest
from zope.schema import TextLine, accessors
-from zope.component import getView
from zope.app.event.tests.placelesssetup import getEvents
from zope.app.event.interfaces import IObjectCreatedEvent, IObjectModifiedEvent
@@ -33,7 +33,7 @@
from zope.app.form import CustomWidgetFactory
from zope.app.form.browser import TextWidget as Text
from zope.app.form.browser.submit import Update
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
# Foo needs to be imported as globals() are checked
from zope.app.form.browser.tests.test_editview import IFoo, IBar, Foo
@@ -215,7 +215,7 @@
(descriminator, callable, args, kw) = self._context.last_action
factory = AddViewFactory(*args)
request = TestRequest()
- view = getView(adding, 'addthis', request)
+ view = zapi.getMultiAdapter((adding, request), name='addthis')
content = view.create('a',0,abc='def')
self.failUnless(isinstance(content, C))
@@ -248,7 +248,7 @@
(descriminator, callable, args, kw) = self._context.last_action
factory = AddViewFactory(*args)
request = TestRequest()
- view = getView(adding, 'addthis', request)
+ view = zapi.getMultiAdapter((adding, request), name='addthis')
view.createAndAdd(SampleData.__dict__)
@@ -286,7 +286,7 @@
(descriminator, callable, args, kw) = self._context.last_action
factory = AddViewFactory(*args)
request = TestRequest()
- view = getView(adding, 'addthis', request)
+ view = zapi.getMultiAdapter((adding, request), name='addthis')
view.createAndAdd({'bar': 'bar'})
@@ -306,7 +306,7 @@
for (k, v) in dict(SampleData.__dict__).items()
]))
request.form[Update] = ''
- view = getView(adding, 'addthis', request)
+ view = zapi.getMultiAdapter((adding, request), name='addthis')
# Add hooks to V
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_browserwidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_browserwidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_browserwidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,11 +20,11 @@
from zope.testing.doctestunit import DocTestSuite
from zope.interface import Interface, implements
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.form.browser.widget import SimpleInputWidget
from zope.app.form.interfaces import ConversionError
from zope.app.form.interfaces import WidgetInputError, MissingInputError
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.i18n.interfaces import ITranslationDomain
from zope.i18n.interfaces import INegotiator
from zope.i18n.negotiator import negotiator
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicecollections.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicecollections.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicecollections.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,8 +22,8 @@
from zope.schema import Choice, List
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.form.interfaces import IInputWidget, IDisplayWidget
from zope.app.form.browser import CollectionDisplayWidget
from zope.app.form.browser import CollectionInputWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicewidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicewidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_choicewidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,8 +22,8 @@
from zope.schema import Choice
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.form.interfaces import IInputWidget, IDisplayWidget
from zope.app.form.browser import ChoiceDisplayWidget, ChoiceInputWidget
from zope.app.form.browser import ItemDisplayWidget, DropdownWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -32,7 +32,7 @@
import zope.app.form.browser
import zope.app.publisher.browser
from zope.app.form.browser import TextWidget
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
tests_path = os.path.join(
@@ -81,7 +81,7 @@
XMLConfig('meta.zcml', zope.app.form.browser)()
XMLConfig('meta.zcml', zope.app.publisher.browser)()
- from zope.app.tests import ztapi
+ from zope.app.testing import ztapi
from zope.app.traversing.adapters import DefaultTraversable
from zope.app.traversing.interfaces import ITraversable
@@ -89,8 +89,9 @@
def testAddForm(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='add.html'),
+ None)
xmlconfig(StringIO(template % ("""
<view
type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -109,13 +110,14 @@
permission="zope.Public" />
""")))
- v = zapi.queryView(ob, 'add.html', request)
+ v = zapi.queryMultiAdapter((ob, request), name='add.html')
# expect to fail as standard macros are not configured
self.assertRaises(TraversalError, v)
def testEditForm(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='edit.html'),
+ None)
xmlconfig(StringIO(template % ("""
<view
type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -134,13 +136,14 @@
permission="zope.Public" />
""")))
- v = zapi.queryView(ob, 'edit.html', request)
+ v = zapi.queryMultiAdapter((ob, request), name='edit.html')
# expect to fail as standard macros are not configured
self.assertRaises(TraversalError, v)
def testEditFormWithMenu(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='edit.html'),
+ None)
xmlconfig(StringIO(template % ('''
<browser:menu id="test_menu" title="Test menu"/>
<view
@@ -162,13 +165,14 @@
/>
''')))
- v = zapi.queryView(ob, 'edit.html', request)
+ v = zapi.queryMultiAdapter((ob, request), name='edit.html')
# expect to fail as standard macros are not configured
self.assertRaises(TraversalError, v)
def testAddFormWithWidget(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='add.html'),
+ None)
xmlconfig(StringIO(template % ('''
<view
type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -196,7 +200,7 @@
</browser:addform>
''')), )
- view = zapi.queryView(ob, 'add.html', request)
+ view = zapi.queryMultiAdapter((ob, request), name='add.html')
self.assert_(hasattr(view, 'text_widget'))
self.assert_(isinstance(view.text_widget, SomeWidget))
self.assertEqual(view.text_widget.extra, u'foo')
@@ -204,8 +208,9 @@
def testEditFormWithWidget(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='edit.html'),
+ None)
xmlconfig(StringIO(template % ('''
<view
type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -233,7 +238,7 @@
</browser:editform>
''')), )
- view = zapi.queryView(ob, 'edit.html', request)
+ view = zapi.queryMultiAdapter((ob, request), name='edit.html')
self.assert_(hasattr(view, 'text_widget'))
self.assert_(isinstance(view.text_widget, SomeWidget))
self.assertEqual(view.text_widget.extra, u'foo')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -11,7 +11,9 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""$Id$
+"""Edit View Tests
+
+$Id$
"""
import unittest
@@ -21,8 +23,8 @@
from zope.schema.interfaces import ITextLine
from zope.component.exceptions import ComponentLookupError
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.event.tests.placelesssetup import getEvents
from zope.app.form.browser import TextWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editwizardview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editwizardview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_editwizardview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,8 @@
from zope.schema.interfaces import ITextLine
from zope.security.checker import InterfaceChecker, ProxyFactory
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.form.browser.editwizard import EditWizardView
from zope.app.form.browser import TextWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_itemswidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_itemswidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_itemswidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -36,7 +36,7 @@
from zope.app.form.browser.itemswidgets import OrderedMultiSelectWidget
from zope.app.form.browser.itemswidgets import MultiCheckBoxWidget
from zope.app.form.browser.tests.support import VerifyResults
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
vocab = SimpleVocabulary(
[SimpleTerm(value, token, title) for value, token, title in (
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_objectwidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_objectwidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_objectwidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,10 +15,9 @@
$Id$
"""
-
import unittest, doctest
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.interface import Interface, implements
from zope.schema.interfaces import ITextLine
from zope.publisher.browser import TestRequest
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_registrations.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_registrations.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_registrations.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.testing.doctestunit import DocTestSuite
from zope.app import zapi
-from zope.app.tests import setup
+from zope.app.testing import setup
# import all widgets (in this case, importing * is ok, since we
# absolutely know what we're importing)
from zope.app.form.browser import *
@@ -68,105 +68,105 @@
IField, IDisplayWidget -> DisplayWidget
>>> field = fields.Field()
- >>> widget = zapi.getViewProviding(field, IDisplayWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IDisplayWidget)
>>> isinstance(widget, DisplayWidget)
True
ITextLine, IInputWidget -> TextWidget
>>> field = fields.TextLine()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, TextWidget)
True
IText, IInputWidget -> TextAreaWidget
>>> field = fields.Text()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, TextAreaWidget)
True
ISourceText, IInputWidget -> TextAreaWidget
>>> field = fields.SourceText()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, TextAreaWidget)
True
IBytesLine, IInputWidget -> BytesWidget
>>> field = fields.BytesLine()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, BytesWidget)
True
IBytes, IInputWidget -> FileWidget
>>> field = fields.Bytes()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, FileWidget)
True
IASCII, IInputWidget -> BytesAreaWidget
>>> field = fields.ASCII()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, BytesAreaWidget)
True
IInt, IInputWidget -> IntWidget
>>> field = fields.Int()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, IntWidget)
True
IFloat, IInputWidget -> FloatWidget
>>> field = fields.Float()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, FloatWidget)
True
IDatetime, IInputWidget -> DatetimeWidget
>>> field = fields.Datetime()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, DatetimeWidget)
True
IDate, IInputWidget -> DateWidget
>>> field = fields.Date()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, DateWidget)
True
IBool, IInputWidget -> CheckBoxWidget
>>> field = fields.Bool()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, CheckBoxWidget)
True
ITuple, IInputWidget -> TupleSequenceWidget
>>> field = fields.Tuple(value_type=fields.Int())
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, TupleSequenceWidget)
True
IList, IInputWidget -> ListSequenceWidget
>>> field = fields.List(value_type=fields.Int())
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, ListSequenceWidget)
True
IPassword, IInputWidget -> PasswordWidget
>>> field = fields.Password()
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, PasswordWidget)
True
@@ -174,7 +174,7 @@
>>> field = fields.Choice(vocabulary=vocab)
>>> field = field.bind(sample)
- >>> widget = zapi.getViewProviding(field, IDisplayWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IDisplayWidget)
>>> isinstance(widget, ItemDisplayWidget)
True
@@ -182,7 +182,7 @@
>>> field = fields.Choice(vocabulary=vocab)
>>> field = field.bind(sample)
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, DropdownWidget)
True
@@ -190,7 +190,7 @@
>>> field = fields.List(value_type=fields.Choice(vocabulary=vocab))
>>> field = field.bind(sample)
- >>> widget = zapi.getViewProviding(field, IDisplayWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IDisplayWidget)
>>> isinstance(widget, ItemsMultiDisplayWidget)
True
@@ -198,7 +198,7 @@
>>> field = fields.List(value_type=fields.Choice(vocabulary=vocab))
>>> field = field.bind(sample)
- >>> widget = zapi.getViewProviding(field, IInputWidget, request)
+ >>> widget = zapi.getMultiAdapter((field, request), IInputWidget)
>>> isinstance(widget, OrderedMultiSelectWidget)
True
"""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_sequencewidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_sequencewidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_sequencewidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -24,7 +24,7 @@
from zope.interface.verify import verifyClass
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.form.browser import TextWidget, TupleSequenceWidget
from zope.app.form.browser import ListSequenceWidget
from zope.app.form.interfaces import IInputWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_source.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_source.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_source.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -11,13 +11,12 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""XXX short summary goes here.
+"""Source Widget Tests
$Id$
"""
+from zope.app.testing import placelesssetup
-from zope.app.tests import placelesssetup
-
def test_suite():
from zope.testing import doctest
return doctest.DocFileSuite(
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_textwidget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_textwidget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_textwidget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -27,7 +27,7 @@
from zope.app.form.browser import TextWidget
from zope.app.form.browser import DateDisplayWidget, DatetimeDisplayWidget
from zope.app.form.browser.textwidgets import URIDisplayWidget
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
from zope.app.form.browser.tests.test_browserwidget import BrowserWidgetTest
from zope.app.form.browser.tests.test_browserwidget import SimpleInputWidgetTest
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_widgetdirective.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_widgetdirective.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/tests/test_widgetdirective.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
import zope.app.container.interfaces
import zope.app.form.browser.interfaces
import zope.app.form.interfaces
-import zope.app.tests.placelesssetup
+import zope.app.testing.placelesssetup
from zope.app import zapi
@@ -60,7 +60,7 @@
self.content = content
-class WidgetDirectiveTestCase(zope.app.tests.placelesssetup.PlacelessSetup,
+class WidgetDirectiveTestCase(zope.app.testing.placelesssetup.PlacelessSetup,
unittest.TestCase):
def setUp(self):
@@ -70,7 +70,7 @@
def get_widget(self, name, context):
request = zope.publisher.browser.TestRequest()
- view = zapi.getView(context, name, request)
+ view = zapi.getMultiAdapter((context, request), name=name)
return view.field_widget
def test_addform_widget_without_class(self):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/browser/widget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/browser/widget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/browser/widget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.app.publisher.browser import BrowserView
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.form import Widget, InputWidget
from zope.app.form.interfaces import ConversionError
from zope.app.form.interfaces import InputErrors
@@ -101,8 +101,8 @@
def error(self):
if self._error:
- return zapi.getViewProviding(self._error, IWidgetInputErrorView,
- self.request).snippet()
+ return zapi.getMultiAdapter((self._error, self.request),
+ IWidgetInputErrorView).snippet()
return ""
def hidden(self):
@@ -463,14 +463,14 @@
def setUp():
- import zope.app.tests.placelesssetup
+ import zope.app.testing.placelesssetup
global setUp
- setUp = zope.app.tests.placelesssetup.setUp
+ setUp = zope.app.testing.placelesssetup.setUp
setUp()
def tearDown():
- import zope.app.tests.placelesssetup
+ import zope.app.testing.placelesssetup
global tearDown
- tearDown = zope.app.tests.placelesssetup.tearDown
+ tearDown = zope.app.testing.placelesssetup.tearDown
tearDown()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_utility.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_utility.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_utility.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
from zope.schema import Field, Int
from zope.schema.interfaces import IField, IInt
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi, placelesssetup
from zope.app.publisher.browser import BrowserView
from zope.app.form import Widget
from zope.app.form.interfaces import IWidget, IInputWidget, IDisplayWidget
@@ -36,8 +36,6 @@
from zope.app.form.utility import getWidgetsData, viewHasInput
from zope.app.form.utility import applyWidgetsChanges
-from zope.app.tests import placelesssetup
-
request = TestRequest()
class IFoo(IField):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_widget.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_widget.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/tests/test_widget.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
from zope.app.form import Widget, CustomWidgetFactory
from zope.app.form.interfaces import IWidget
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
class TestContext(object):
__name__ = 'Test'
Modified: Zope3/branches/srichter-blow-services/src/zope/app/form/utility.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/form/utility.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/form/utility.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -55,13 +55,9 @@
def _createWidget(context, field, viewType, request):
- """Creates a widget given a `context`, `field`, and `viewType`.
-
- Uses ``zapi.getViewProviding`` to lookup a view for the field and the
- viewType.
- """
+ """Creates a widget given a `context`, `field`, and `viewType`."""
field = field.bind(context)
- return zapi.getViewProviding(field, viewType, request)
+ return zapi.getMultiAdapter((field, request), viewType)
def _widgetHasStickyValue(widget):
"""Returns ``True`` if the widget has a sticky value.
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/configure.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -3,13 +3,8 @@
xmlns:fssync='http://namespaces.zope.org/fssync'
>
- <serviceType
- id="FSRegistryService"
- interface="zope.app.fssync.interfaces.IGlobalFSSyncService"
- />
-
- <service
- serviceType="FSRegistryService"
+ <utility
+ interface="zope.app.fssync.interfaces.IGlobalFSSyncUtility"
component="zope.app.fssync.fsregistry.fsRegistry"
/>
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/fsregistry.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/fsregistry.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/fsregistry.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""Filesystem synchronization registry.
-This acts as a global (placeless) service.
+This acts as a global (placeless) utility.
$Id$
"""
@@ -21,7 +21,7 @@
from zope.exceptions import DuplicationError, NotFoundError
from zope.interface import implements
-from zope.app.fssync.interfaces import IGlobalFSSyncService
+from zope.app.fssync.interfaces import IGlobalFSSyncUtility
class FSRegistry(object):
"""Registry Wrapper class.
@@ -29,7 +29,7 @@
This is a maping from Class -> Serializer Factory Method.
"""
- implements(IGlobalFSSyncService)
+ implements(IGlobalFSSyncUtility)
def __init__(self):
self._class_factory_reg = {}
@@ -63,7 +63,7 @@
_clear = __init__
-# The FS registry serializer service instance
+# The FS registry serializer utility instance
fsRegistry = FSRegistry()
provideSynchronizer = fsRegistry.provideSynchronizer
getSynchronizer = fsRegistry.getSynchronizer
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/interfaces.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/interfaces.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/interfaces.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
from zope.interface import Interface
-class IFSSyncService(Interface):
+class IFSSyncUtility(Interface):
"""Lookup file-system representation adapters."""
def getSynchronizer(object):
@@ -40,7 +40,7 @@
"""
-class IGlobalFSSyncService(IFSSyncService):
+class IGlobalFSSyncUtility(IFSSyncUtility):
"""Global registry for file-system representation adapters."""
def provideSynchronizer(class_, factory):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/syncer.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/syncer.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/syncer.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,19 +17,20 @@
"""
__docformat__ = 'restructuredtext'
-from zope.component import getService
+from zope.app import zapi
from zope.fssync.server.syncer import Syncer
from zope.app.annotation.interfaces import IAnnotations
from zope.app.traversing.api import getPath
+from interfaces import IGlobalFSSyncUtility
def getObjectId(obj):
return str(getPath(obj))
def getSerializer(obj):
- syncService = getService('FSRegistryService')
- return syncService.getSynchronizer(obj)
+ syncUtility = zapi.getUtility(IGlobalFSSyncUtility)
+ return syncUtility.getSynchronizer(obj)
def getAnnotations(obj):
return IAnnotations(obj, None)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_committer.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_committer.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_committer.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,14 +15,13 @@
$Id$
"""
-
import os
import shutil
import tempfile
import unittest
-from zope.component.service import serviceManager
-from zope.app.tests import ztapi
+from zope.app import zapi
+from zope.app.testing import ztapi
from zope.app.traversing.interfaces import TraversalError
from zope.interface import implements
@@ -39,12 +38,12 @@
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.traversing.interfaces import ITraversable, ITraverser
from zope.app.location import Location
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.fssync import committer, syncer # The module
from zope.app.fssync.committer import Checker, Committer, SynchronizationError
from zope.app.fssync.fsregistry import provideSynchronizer, fsRegistry
-from zope.app.fssync.interfaces import IGlobalFSSyncService
+from zope.app.fssync.interfaces import IGlobalFSSyncUtility
class Sample(object):
@@ -120,12 +119,11 @@
# Base class for test classes
def setUp(self):
- # Set up standard services
super(TestBase, self).setUp()
- # Set up FSRegistryService
- serviceManager.defineService("FSRegistryService", IGlobalFSSyncService)
- serviceManager.provideService("FSRegistryService", fsRegistry)
+ # Set up FSRegistryUtility
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IGlobalFSSyncUtility, fsRegistry)
provideSynchronizer(None, DefaultFileAdpater)
# Set up temporary name administration
@@ -135,7 +133,6 @@
# Clean up temporary files and directories
TempFiles.tearDown(self)
- # Clean up service registrations etc.
PlacelessSetup.tearDown(self)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsdirective.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsdirective.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsdirective.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
from zope.app.fssync.fsregistry import getSynchronizer
from zope.app.fssync.tests.sampleclass import \
C1, C2, CDirAdapter, CDefaultAdapter
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.configuration import xmlconfig
from zope.configuration.config import ConfigurationConflictError
from zope.exceptions import NotFoundError
Modified: Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsregistry.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsregistry.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/fssync/tests/test_fsregistry.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Test FSRegistry File-system synchronization services
+"""Test FSRegistry File-system synchronization utilities
$Id$
"""
@@ -22,7 +22,7 @@
from zope.interface.verify import verifyObject
from zope.exceptions import DuplicationError, NotFoundError
-from zope.app.fssync.interfaces import IGlobalFSSyncService
+from zope.app.fssync.interfaces import IGlobalFSSyncUtility
from zope.app.fssync.tests.sampleclass \
import C1, C2, CDirAdapter, CFileAdapter, CDefaultAdapter
from zope.app.fssync.fsregistry \
@@ -33,7 +33,7 @@
"""
def testInterfaceVerification(self):
- verifyObject(IGlobalFSSyncService, fsRegistry)
+ verifyObject(IGlobalFSSyncUtility, fsRegistry)
def testFSRegistry(self):
""" Test Class and Factory registration and getSynchronizer to get
Modified: Zope3/branches/srichter-blow-services/src/zope/app/ftp/tests/test_ftpview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/ftp/tests/test_ftpview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/ftp/tests/test_ftpview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,7 +15,6 @@
$Id$
"""
-
import datetime
from StringIO import StringIO
from unittest import TestCase, TestSuite, main, makeSuite
@@ -27,7 +26,7 @@
from zope.app.filerepresentation.interfaces import IDirectoryFactory
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.ftp import FTPView
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.interface import implements
from zope.app.copypastemove.interfaces import IObjectMover
from zope.app.container.contained import setitem, Contained
Modified: Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managerdetails.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managerdetails.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managerdetails.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,13 +26,13 @@
This method needs to use the component architecture, so
we'll set it up:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
We need to define some schema managers. We'll define just one:
>>> from zope.app.generations.generations import SchemaManager
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> app1 = SchemaManager(0, 3, 'zope.app.generations.demo')
>>> ztapi.provideUtility(ISchemaManager, app1, 'foo.app1')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managers.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managers.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/generations/browser/managers.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -40,7 +40,7 @@
This method needs to use the component architecture, so
we'll set it up:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
We also need a test request:
@@ -62,7 +62,7 @@
using the demo package:
>>> from zope.app.generations.generations import SchemaManager
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> app1 = SchemaManager(0, 1, 'zope.app.generations.demo')
>>> ztapi.provideUtility(ISchemaManager, app1, 'foo.app1')
>>> app2 = SchemaManager(0, 0, 'zope.app.generations.demo')
@@ -188,7 +188,7 @@
This method needs to use the component architecture, so
we'll set it up:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
We also need a test request:
@@ -210,7 +210,7 @@
using the demo package:
>>> from zope.app.generations.generations import SchemaManager
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> app1 = SchemaManager(0, 1, 'zope.app.generations.demo')
>>> ztapi.provideUtility(ISchemaManager, app1, 'foo.app1')
>>> app2 = SchemaManager(0, 0, 'zope.app.generations.demo')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/generations/generations.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/generations/generations.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/generations/generations.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -160,12 +160,12 @@
We also need to set up the component system, since we'll be
registering utilities:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
Now, we'll create and register some handlers:
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> app1 = FauxApp('app1', 0, 1)
>>> ztapi.provideUtility(ISchemaManager, app1, name='app1')
>>> app2 = FauxApp('app2', 5, 11)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/homefolder/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/homefolder/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/homefolder/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -158,7 +158,7 @@
We also need to register our manager as a utility:
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.app.homefolder.interfaces import IHomeFolderManager
>>> ztapi.provideUtility(IHomeFolderManager, manager, 'manager')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/homefolder/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/homefolder/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/homefolder/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
import unittest
from zope.security.interfaces import IPrincipal
from zope.testing import doctest
-from zope.app.tests import placelesssetup, setup, ztapi
+from zope.app.testing import placelesssetup, setup, ztapi
from zope.app.annotation.interfaces import IAnnotatable
from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
Modified: Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_delete.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_delete.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_delete.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,7 +19,7 @@
import zope.app.http.delete
from zope.publisher.browser import TestRequest
from zope.app.filerepresentation.interfaces import IWriteDirectory, IFileFactory
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.interface import implements
from zope.app.container.contained import contained
Modified: Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_put.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_put.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/http/tests/test_put.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.publisher.browser import TestRequest
from zope.app.filerepresentation.interfaces import IWriteFile
from zope.app.filerepresentation.interfaces import IWriteDirectory, IFileFactory
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.interface import implements
class File(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/i18n/browser/tests/test_translate.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/i18n/browser/tests/test_translate.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/i18n/browser/tests/test_translate.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,8 @@
import unittest
from StringIO import StringIO
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
from zope.component.interfaces import IFactory
from zope.component.factory import Factory
Modified: Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_filters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_filters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_filters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,8 @@
from cStringIO import StringIO
from zope.interface import implements
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.component.interfaces import IFactory
from zope.component.factory import Factory
Modified: Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_translationdomain.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/i18n/tests/test_translationdomain.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -33,11 +33,9 @@
from zope.app.i18n.interfaces import ISyncTranslationDomain
from zope.app.i18n.messagecatalog import MessageCatalog
from zope.app.i18n.translationdomain import TranslationDomain
-from zope.app.servicenames import Utilities
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import setup, ztapi
-from zope.app.utility import LocalUtilityService
-from zope.app.utility.interfaces import ILocalUtility
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import setup, ztapi
+from zope.app.component.interfaces import ILocalUtility
class Environment(object):
@@ -197,7 +195,6 @@
self.sm = PlacefulSetup.setUp(self, site=True)
TestITranslationDomain.setUp(self)
- setup.addService(self.sm, Utilities, LocalUtilityService())
setup.addUtility(self.sm, 'default', ITranslationDomain, self._domain)
ztapi.provideUtility(IFactory, Factory(MessageCatalog),
Modified: Zope3/branches/srichter-blow-services/src/zope/app/i18n/translationdomain.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/i18n/translationdomain.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/i18n/translationdomain.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -29,11 +29,9 @@
from zope.i18n.interfaces import INegotiator, ITranslationDomain
from zope.i18n.simpletranslationdomain import SimpleTranslationDomain
from zope.app.container.contained import Contained
-from zope.app.component.localservice import getNextService
-from zope.component.servicenames import Utilities
-from zope.app.utility import UtilityRegistration
+from zope.app.component.site import UtilityRegistration
+from zope.app.component import queryNextUtility
-
class TranslationDomain(BTreeContainer, SimpleTranslationDomain, Contained):
implements(ILocalTranslationDomain)
@@ -84,8 +82,7 @@
else:
# If nothing found, delegate to a translation server higher up the
# tree.
- utils = getNextService(self, Utilities)
- domain = utils.queryUtility(ITranslationDomain, self.domain)
+ domain = queryNextUtility(ITranslationDomain, self.domain)
if domain is not None:
return domain.translate(msgid, mapping, context,
target_language, default=default)
@@ -241,7 +238,7 @@
>>> domain1.domain
'<domain not activated>'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationActivatedEvent(
... Registration(domain1, 'domain1'))
@@ -283,7 +280,7 @@
>>> domain1 = TranslationDomain()
>>> domain1.domain = 'domain1'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationDeactivatedEvent(
... Registration(domain1, 'domain1'))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/interface/tests/test_vocabulary.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/interface/tests/test_vocabulary.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/interface/tests/test_vocabulary.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import setup
+from zope.app.testing import setup
def test_suite():
return DocTestSuite('zope.app.interface.vocabulary',
Modified: Zope3/branches/srichter-blow-services/src/zope/app/intid/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/intid/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/intid/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,16 +19,13 @@
from zope.interface.verify import verifyObject
from persistent import Persistent
from persistent.interfaces import IPersistent
-from zope.app.tests import setup, ztapi
+from zope.app.testing import setup, ztapi
from zope.app import zapi
from zope.interface import implements
from ZODB.interfaces import IConnection
from zope.app.location.interfaces import ILocation
from zope.app.component.hooks import setSite
-from zope.app.utility import LocalUtilityService
-from zope.app.servicenames import Utilities
-
class P(Persistent):
implements(ILocation)
@@ -153,20 +150,16 @@
ReferenceSetupMixin.setUp(self)
- sm = zapi.getServices(self.root)
- setup.addService(sm, Utilities, LocalUtilityService())
- self.utility = setup.addUtility(sm, '1',
- IIntIds, IntIds())
+ sm = zapi.getSiteManager(self.root)
+ self.utility = setup.addUtility(sm, '1', IIntIds, IntIds())
self.root['folder1'] = Folder()
self.root._p_jar = ConnectionStub()
self.root['folder1']['folder1_1'] = self.folder1_1 = Folder()
self.root['folder1']['folder1_1']['folder1_1_1'] = Folder()
- sm1_1 = setup.createServiceManager(self.folder1_1)
- setup.addService(sm1_1, Utilities, LocalUtilityService())
- self.utility1 = setup.addUtility(sm1_1, '2', IIntIds,
- IntIds())
+ sm1_1 = setup.createSiteManager(self.folder1_1)
+ self.utility1 = setup.addUtility(sm1_1, '2', IIntIds, IntIds())
def test_removeIntIdSubscriber(self):
from zope.app.intid import removeIntIdSubscriber
Modified: Zope3/branches/srichter-blow-services/src/zope/app/introspector/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/introspector/browser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/introspector/browser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,6 @@
from zope.component.exceptions import ComponentLookupError
from zope.interface import directlyProvides, directlyProvidedBy
from zope.app.component.interface import getInterface
-from zope.app.servicenames import Services
class IntrospectorView(BrowserView):
@@ -34,10 +33,10 @@
return introspector
def getInterfaceURL(self, name):
- services = zapi.getService(Services, self.context)
+ sm = zapi.getSiteManager(self.context)
try:
getInterface(self.context, name)
- url = zapi.getView(services, 'absolute_url', self.request)
+ url = zapi.getMultiAdapter((sm, self.request), name='absolute_url')
except ComponentLookupError:
return ""
return "%s/interfacedetail.html?id=%s" % (url, name)
@@ -57,7 +56,3 @@
interface = getInterface(ob, interface)
directlyProvides(ob, directlyProvidedBy(ob)-interface)
- def getServicesFor(self):
- # TODO: Needs implementation. However, the API doc tool does this
- # already.
- return []
Modified: Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspector.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspector.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspector.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.interface import Interface, Attribute, implements, directlyProvides
from zope.interface.verify import verifyObject
from zope.app.component.interface import provideInterface
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
class ITestClass(Interface):
def drool():
Modified: Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspectorview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspectorview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/introspector/tests/test_introspectorview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,13 +17,12 @@
"""
import unittest
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.publisher.browser import TestRequest
-from zope.app.tests import setup
from zope.interface import Interface, directlyProvidedBy
from zope.interface import directlyProvides, implements
from zope.app.component.interface import provideInterface
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi, setup
from zope.app.introspector.interfaces import IIntrospector
from zope.app.introspector import Introspector
@@ -42,7 +41,7 @@
def setUp(self):
PlacefulSetup.setUp(self)
self.rootFolder = setup.buildSampleFolderTree()
- mgr = setup.createServiceManager(self.rootFolder)
+ mgr = setup.createSiteManager(self.rootFolder)
provideInterface(id, I1)
provideInterface(id2, I2)
ztapi.provideAdapter(None, IIntrospector, Introspector)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/location/traversing.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/location/traversing.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/location/traversing.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,7 +19,7 @@
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.traversing.interfaces import ITraverser
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
from zope.app.traversing.api import getParents
from zope.app.location.location import Location
Modified: Zope3/branches/srichter-blow-services/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/mail/metaconfigure.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/mail/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -44,8 +44,7 @@
delivery = QueuedMailDelivery(queuePath)
delivery = _assertPermission(permission, IMailDelivery, delivery)
- utilities = zapi.getGlobalService('Utilities')
- handler('Utilities', 'provideUtility', IMailDelivery, delivery, name)
+ handler('provideUtility', IMailDelivery, delivery, name)
mailerObject = zapi.queryUtility(IMailer, mailer)
if mailerObject is None:
@@ -73,8 +72,7 @@
delivery = DirectMailDelivery(mailerObject)
delivery = _assertPermission(permission, IMailDelivery, delivery)
- utilities = zapi.getGlobalService('Utilities')
- handler('Utilities', 'provideUtility', IMailDelivery, delivery, name)
+ handler('provideUtility', IMailDelivery, delivery, name)
_context.action(
discriminator = ('utility', IMailDelivery, name),
@@ -87,7 +85,7 @@
_context.action(
discriminator = ('utility', IMailer, name),
callable = handler,
- args = ('Utilities', 'provideUtility',
+ args = ('provideUtility',
IMailer, SendmailMailer(command), name)
)
@@ -96,6 +94,6 @@
_context.action(
discriminator = ('utility', IMailer, name),
callable = handler,
- args = ('Utilities', 'provideUtility',
+ args = ('provideUtility',
IMailer, SMTPMailer(hostname, port, username, password), name)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/mail/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/mail/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/mail/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,12 +26,11 @@
from zope.interface import implements
from zope.app import zapi
-from zope.app.component.metaconfigure import managerHandler, provideInterface
from zope.app.mail.interfaces import \
IMailDelivery, IMailer, ISMTPMailer, ISendmailMailer
from zope.app.mail.delivery import QueueProcessorThread
from zope.app.mail import delivery
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
import zope.app.mail.tests
Modified: Zope3/branches/srichter-blow-services/src/zope/app/meta.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/meta.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/meta.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -4,6 +4,7 @@
<include package="zope.modulealias" file="meta.zcml" />
<include package="zope.app.component" file="meta.zcml" />
+<include package="zope.app.component.browser" file="meta.zcml" />
<include package="zope.app.publisher" file="meta.zcml" />
<include package="zope.app.security" file="meta.zcml" />
<include package="zope.app.form.browser" file="meta.zcml" />
@@ -11,8 +12,5 @@
<include package="zope.app.pagetemplate" file="meta.zcml" />
<include package="zope.app.schema" file="meta.zcml" />
<include package="zope.app.container.browser" file="meta.zcml" />
-<include package="zope.app.utility" file="meta.zcml" />
-<include package="zope.app.site" file="meta.zcml" />
-<include package="zope.app.site.browser" file="meta.zcml" />
</configure>
Modified: Zope3/branches/srichter-blow-services/src/zope/app/module/tests/test_modulelookup.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/module/tests/test_modulelookup.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/module/tests/test_modulelookup.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,12 +20,11 @@
"""
from zope.testing.doctestunit import DocTestSuite
-
-from zope.app.registration.registration import RegisterableContainer
+from zope.app.component.registration import RegisterableContainer
from zope.app.module.interfaces import IModuleManager
from zope.interface import implements
from zope.app.container.contained import Contained, setitem
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
import sys
Modified: Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/onlinehelp.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/onlinehelp.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/onlinehelp.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,6 @@
__docformat__ = 'restructuredtext'
from zope.interface import implements
-from zope.component.servicenames import Utilities
from zope.app import zapi
from zope.app.traversing.interfaces import IContainmentRoot
@@ -129,9 +128,7 @@
topic[t[1].id] = t[1]
# Add topic to utilities registry
- zapi.getService(Utilities
- ).provideUtility(IOnlineHelpTopic,
- topic,
- topic.getTopicPath())
+ zapi.getGlobalSiteManager().provideUtility(
+ IOnlineHelpTopic, topic, topic.getTopicPath())
Modified: Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_helpdirectives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_helpdirectives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_helpdirectives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,8 +23,7 @@
from zope.app.onlinehelp import help
from zope.app.location.traversing import LocationPhysicallyLocatable
from zope.app.traversing.adapters import Traverser, DefaultTraversable
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi, placelesssetup
from zope.configuration import xmlconfig
from zope.interface import Interface
@@ -33,7 +32,7 @@
pass
-class DirectivesTest(PlacelessSetup, unittest.TestCase):
+class DirectivesTest(placelesssetup.PlacelessSetup, unittest.TestCase):
def setUp(self):
super(DirectivesTest, self).setUp()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_onlinehelp.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_onlinehelp.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/onlinehelp/tests/test_onlinehelp.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,7 @@
from zope.interface import Interface, implements
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import ztapi
-from zope.app.tests import placelesssetup
+from zope.app.testing import ztapi, placelesssetup
from zope.app.traversing.interfaces import ITraversable, IPhysicallyLocatable,\
ITraverser
from zope.app.traversing.adapters import Traverser, DefaultTraversable
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagelet/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagelet/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagelet/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -160,7 +160,7 @@
Setup:
- >>> adaptersrv = zope.component.getService('Adapters')
+ >>> gsm = zapi.getGlobalSiteManager()
Register slot interface:
@@ -196,14 +196,14 @@
>>> pagelet_factory = TestPagelet
>>> defineChecker(pagelet_factory, testChecker)
- >>> adaptersrv.register(
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IPagelet, name, pagelet_factory)
Register pagelet collector as a adapter:
>>> collector_factory = MacrosCollector
- >>> adaptersrv.register(
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IMacrosCollector, '', collector_factory)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagelet/collector.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagelet/collector.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagelet/collector.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""Pagelet collectors
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -31,14 +31,13 @@
class MacrosCollector(object):
"""Replaceable sample implementation of IMacrosCollector.
- Collects pagelets from the adapter service.
+ Collects pagelets from the site manager.
Pagelet adapters are registred on context, request, view and slot
interfaces. Use your own IMacrosCollector implementation for
to support a layout manager.
Imports:
- >>> import zope.component
>>> from zope.interface import Interface
>>> from zope.publisher.browser import TestRequest
>>> from zope.publisher.interfaces.browser import IBrowserRequest
@@ -56,12 +55,12 @@
>>> name = 'testpagelet'
>>> factory = TestPagelet
- Register the pagelet class as a factory on the adapter service:
+ Register the pagelet class as a factory on the site manager:
- >>> from zope.app.tests import placelesssetup, ztapi
+ >>> from zope.app.testing import placelesssetup, ztapi
>>> placelesssetup.setUp()
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IPagelet, name, factory)
@@ -123,7 +122,6 @@
Imports:
- >>> import zope.component
>>> from zope.interface import Interface
>>> from zope.publisher.browser import TestRequest
>>> from zope.publisher.interfaces.browser import IBrowserRequest
@@ -141,12 +139,12 @@
>>> name = 'testpagelet'
>>> factory = TestPagelet
- Register the pagelet class as a factory on the adapter service:
+ Register the pagelet class as a factory on the site manager:
- >>> from zope.app.tests import placelesssetup, ztapi
+ >>> from zope.app.testing import placelesssetup, ztapi
>>> placelesssetup.setUp()
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IPagelet, name, factory)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagelet/metaconfigure.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagelet/metaconfigure.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagelet/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -127,7 +127,7 @@
_context.action(
discriminator = ('pagelet', for_, layer, view, slot, name),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, layer, view, slot), IPagelet, name, new_class
, _context.info),)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tales.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tales.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tales.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -52,7 +52,6 @@
Imports:
- >>> import zope.component
>>> from zope.interface import Interface
>>> from zope.security.checker import defineChecker
>>> from zope.publisher.browser import TestRequest
@@ -67,13 +66,13 @@
Register pagelet:
- >>> from zope.app.tests import setup, ztapi
+ >>> from zope.app.testing import setup, ztapi
>>> setup.placefulSetUp()
>>> name = 'testpagelet'
>>> pagelet_factory = TestPagelet
>>> defineChecker(pagelet_factory, testChecker)
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView, IPageletSlot)
... , IPagelet, name, pagelet_factory)
@@ -86,7 +85,7 @@
>>> from zope.app.pagelet.collector import MacrosCollector
>>> collector_factory = MacrosCollector
- >>> adaptersrv.register(
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView, IPageletSlot)
... , IMacrosCollector, '', collector_factory)
@@ -126,7 +125,7 @@
Register zope.app.interface as a utility and try again:
- >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+ >>> gsm = zapi.getGlobalSiteManager()
>>> provideInterface('', Interface, None)
>>> try:
... html = no_slot_iface_index(view, request)
@@ -192,13 +191,13 @@
Register pagelet:
- >>> from zope.app.tests import setup, ztapi
+ >>> from zope.app.testing import setup, ztapi
>>> setup.placefulSetUp()
>>> name = 'testpagelet'
>>> pagelet_factory = TestPagelet
>>> defineChecker(pagelet_factory, testChecker)
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView, IPageletSlot)
... , IPagelet, name, pagelet_factory)
@@ -211,7 +210,7 @@
>>> from zope.app.pagelet.collector import MacroCollector
>>> collector_factory = MacroCollector
- >>> adaptersrv.register(
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView, IPageletSlot)
... , IMacroCollector, '', collector_factory)
@@ -251,7 +250,6 @@
Register zope.app.interface as a utility and try again:
- >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
>>> provideInterface('', Interface, None)
>>> try:
... html = no_slot_iface_index(view, request)
@@ -329,12 +327,12 @@
Register pagedata class:
- >>> from zope.app.tests import setup, ztapi
+ >>> from zope.app.testing import setup, ztapi
>>> setup.placefulSetUp()
>>> factory = TestClass
>>> defineChecker(factory, testChecker)
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView)
... , IPageData, '', factory)
@@ -347,7 +345,7 @@
>>> from zope.app.pagelet.collector import MacroCollector
>>> collector_factory = MacroCollector
- >>> adaptersrv.register(
+ >>> gsm.provideAdapter(
... (Interface, IDefaultBrowserLayer, IView, IPageletSlot)
... , IMacroCollector, '', collector_factory)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tests/test_pagelet.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tests/test_pagelet.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagelet/tests/test_pagelet.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""Pagelet tests
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -26,8 +26,7 @@
from zope.testing.doctestunit import DocTestSuite
from zope.testing.doctestunit import DocFileSuite
-from zope.app.tests import placelesssetup, ztapi
-from zope.app.tests import setup
+from zope.app.testing import placelesssetup, ztapi, setup
@@ -42,4 +41,4 @@
))
if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
\ No newline at end of file
+ unittest.main(defaultTest='test_suite')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/adapters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/adapters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/adapters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""PageletChooser adapters
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -53,7 +53,7 @@
>>> from zope.interface import directlyProvides
>>> from zope.interface import Interface
- >>> from zope.app.tests import placelesssetup, ztapi
+ >>> from zope.app.testing import placelesssetup, ztapi
>>> from zope.app.annotation.interfaces import IAnnotations
>>> from zope.app.annotation.interfaces import IAttributeAnnotatable
>>> from zope.app.annotation.attribute import AttributeAnnotations
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/collector.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/collector.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/collector.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""PageletChooser collector
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -39,7 +39,6 @@
Imports:
- >>> import zope.component
>>> from zope.interface import Interface
>>> from zope.publisher.browser import TestRequest
>>> from zope.publisher.interfaces.browser import IBrowserRequest
@@ -58,12 +57,12 @@
>>> name = 'testpagelet'
>>> factory = TestPagelet
- Register the pagelet class as a factory on the adapter service:
+ Register the pagelet class as a factory on the site manager:
- >>> from zope.app.tests import placelesssetup, ztapi
+ >>> from zope.app.testing import placelesssetup, ztapi
>>> placelesssetup.setUp()
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IPagelet, name, factory)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,22 +13,14 @@
##############################################################################
"""PageletChooser tests
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
-
import unittest
+from zope.security.checker import defineChecker
from zope.testing.doctestunit import DocTestSuite
-from zope.testing.doctestunit import DocFileSuite
-import zope.component
-from zope.security.checker import defineChecker
-
-from zope.app.tests import placelesssetup, ztapi
-from zope.app.tests import setup
-
-
class TestMapping(object):
def __init__(self, context=None):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/vocabulary.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/vocabulary.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pageletchooser/vocabulary.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -13,7 +13,7 @@
##############################################################################
"""PageletChooser vocabulary
-$Id:$
+$Id$
"""
__docformat__ = 'restructuredtext'
@@ -47,7 +47,6 @@
Imports:
- >>> import zope.component
>>> from zope.interface import Interface
>>> from zope.security.checker import defineChecker
>>> from zope.publisher.interfaces.browser import IBrowserRequest
@@ -60,13 +59,12 @@
Setup:
- >>> from zope.app.tests import setup, ztapi
+ >>> from zope.app.testing import setup, ztapi
>>> setup.placefulSetUp()
Register interfaces used for pagelet and vocabulary:
>>> from zope.app.component.interface import provideInterface
- >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
>>> provideInterface('', IBrowserRequest, None)
>>> provideInterface('', IView, None)
>>> provideInterface('', IChooseablePagelets, None)
@@ -76,28 +74,28 @@
>>> name = 'testpagelet'
>>> pagelet_factory = TestPagelet
>>> defineChecker(pagelet_factory, testChecker)
- >>> adaptersrv = zope.component.getService('Adapters')
- >>> adaptersrv.register(
+ >>> gsm = zapi.getGlobalSiteManager()
+ >>> gsm.provideAdapter(
... (Interface, IBrowserRequest, IView, IPageletSlot)
... , IPagelet, name, pagelet_factory)
Register vocabulary:
>>> from zope.app.pagelet.tests import TestContext
- >>> name="chooseablepageletnames"
- >>> factory=".vocabulary.PageletNamesVocabulary"
- >>> layer="zope.publisher.interfaces.browser.IBrowserRequest"
- >>> view="zope.component.interfaces.IView"
- >>> slot="zope.app.pageletchooser.interfaces.IChooseablePagelets"
+ >>> name='chooseablepageletnames'
+ >>> factory='.vocabulary.PageletNamesVocabulary'
+ >>> layer='zope.publisher.interfaces.browser.IBrowserRequest'
+ >>> view='zope.component.bbb.interfaces.IView'
+ >>> slot='zope.app.pageletchooser.interfaces.IChooseablePagelets'
>>> obj = TestContext()
>>> vocab = PageletNamesVocabulary(obj, layer, view, slot)
Test vocabulary:
- >>> "testpagelet" in vocab
+ >>> 'testpagelet' in vocab
True
- >>> "nothing" in vocab
+ >>> 'nothing' in vocab
False
>>> setup.placefulTearDown()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/engine.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/engine.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -162,9 +162,9 @@
To demonstrate this, we need to register an adapter:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> def adapter1(ob):
... return 1
>>> ztapi.provideAdapter(None, IPathAdapter, adapter1, 'a1')
@@ -249,7 +249,7 @@
security proxies as well::
>>> from zope.app.container.sample import SampleContainer
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> from zope.security.checker import NamesChecker, defineChecker
>>> class Container(SampleContainer):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_binding.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_binding.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_binding.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,20 +20,14 @@
from zope.app.pagetemplate.tests.testpackage.content \
import Content, PTComponent
-# Wow, this is a lot of work. :(
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.traversing.adapters import Traverser, DefaultTraversable
-from zope.app.traversing.interfaces import ITraverser
-from zope.app.traversing.interfaces import ITraversable
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi, setup, placelesssetup
-class BindingTestCase(PlacelessSetup, unittest.TestCase):
+class BindingTestCase(placelesssetup.PlacelessSetup, unittest.TestCase):
def setUp(self):
super(BindingTestCase, self).setUp()
- ztapi.provideAdapter(None, ITraverser, Traverser)
- ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
+ setup.setUpTraversal()
def test_binding(self):
from zope.publisher.browser import TestRequest
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,13 +20,13 @@
from zope.configuration.xmlconfig import xmlconfig, XMLConfig
from zope.interface import Interface, implements
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
import zope.app.pagetemplate
from zope.app.pagetemplate.engine import Engine
from zope.app.traversing.interfaces import ITraversable
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
template = """<configure
xmlns='http://namespaces.zope.org/zope'
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_viewzpt.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_viewzpt.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/tests/test_viewzpt.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,11 +18,11 @@
import unittest
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.interface import Interface, implements
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
class I1(Interface):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/viewpagetemplatefile.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/viewpagetemplatefile.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pagetemplate/viewpagetemplatefile.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
__docformat__ = 'restructuredtext'
from zope.pagetemplate.pagetemplatefile import PageTemplateFile
-from zope.component import getView
+from zope.app import zapi
from zope.app.pagetemplate.engine import TrustedAppPT
class ViewPageTemplateFile(TrustedAppPT, PageTemplateFile):
@@ -61,7 +61,7 @@
self.request = request
def __getitem__(self, name):
- return getView(self.ob, name, self.request)
+ return zapi.getMultiAdapter((self.ob, self.request), name=name)
class BoundPageTemplate(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -55,7 +55,7 @@
example here, we'll use the `provideUtility()` function from
`zope.app.tests.ztapi`:
- >>> from zope.app.tests.ztapi import provideUtility
+ >>> from zope.app.testing.ztapi import provideUtility
>>> provideUtility(interfaces.IExtractionPlugin, MyExtractor(), name='emy')
Now we also create an authenticator plugin that knows about object 42:
@@ -152,7 +152,7 @@
>>> def add_info(event):
... event.principal.title = `event.info`
- >>> from zope.app.tests.ztapi import subscribe
+ >>> from zope.app.testing.ztapi import subscribe
>>> subscribe([interfaces.IPAUPrincipalCreated], None, add_info)
Now, if we authenticate a principal, its title will be set:
@@ -321,7 +321,7 @@
delegate to the next utility. To make sure that it's delegated, we put in place
a fake utility.
- >>> from zope.app.utility.utility import testingNextUtility
+ >>> from zope.app.component.testing import testingNextUtility
>>> from zope.app.security.interfaces import IAuthenticationUtility
>>> class FakeAuthUtility:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/browser/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/browser/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/browser/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,8 +19,7 @@
import unittest
from zope.testing import doctest
from zope.schema.interfaces import ITextLine
-from zope.app.tests import placelesssetup
-from zope.app.tests import ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.form.browser import TextWidget
from zope.app.form.interfaces import IInputWidget
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/browserplugins.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/browserplugins.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/browserplugins.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -11,12 +11,11 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-""" Implementations of the session-based and cookie-based extractor and
- challenge plugins.
+"""Implementations of the session-based and cookie-based extractor and
+challenge plugins.
$Id$
"""
-
from zope.interface import implements, Interface
from zope.schema import TextLine
from persistent import Persistent
@@ -163,7 +162,7 @@
First we need a request and a response.
- >>> from zope.app.tests.setup import placefulSetUp
+ >>> from zope.app.testing.setup import placefulSetUp
>>> site = placefulSetUp(True)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/groupfolder.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/groupfolder.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/groupfolder.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -64,7 +64,7 @@
`setGroupsForPrincipal` to find out group folder, we have to register
it as a utility:
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(zope.app.pau.groupfolder.IGroupFolder,
... groups)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/pau.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/pau.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/pau.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,7 +15,6 @@
$Id$
"""
-
from zope.event import notify
import zope.interface
import zope.schema
@@ -26,9 +25,9 @@
from zope.app import zapi
from zope.app.security.interfaces import IAuthenticationUtility
-from zope.app.utility.utility import queryNextUtility
+from zope.app.component import queryNextUtility
from zope.app.container.contained import Contained
-from zope.app.utility.interfaces import ILocalUtility
+from zope.app.component.interfaces import ILocalUtility
from zope.app.location.interfaces import ILocation
from zope.app.pau import interfaces
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pau/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pau/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pau/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,9 +25,9 @@
from zope.publisher.tests.httprequest import TestRequest
from zope.app import zapi
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.event.tests.placelesssetup import getEvents
-from zope.app.tests.setup import placefulSetUp, placefulTearDown
+from zope.app.testing.setup import placefulSetUp, placefulTearDown
from zope.app.session.interfaces import \
IClientId, IClientIdManager, ISession, ISessionDataContainer, \
ISessionPkgData, ISessionData
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -48,7 +48,6 @@
from zope.app.servicenames import Authentication
from zope.app.security.interfaces import ILoginPassword
-from zope.app.component.localservice import queryNextService
from interfaces import IUserSchemafied, IPluggableAuthenticationService
from interfaces import IPrincipalSource, ILoginPasswordPrincipalSource
@@ -89,6 +88,8 @@
if principal is not None:
return principal
+ # Import placed here, to not require BBB with older code
+ from zope.app.component.localservice import queryNextService
next = queryNextService(self, Authentication, None)
if next is not None:
return next.authenticate(request)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/authsetup.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/authsetup.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/authsetup.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,8 @@
import base64
from zope.publisher.browser import TestRequest as Request
-from zope.app.tests import ztapi, setup
-from zope.app.site.tests import placefulsetup
+from zope.app.testing import ztapi, setup
+from zope.app.component.testing import PlacefulSetup
from zope.publisher.interfaces.http import IHTTPCredentials
from zope.app.security.interfaces import ILoginPassword
from zope.app.security.basicauthadapter import BasicAuthAdapter
@@ -31,10 +31,10 @@
BTreePrincipalSource, SimplePrincipal
from zope.app.pluggableauth.interfaces import IPrincipalSource
-class AuthSetup(placefulsetup.PlacefulSetup):
+class AuthSetup(PlacefulSetup):
def setUp(self):
- sm = placefulsetup.PlacefulSetup.setUp(self, site=True)
+ sm = PlacefulSetup.setUp(self, site=True)
ztapi.provideAdapter(IHTTPCredentials, ILoginPassword, BasicAuthAdapter)
ztapi.browserView(IPrincipalSource, "login",
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,12 +20,11 @@
from zope.interface.verify import verifyObject
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.site.tests import placefulsetup
+from zope.app.testing import ztapi, setup
+import zope.app.component.testing as placefulsetup
from zope.app.security.interfaces import PrincipalLookupError
from zope.publisher.interfaces.http import IHTTPCredentials
-from zope.app.tests import setup
from zope.app.pluggableauth import BTreePrincipalSource, \
SimplePrincipal, PluggableAuthenticationService, \
@@ -38,7 +37,7 @@
from zope.publisher.browser import TestRequest as Request
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
import base64
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagefolder.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagefolder.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagefolder.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,15 +25,13 @@
from zope.app.container.btree import BTreeContainer
from zope.fssync.server.entryadapter import ObjectEntryAdapter, AttrMapping
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.registration.interfaces import IRegistrationManager
-from zope.app.registration.interfaces import IRegisterableContainer
-from zope.app.registration.interfaces import RegisteredStatus
-from zope.app.registration.interfaces import UnregisteredStatus
-from zope.app.registration.interfaces import IRegisterable
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.interfaces.registration import IRegistrationManager
+from zope.app.component.interfaces.registration import IRegisterableContainer
+from zope.app.component.interfaces.registration import IRegisterable
from zope.app.container.constraints import ItemTypePrecondition
from zope.app.presentation import PageRegistration
-from zope.app.registration.registration import RegisterableContainer
+from zope.app.component.registration import RegisterableContainer
from zope.app.container.constraints import ContainerTypesConstraint
from zpt import IZPTTemplate
from zope.app.traversing.api import getPath
@@ -43,7 +41,7 @@
from zope.app.container.interfaces import IContainer
from zope.app.filerepresentation.interfaces import IDirectoryFactory
from zope.fssync.server.interfaces import IObjectDirectory
-from zope.app.registration.interfaces import IRegisterableContainer
+from zope.app.component.interfaces.registration import IRegisterableContainer
from zope.app.i18n import ZopeMessageIDFactory as _
class IPageFolderInfo(Interface):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/presentation.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/presentation.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/presentation.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,9 +23,8 @@
from zope.security.checker import NamesChecker, ProxyFactory
import zope.app.container.contained
-import zope.app.registration.interfaces
-import zope.app.site.interfaces
-import zope.app.adapter
+import zope.app.component.interfaces.registration
+import zope.app.component.adapter
import zope.app.interface.interfaces
import zope.component.interfaces
import zope.configuration.exceptions
@@ -36,15 +35,13 @@
from zope.app import zapi
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.dependable.interfaces import IDependable, DependencyError
-from zope.app.registration.interfaces import IRegistered
class GlobalViewRegistration(object):
"""Registrations representing global view service thingies."""
- implements(zope.app.registration.interfaces.IRegistration)
+ implements(zope.app.component.interfaces.registration.IRegistration)
- serviceType = zapi.servicenames.Adapters
- status = zope.app.registration.interfaces.ActiveStatus
+ status = zope.app.component.interfaces.registration.ActiveStatus
def __init__(self, context):
self.context = context
@@ -76,7 +73,7 @@
return _("Registered by ZCML")
class LocalLayer(
- zope.app.adapter.LocalAdapterRegistry,
+ zope.app.component.adapter.LocalAdapterRegistry,
zope.app.container.contained.Contained,
):
@@ -86,7 +83,7 @@
self.__parent__ = parent
self.__name__ = name
-class IViewRegistration(zope.app.adapter.IAdapterRegistration):
+class IViewRegistration(zope.app.component.interfaces.IAdapterRegistration):
required = zope.schema.Choice(
title = _(u"For interface"),
@@ -113,10 +110,9 @@
default = "default",
)
-class ViewRegistration(zope.app.registration.registration.SimpleRegistration):
+class ViewRegistration(zope.app.component.registration.SimpleRegistration):
implements(IViewRegistration)
- serviceType = zapi.servicenames.Adapters
provided = Interface
# For usageSummary(); subclass may override
@@ -161,6 +157,7 @@
return folder.resolve(self.factoryName)
factory = property(factory)
+
class IPageRegistration(IViewRegistration):
factoryName = zope.schema.BytesLine(
@@ -168,7 +165,7 @@
required = False,
)
- template = zope.app.registration.interfaces.ComponentPath(
+ template = zope.app.component.interfaces.registration.Component(
title = _(u"Page template"),
required = False,
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_pagefolder.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_pagefolder.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_pagefolder.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,12 +16,11 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.tests import ztapi
-from zope.app.tests import setup
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.testing import ztapi, setup
+from zope.app.component.testing import PlacefulSetup
from zope.app.presentation.pagefolder import PageFolder, IPageFolder
from zope.app.presentation.zpt import ZPTTemplate
-from zope.app.registration.interfaces import ActiveStatus
+from zope.app.component.interfaces.registration import ActiveStatus
from zope.interface import Interface
from zope.publisher.interfaces.browser import IBrowserRequest
from zope.app.registration.tests.test_registrationmanager \
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_presentation.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_presentation.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_presentation.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
from zope.app import zapi
from zope.interface import Interface, directlyProvides, implements
@@ -28,7 +28,6 @@
from zope.app.container.interfaces import IObjectRemovedEvent
from zope.app.folder import rootFolder
from zope.app.presentation.zpt import IZPTTemplate
-from zope.app.site.service import ServiceManager
from zope.app.registration.tests.iregistry import TestingIRegistry
from zope.app.site.tests.placefulsetup import PlacefulSetup
from zope.app.presentation.presentation import ViewRegistration
@@ -41,8 +40,7 @@
from zope.app.traversing.api import traverse
from zope.component.exceptions import ComponentLookupError
-from zope.component.interfaces import IServiceService
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi, setup
from zope.configuration.exceptions import ConfigurationError
from zope.proxy import removeAllProxies
@@ -122,10 +120,6 @@
run = PhonyTemplate()
-class PhonyServiceManager(ServiceManager):
-
- implements(IServiceService)
-
class ModuleFinder(object):
implements(IContained)
@@ -188,7 +182,7 @@
def setUp(self):
PlacefulSetup.setUp(self)
self.rootFolder = rootFolder()
- self.rootFolder.setSiteManager(PhonyServiceManager(self.rootFolder))
+ setup.createSiteManager(self.rootFolder)
default = traverse(self.rootFolder, '++etc++site/default')
self.__template = PhonyTemplate()
default['t'] = self.__template
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_zpt.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_zpt.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/tests/test_zpt.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,9 +22,9 @@
from zope.app.publisher.browser import BrowserView
# All this just to get zapi.getPath() work :(
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.interface import directlyProvides
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.location.traversing import LocationPhysicallyLocatable
Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/zpt.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/zpt.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/zpt.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
from zope.schema import Text, BytesLine, Bool
from zope.app.container.contained import Contained
-from zope.app.registration.interfaces import IRegisterable
+from zope.app.component.interfaces.registration import IRegisterable
from zope.fssync.server.entryadapter import ObjectEntryAdapter, AttrMapping
from zope.fssync.server.interfaces import IObjectFile
from zope.app.filerepresentation.interfaces import IReadFile, IWriteFile
Modified: Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,7 @@
from zope.app.container.contained import Contained
from zope.app.location import Location
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-from zope.app.utility.utility import queryNextUtility
+from zope.app.component import queryNextUtility
class PrincipalAnnotationUtility(Persistent, Contained):
"""Stores `IAnnotations` for `IPrinicipals`.
Modified: Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/principalannotation/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,10 +23,8 @@
from zope.app.principalannotation import PrincipalAnnotationUtility
from zope.app.principalannotation import AnnotationsForPrincipal
from zope.app.security.interfaces import IPrincipal
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import setup
-from zope.app.tests import ztapi
-from zope.app.utility.utility import LocalUtilityService
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import ztapi, setup
from interfaces import IPrincipalAnnotationUtility
class Principal(object):
@@ -63,7 +61,6 @@
def testGetFromLayered(self):
princeSomebody = Principal('somebody')
sm1 = self.makeSite('folder1')
- setup.addService(sm1, 'Utilities', LocalUtilityService())
subUtil = setup.addUtility(sm1, '', IPrincipalAnnotationUtility,
PrincipalAnnotationUtility())
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/browser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/browser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,10 +20,10 @@
"""
__docformat__ = 'restructuredtext'
+from zope.app import zapi
from zope.app.publication.publicationtraverse \
import PublicationTraverser as PublicationTraverser_
from zope.app.publication.http import BaseHTTPPublication
-from zope.component import queryViewProviding
from zope.publisher.interfaces.browser import IBrowserPublisher
from zope.security.checker import ProxyFactory
@@ -51,7 +51,7 @@
# ob is already proxied, so the result of calling a method will be
return ob.browserDefault(request)
else:
- adapter = queryViewProviding(ob, IBrowserPublisher, request , None)
+ adapter = zapi.queryMultiAdapter((ob, request), IBrowserPublisher)
if adapter is not None:
ob, path = adapter.browserDefault(request)
ob = ProxyFactory(ob)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/http.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/http.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/http.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,11 +16,11 @@
$Id$
"""
__docformat__ = 'restructuredtext'
+from zope.publisher.publish import mapply
+from zope.app import zapi
+from zope.app.http.interfaces import IHTTPException
from zope.app.publication.zopepublication import ZopePublication
-from zope.component import getView
-from zope.publisher.publish import mapply
-from zope.app.http.interfaces import IHTTPException
class BaseHTTPPublication(ZopePublication):
"""Base for HTTP-based protocol publications"""
@@ -38,6 +38,6 @@
def callObject(self, request, ob):
# Exception handling, dont try to call request.method
if not IHTTPException.providedBy(ob):
- ob = getView(ob, request.method, request)
+ ob = zapi.getMultiAdapter((ob, request), name=request.method)
ob = getattr(ob, request.method)
return mapply(ob, request.getPositionalArguments(), request)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/httpfactory.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/httpfactory.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/httpfactory.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -56,7 +56,7 @@
request = BrowserRequest(input_stream, output_steam, env)
request.setPublication(self._brower)
# Set the default skin
- adapters = zapi.getService(zapi.servicenames.Adapters)
+ adapters = zapi.getSiteManager().adapters
skin = adapters.lookup((providedBy(request),), IDefaultSkin, '')
if skin is not None:
directlyProvides(request, directlyProvidedBy(request)+skin)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/publicationtraverse.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/publicationtraverse.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/publicationtraverse.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,12 +16,12 @@
$Id$
"""
__docformat__ = 'restructuredtext'
+from types import StringTypes
-from zope.component import queryViewProviding
from zope.publisher.interfaces import NotFound
-from types import StringTypes
from zope.security.checker import ProxyFactory
+from zope.app import zapi
from zope.app.traversing.namespace import namespaceLookup
from zope.app.traversing.namespace import nsParse
from zope.app.traversing.interfaces import TraversalError
@@ -56,7 +56,8 @@
ob2 = ob.publishTraverse(request, nm)
else:
# self is marker
- adapter = queryViewProviding(ob, IPublishTraverse, request, self)
+ adapter = zapi.queryMultiAdapter((ob, request), IPublishTraverse,
+ default=self)
if adapter is not self:
ob2 = adapter.publishTraverse(request, nm)
else:
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_browserpublication.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_browserpublication.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from StringIO import StringIO
from zope.security.interfaces import ForbiddenAttribute
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_http.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_http.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_http.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -24,8 +24,8 @@
import zope.app.publication.http
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
class I(Interface):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_httpfactory.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_httpfactory.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_httpfactory.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,7 +30,7 @@
from zope.app.publication.browser import BrowserPublication
from zope.app.publication.http import HTTPPublication
from zope.app.publication.xmlrpc import XMLRPCPublication
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
class Test(PlacelessSetup, TestCase):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_simplecomponenttraverser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_simplecomponenttraverser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_simplecomponenttraverser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,8 @@
from zope.interface import Interface
from zope.app.publication.traversers import SimpleComponentTraverser
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
class I(Interface):
pass
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_xmlrpcpublication.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_xmlrpcpublication.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_xmlrpcpublication.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,6 @@
BasePublicationTests
from zope.app.publication.traversers import TestTraverser
from zope.app.publication.xmlrpc import XMLRPCPublication
-from zope.component import getService
from zope.interface import Interface, implements
from zope.proxy import removeAllProxies
from zope.publisher.interfaces import NotFound
@@ -29,7 +28,7 @@
from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
from zope.publisher.interfaces.xmlrpc import IXMLRPCPublisher
from zope.publisher.xmlrpc import TestRequest
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
class SimpleObject(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_zopepublication.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/tests/test_zopepublication.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,8 +26,6 @@
from zope.interface.verify import verifyClass
from zope.interface import implements, classImplements, implementedBy
from zope.i18n.interfaces import IUserPreferredCharsets
-from zope.component import getGlobalServices
-from zope.component.interfaces import IServiceService
from zope.component.exceptions import ComponentLookupError
from zope.publisher.base import TestPublication, TestRequest
from zope.publisher.http import IHTTPRequest, HTTPCharsets
@@ -37,12 +35,10 @@
from zope.security.management import setSecurityPolicy, queryInteraction
from zope.app import zapi
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import setup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import setup, ztapi
from zope.app.error.interfaces import IErrorReportingUtility
-from zope.app.servicenames import Authentication
from zope.app.location.interfaces import ILocation
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.security.principalregistry import principalRegistry
@@ -50,6 +46,7 @@
from zope.app.publication.zopepublication import ZopePublication
from zope.app.folder import Folder, rootFolder
from zope.app.location import Location
+from zope.app.security.interfaces import IAuthenticationUtility
class Principal(object):
implements(IPrincipal)
@@ -92,26 +89,6 @@
def raising(self, info, request=None):
self.exceptions.append([info, request])
-
-class UtilityService(object):
-
- utility = None
-
- def getUtility(self, interface, name=''):
- return self.utility
-
-
-class ServiceManager(object):
- implements(IServiceService) # a dirty lie
-
- def __init__(self, utils):
- self.utils = utils
-
- def getService(self, name):
- if name == 'Utilities':
- return self.utils
- raise ComponentLookupError(name)
-
class LocatableObject(Location):
def foo(self):
@@ -378,10 +355,8 @@
def testAbortTransactionWithErrorReportingUtility(self):
# provide our fake error logging service
- sm = getGlobalServices()
- utils = sm.getService('Utilities')
- utils.provideUtility(IErrorReportingUtility,
- ErrorReportingUtility())
+ sm = zapi.getGlobalSiteManager()
+ sm.provideUtility(IErrorReportingUtility, ErrorReportingUtility())
class FooError(Exception):
pass
@@ -399,7 +374,7 @@
self.assertEqual(last_txn_info, new_txn_info)
# instead, we expect a message in our logging service
- error_log = utils.getUtility(IErrorReportingUtility)
+ error_log = zapi.getUtility(IErrorReportingUtility)
self.assertEqual(len(error_log.exceptions), 1)
error_info, request = error_log.exceptions[0]
self.assertEqual(error_info[0], FooError)
@@ -410,22 +385,24 @@
class ZopePublicationTests(BasePublicationTests):
def testPlacefulAuth(self):
+ setup.setUpTraversal()
+ setup.setUpSiteManagerLookup()
principalRegistry.defineDefaultPrincipal('anonymous', '')
root = self.db.open().root()
app = root[ZopePublication.root_name]
- app['f1'] = Folder()
+ app['f1'] = rootFolder()
f1 = app['f1']
f1['f2'] = Folder()
- utilservice1 = UtilityService()
- utilservice1.utility = AuthUtility1()
- f1.setSiteManager(ServiceManager(utilservice1))
+ sm1 = setup.createSiteManager(f1)
+ setup.addUtility(sm1, '', IAuthenticationUtility, AuthUtility1())
+
f2 = f1['f2']
- utilservice2 = UtilityService()
- utilservice2.utility = AuthUtility2()
- f2.setSiteManager(ServiceManager(utilservice2))
+ sm2 = setup.createSiteManager(f2)
+ setup.addUtility(sm2, '', IAuthenticationUtility, AuthUtility2())
get_transaction().commit()
+
from zope.app.container.interfaces import ISimpleReadContainer
from zope.app.container.traversal import ContainerTraverser
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/traversers.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/traversers.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/traversers.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,11 +17,12 @@
"""
__docformat__ = 'restructuredtext'
+from zope.app import zapi
+from zope.component.interfaces import IDefaultViewName
from zope.interface import providedBy, implements
from zope.publisher.interfaces import Unauthorized, NotFound
from zope.publisher.interfaces.browser import IBrowserPublisher
from zope.publisher.interfaces.xmlrpc import IXMLRPCPublisher
-from zope.component import queryView, getView, getDefaultViewName
class SimpleComponentTraverser(object):
"""Browser traverser for simple components that can only traverse to views
@@ -39,7 +40,7 @@
def publishTraverse(self, request, name):
ob = self.context
- view = queryView(ob, name, request)
+ view = zapi.queryMultiAdapter((ob, request), name=name)
if view is None:
raise NotFound(ob, name)
return view
@@ -55,7 +56,8 @@
def browserDefault(self, request):
ob = self.context
- view_name = getDefaultViewName(ob, request)
+ view_name = zapi.getSiteManager().adapters.lookup(
+ map(providedBy, (ob, request)), IDefaultViewName)
view = self.publishTraverse(request, view_name)
if hasattr(view, 'browserDefault'):
view, path = view.browserDefault(request)
@@ -78,7 +80,8 @@
ob = self.context
if providedBy(ob):
- view_name = getDefaultViewName(ob, request)
+ view_name = zapi.getSiteManager().adapters.lookup(
+ map(providedBy, (ob, request)), IDefaultViewName)
return ob, (("@@%s" % view_name),)
return ob, ()
@@ -86,7 +89,7 @@
def publishTraverse(self, request, name):
ob = self.context
if name.startswith('@@'):
- return getView(ob, name[6:], request)
+ return zapi.getMultiAdapter((ob, request), name=name[6:])
if name.startswith('_'):
raise Unauthorized, name
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publication/zopepublication.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publication/zopepublication.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -27,6 +27,7 @@
from zope.event import notify
from zope.security.interfaces import Unauthorized
from zope.component.exceptions import ComponentLookupError
+from zope.component.interfaces import IDefaultViewName
from zope.interface import implements, providedBy
from zope.publisher.publish import mapply
from zope.publisher.interfaces import Retry, IExceptionSideEffects
@@ -95,10 +96,8 @@
sm = removeSecurityProxy(ob).getSiteManager()
- try:
- utils = sm.getService(zapi.servicenames.Utilities)
- auth = utils.getUtility(IAuthenticationUtility)
- except ComponentLookupError:
+ auth = sm.queryUtility(IAuthenticationUtility)
+ if auth is None:
# No auth utility here
return
@@ -296,9 +295,11 @@
# Give the exception instance its location and look up the
# view.
exception = LocationProxy(exc_info[1], loc, '')
- name = zapi.queryDefaultViewName(exception, request)
+ name = zapi.getSiteManager().adapters.lookup(
+ map(providedBy, (exception, request)), IDefaultViewName)
if name is not None:
- view = zapi.queryView(exception, name, request)
+ view = zapi.queryMultiAdapter(
+ (exception, request), name=name)
except:
# Problem getting a view for this exception. Log an error.
tryToLogException(
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/fields.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/fields.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/fields.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -78,7 +78,7 @@
Test 3: Get the menu from the utility service
---------------------------------------------
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IMenuItemType, menu1, 'menu1')
>>> field.fromUnicode('menu1') is menu1
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/i18nresourcemeta.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/i18nresourcemeta.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/i18nresourcemeta.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -104,7 +104,7 @@
self._context.action(
discriminator = ('i18n-resource', self.name, self.type, self.layer),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(self.layer,), Interface, self.name, factory,
self._context.info)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/icon.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/icon.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/icon.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -95,7 +95,7 @@
_context.action(
discriminator = ('view', name, vfactory, layer),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, layer), Interface, name, vfactory, _context.info)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/menu.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/menu.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/menu.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -114,7 +114,7 @@
item itself, or (2) the filter returns `False`, in which case the menu
item should also not be shown.
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.app.security.interfaces import IPermission
>>> from zope.app.security.permission import Permission
>>> perm = Permission('perm', 'Permission')
@@ -281,7 +281,7 @@
>>> from zope.publisher.browser import TestRequest
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> def defineMenuItem(menuItemType, for_, title, action=u'', order=0):
... newclass = type(title, (BrowserMenuItem,),
... {'title':title, 'action':action, 'order':order})
@@ -506,8 +506,8 @@
>>> context.actions
[]
>>> items.menuItem(context, u'view.html', 'View')
- >>> context.actions[0]['args'][:2]
- ('Adapters', 'register')
+ >>> context.actions[0]['args'][0]
+ 'provideAdapter'
>>> len(context.actions)
4
"""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/metaconfigure.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -288,14 +288,14 @@
"""Set the default skin.
>>> from zope.interface import directlyProvides
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> class Skin1: pass
>>> directlyProvides(Skin1, ISkin)
>>> ztapi.provideUtility(ISkin, Skin1, 'Skin1')
>>> setDefaultSkin('Skin1')
- >>> adapters = zapi.getService(zapi.servicenames.Adapters)
+ >>> adapters = zapi.getSiteManager().adapters
Lookup the default skin for a request that has the
@@ -303,7 +303,7 @@
True
"""
skin = zapi.getUtility(ISkin, name)
- handler('Adapters', 'register',
+ handler('provideAdapter',
(IBrowserRequest,), IDefaultSkin, '', skin, info),
def defaultSkin(_context, name):
@@ -321,7 +321,7 @@
_context.action(
discriminator = ('defaultViewName', for_, type, name),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, type), IDefaultViewName, '', name, _context.info)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -36,5 +36,5 @@
name = name[12:]
site = getSite()
- url = str(zapi.getViewProviding(site, IAbsoluteURL, self.request))
+ url = str(zapi.getMultiAdapter((site, self.request), IAbsoluteURL))
return "%s/@@/%s" % (url, name)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resourcemeta.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resourcemeta.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resourcemeta.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -58,7 +58,7 @@
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(layer,), Interface, name, factory, _context.info),
)
@@ -79,6 +79,6 @@
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(layer,), Interface, name, factory, _context.info),
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resources.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resources.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/resources.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -32,12 +32,12 @@
def publishTraverse(self, request, name):
'''See interface IBrowserPublisher'''
- resource = zapi.queryResource(name, request)
+ resource = zapi.queryAdapter(request, name=name)
if resource is None:
raise NotFound(self, name)
- adapters = zapi.getService(zapi.servicenames.Adapters)
- locate(resource, adapters, name)
+ sm = zapi.getSiteManager()
+ locate(resource, sm, name)
return resource
def browserDefault(self, request):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/support.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/support.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/support.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,7 +20,7 @@
from zope.component.service import serviceManager
from zope.app.component.hooks import setSite
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
from zope.app.traversing.interfaces import IContainmentRoot
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_addMenuItem.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_addMenuItem.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_addMenuItem.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,7 @@
<InterfaceClass zope.component.interfaces.IFactory>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X'),
<function handler>,
- ('Utilities',
- 'provideUtility',
+ ('provideUtility',
<InterfaceClass zope.component.interfaces.IFactory>,
<zope.component.factory.Factory object>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X')),
@@ -36,8 +35,7 @@
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
@@ -100,8 +98,7 @@
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
@@ -135,8 +132,7 @@
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
@@ -169,8 +165,7 @@
<InterfaceClass zope.component.interfaces.IFactory>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X'),
<function handler>,
- ('Utilities',
- 'provideUtility',
+ ('provideUtility',
<InterfaceClass zope.component.interfaces.IFactory>,
<zope.component.factory.Factory object>,
'BrowserAdd__zope.app.publisher.browser.tests.test_addMenuItem.X')),
@@ -184,8 +179,7 @@
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
- ('Adapters',
- 'register',
+ ('provideAdapter',
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
@@ -204,7 +198,7 @@
<function provideInterface>,
('',
<InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>)))
-"""
+ """
def test_suite():
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,7 +22,7 @@
from zope.interface import Interface, implements, directlyProvides, providedBy
import zope.security.management
-from zope.component.service import serviceManager
+from zope.component.interfaces import IDefaultViewName
from zope.configuration.xmlconfig import xmlconfig, XMLConfig
from zope.configuration.exceptions import ConfigurationError
from zope.publisher.browser import TestRequest
@@ -41,9 +41,7 @@
from zope.app.publisher.interfaces.browser import IMenuItemType
from zope.app.security.permission import Permission
from zope.app.security.interfaces import IPermission
-from zope.app.tests import placelesssetup
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import placelesssetup, ztapi
from zope.app.traversing.adapters import DefaultTraversable
from zope.app.traversing.interfaces import ITraversable
@@ -92,7 +90,7 @@
def index(self):
return self
-class Test(PlacelessSetup, unittest.TestCase):
+class Test(placelesssetup.PlacelessSetup, unittest.TestCase):
def setUp(self):
super(Test, self).setUp()
@@ -101,7 +99,7 @@
def testPage(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
xmlconfig(StringIO(template % (
@@ -116,11 +114,11 @@
'''
)))
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assert_(issubclass(v.__class__, V1))
def testPageWithClassWithMenu(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -144,12 +142,12 @@
menuItem = getFirstMenuItem(test_menu, ob, TestRequest())
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
def testPageWithTemplateWithMenu(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -172,12 +170,12 @@
menuItem = getFirstMenuItem(test_menu, ob, TestRequest())
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
def testPageInPagesWithTemplateWithMenu(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -202,12 +200,12 @@
menuItem = getFirstMenuItem(test_menu, ob, TestRequest())
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
def testPageInPagesWithClassWithMenu(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -234,12 +232,12 @@
menuItem = getFirstMenuItem(test_menu, ob, TestRequest())
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
def testDefaultView(self):
- self.assertEqual(zapi.queryView(ob, 'test', request,
- None), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template % (
'''
@@ -249,12 +247,13 @@
'''
)))
- self.assertEqual(zapi.getDefaultViewName(ob, request
- ), 'test')
+ self.assertEqual(
+ zapi.getSiteManager().adapters.lookup(
+ map(providedBy, (ob, request)), IDefaultViewName), 'test')
def testSkinResource(self):
self.assertEqual(
- zapi.queryResource('test', Request(IV), None), None)
+ zapi.queryAdapter(Request(IV), name='test'), None)
xmlconfig(StringIO(template % (
'''
@@ -271,16 +270,17 @@
)))
self.assertEqual(
- zapi.queryResource('test', request, None).__class__, R1)
+ zapi.queryAdapter(request, name='test').__class__, R1)
zmi = zapi.getUtility(ISkin, 'zmi')
self.assertEqual(
- zapi.queryResource('test', TestRequest(skin=zmi), None).__class__,
+ zapi.queryAdapter(TestRequest(skin=zmi), name='test').__class__,
RZMI)
def testDefaultSkin(self):
request = TestRequest()
- self.assertEqual(zapi.queryView(ob, 'test', request, None), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template % (
'''
<browser:layer name="zmi" />
@@ -303,15 +303,16 @@
)))
# Simulate Zope Publication behavior in beforeTraversal()
- adapters = zapi.getService(zapi.servicenames.Adapters)
+ adapters = zapi.getSiteManager().adapters
skin = adapters.lookup((providedBy(request),), IDefaultSkin, '')
directlyProvides(request, skin)
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assert_(issubclass(v.__class__, VZMI))
def testSkinPage(self):
- self.assertEqual(zapi.queryView(ob, 'test', request, None), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template % (
'''
@@ -333,14 +334,14 @@
'''
)))
- v = zapi.queryView(ob, 'test', request)
+ v = zapi.queryMultiAdapter((ob, request), name='test')
self.assert_(issubclass(v.__class__, V1))
zmi = zapi.getUtility(ISkin, 'zmi')
- v = zapi.queryView(ob, 'test', TestRequest(skin=zmi))
+ v = zapi.queryMultiAdapter((ob, TestRequest(skin=zmi)), name='test')
self.assert_(issubclass(v.__class__, VZMI))
def testI18nResource(self):
- self.assertEqual(zapi.queryResource('test', request, None), None)
+ self.assertEqual(zapi.queryAdapter(request, name='test'), None)
path1 = os.path.join(tests_path, 'testfiles', 'test.pt')
path2 = os.path.join(tests_path, 'testfiles', 'test2.pt')
@@ -354,9 +355,9 @@
''' % (path1, path2)
)))
- v = zapi.getResource('test', request)
+ v = zapi.getAdapter(request, name='test')
self.assertEqual(
- zapi.queryResource('test', request).__class__,
+ zapi.queryAdapter(request, name='test').__class__,
I18nFileResource)
self.assertEqual(v._testData('en'), open(path1, 'rb').read())
self.assertEqual(v._testData('fr'), open(path2, 'rb').read())
@@ -396,7 +397,7 @@
'''
))
- v = zapi.getView(ob, 'test', request)
+ v = zapi.getMultiAdapter((ob, request), name='test')
v = ProxyFactory(v)
self.assertEqual(v.index(), 'V1 here')
self.assertRaises(Exception, getattr, v, 'action')
@@ -414,7 +415,7 @@
'''
))
- v = zapi.getView(ob, 'test', request)
+ v = zapi.getMultiAdapter((ob, request), name='test')
v = ProxyFactory(v)
self.assertEqual(v.action(), 'done')
self.assertRaises(Exception, getattr, v, 'index')
@@ -433,7 +434,7 @@
'''
))
- v = zapi.getView(ob, 'test', request)
+ v = zapi.getMultiAdapter((ob, request), name='test')
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
@@ -451,7 +452,7 @@
'''
))
- v = zapi.getView(ob, 'test', request)
+ v = zapi.getMultiAdapter((ob, request), name='test')
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
@@ -469,7 +470,7 @@
'''
))
- v = zapi.getView(ob, 'test', request)
+ v = zapi.getMultiAdapter((ob, request), name='test')
self.assertEqual(v.index(), v)
self.assert_(IBrowserPublisher.providedBy(v))
@@ -490,7 +491,8 @@
def testPageViews(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
@@ -508,15 +510,16 @@
''' % test3
))
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
self.assertEqual(v(), 'V1 here')
- v = zapi.getView(ob, 'action.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='action.html')
self.assertEqual(v(), 'done')
- v = zapi.getView(ob, 'test.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='test.html')
self.assertEqual(str(v()), '<html><body><p>done</p></body></html>\n')
def testNamedViewPageViewsCustomTraversr(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template %
'''
@@ -533,7 +536,7 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
self.assertEqual(view.browserDefault(request)[1], (u'index.html', ))
@@ -547,7 +550,8 @@
def testNamedViewNoPagesForCallable(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template %
'''
@@ -560,12 +564,13 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
self.assertEqual(view.browserDefault(request), (view, ()))
def testNamedViewNoPagesForNonCallable(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template %
'''
@@ -578,12 +583,13 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
self.assertEqual(getattr(view, 'browserDefault', None), None)
def testNamedViewPageViewsNoDefault(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
@@ -602,7 +608,7 @@
''' % test3
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
self.assertEqual(view.browserDefault(request)[1], (u'index.html', ))
@@ -618,7 +624,8 @@
self.assertEqual(str(v()), '<html><body><p>done</p></body></html>\n')
def testNamedViewPageViewsWithDefault(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
test3 = os.path.join(tests_path, 'testfiles', 'test3.pt')
xmlconfig(StringIO(template %
@@ -638,7 +645,7 @@
''' % test3
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
self.assertEqual(view.browserDefault(request)[1], (u'test.html', ))
@@ -671,7 +678,7 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
view.publishTraverse(request, 'index.html')
@@ -698,7 +705,7 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
view = removeSecurityProxy(view)
view.publishTraverse(request, 'index.html')
@@ -706,7 +713,7 @@
ztapi.provideUtility(IPermission, Permission('p', 'P'), 'p')
request = TestRequest()
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
xmlconfig(StringIO(template %
@@ -727,16 +734,16 @@
'''
))
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
v = ProxyFactory(v)
zope.security.management.getInteraction().add(request)
self.assertRaises(Exception, v)
- v = zapi.getView(ob, 'action.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='action.html')
v = ProxyFactory(v)
self.assertRaises(Exception, v)
def testProtectedNamedViewPageViews(self):
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
xmlconfig(StringIO(template %
@@ -758,14 +765,15 @@
'''
))
- view = zapi.getView(ob, 'test', request)
+ view = zapi.getMultiAdapter((ob, request), name='test')
self.assertEqual(view.browserDefault(request)[1], (u'index.html', ))
v = view.publishTraverse(request, 'index.html')
self.assertEqual(v(), 'V1 here')
def testSkinnedPageView(self):
- self.assertEqual(zapi.queryView(ob, 'test', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+ None)
xmlconfig(StringIO(template %
'''
@@ -791,16 +799,17 @@
'''
))
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
self.assertEqual(v(), 'V1 here')
skinny = zapi.getUtility(ISkin, 'skinny')
- v = zapi.getView(ob, 'index.html', TestRequest(skin=skinny))
+ v = zapi.getMultiAdapter((ob, TestRequest(skin=skinny)),
+ name='index.html')
self.assertEqual(v(), 'done')
def testFile(self):
path = os.path.join(tests_path, 'testfiles', 'test.pt')
- self.assertEqual(zapi.queryResource('test', request), None)
+ self.assertEqual(zapi.queryAdapter(request, name='test'), None)
xmlconfig(StringIO(template %
'''
@@ -811,7 +820,7 @@
''' % path
))
- r = zapi.getResource('index.html', request)
+ r = zapi.getAdapter(request, name='index.html')
self.assertEquals(r.__class__, FileResource)
r = ProxyFactory(r)
self.assertEqual(r.__name__, "index.html")
@@ -829,9 +838,7 @@
def testSkinResource(self):
- self.assertEqual(
- zapi.queryResource('test', request, None),
- None)
+ self.assertEqual(zapi.queryAdapter(request, name='test'), None)
path = os.path.join(tests_path, 'testfiles', 'test.pt')
@@ -844,18 +851,18 @@
''' % path
)))
- self.assertEqual(zapi.queryResource('test', request), None)
+ self.assertEqual(zapi.queryAdapter(request, name='test'), None)
zmi = zapi.getUtility(ISkin, 'zmi')
- r = zapi.getResource('test', TestRequest(skin=zmi))
+ r = zapi.getAdapter(TestRequest(skin=zmi), name='test')
r = removeSecurityProxy(r)
self.assertEqual(r._testData(), open(path, 'rb').read())
def test_template_page(self):
path = os.path.join(tests_path, 'testfiles', 'test.pt')
- self.assertEqual(zapi.queryView(ob, 'index.html', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='index.html'), None)
xmlconfig(StringIO(template %
'''
@@ -867,14 +874,14 @@
''' % path
))
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
self.assertEqual(v().strip(), '<html><body><p>test</p></body></html>')
def testtemplateWClass(self):
path = os.path.join(tests_path, 'testfiles', 'test2.pt')
- self.assertEqual(zapi.queryView(ob, 'index.html', request),
- None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='index.html'), None)
xmlconfig(StringIO(template %
'''
@@ -887,7 +894,7 @@
''' % path
))
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
self.assertEqual(v().strip(), '<html><body><p>42</p></body></html>')
def testProtectedtemplate(self):
@@ -895,7 +902,7 @@
path = os.path.join(tests_path, 'testfiles', 'test.pt')
request = TestRequest()
- self.assertEqual(zapi.queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
xmlconfig(StringIO(template %
@@ -922,12 +929,12 @@
''' % path
))
- v = zapi.getView(ob, 'xxx.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='xxx.html')
v = ProxyFactory(v)
zope.security.management.getInteraction().add(request)
self.assertRaises(Exception, v)
- v = zapi.getView(ob, 'index.html', request)
+ v = zapi.getMultiAdapter((ob, request), name='index.html')
v = ProxyFactory(v)
self.assertEqual(v().strip(), '<html><body><p>test</p></body></html>')
@@ -966,7 +973,8 @@
def testViewThatProvidesAnInterface(self):
request = TestRequest()
- self.assertEqual(zapi.queryView(ob, 'test', request, None), None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), IV, name='test'), None)
xmlconfig(StringIO(template %
'''
@@ -979,7 +987,7 @@
'''
))
- v = zapi.queryView(ob, 'test', request, providing=IV)
+ v = zapi.queryMultiAdapter((ob, request), IV, name='test')
self.assertEqual(v, None)
xmlconfig(StringIO(template %
@@ -994,12 +1002,12 @@
'''
))
- v = zapi.queryView(ob, 'test', request, providing=IV)
+ v = zapi.queryMultiAdapter((ob, request), IV, name='test')
self.assert_(isinstance(v, V1))
def testUnnamedViewThatProvidesAnInterface(self):
request = TestRequest()
- self.assertEqual(zapi.queryView(ob, '', request, None, providing=IV),
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), IV),
None)
xmlconfig(StringIO(template %
@@ -1012,7 +1020,7 @@
'''
))
- v = zapi.queryView(ob, '', request, None, providing=IV)
+ v = zapi.queryMultiAdapter((ob, request), IV)
self.assertEqual(v, None)
xmlconfig(StringIO(template %
@@ -1026,7 +1034,7 @@
'''
))
- v = zapi.queryView(ob, '', request, None, providing=IV)
+ v = zapi.queryMultiAdapter((ob, request), IV)
self.assert_(isinstance(v, V1))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directoryresource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directoryresource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_directoryresource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.interface import implements
from zope.app import zapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.publisher.browser.directoryresource import \
DirectoryResourceFactory
from zope.app.container.contained import Contained
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fields.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fields.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fields.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
def test_suite():
return unittest.TestSuite((
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fileresource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fileresource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_fileresource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,8 +23,8 @@
from zope.security.proxy import removeSecurityProxy
from zope.security.checker import NamesChecker
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
from zope.publisher.http import IHTTPRequest
from zope.publisher.http import HTTPCharsets
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_icondirective.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_icondirective.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -30,9 +30,9 @@
import zope.app.publisher.browser
from zope.app import zapi
from zope.app.component.tests.views import IC
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
from zope.app.publisher.browser.tests import support
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.traversing.interfaces import IContainmentRoot
@@ -68,7 +68,8 @@
defineCheckers()
def test(self):
- self.assertEqual(zapi.queryView(ob, 'zmi_icon', request), None)
+ self.assertEqual(zapi.queryMultiAdapter((ob, request), name='zmi_icon'),
+ None)
import zope.app.publisher.browser.tests as p
path = os.path.dirname(p.__file__)
@@ -82,7 +83,7 @@
''' % path
)))
- view = zapi.getView(ob, 'zmi_icon', request)
+ view = zapi.getMultiAdapter((ob, request), name='zmi_icon')
rname = 'zope-app-component-tests-views-IC-zmi_icon.gif'
self.assertEqual(
view(),
@@ -90,13 +91,14 @@
'width="16" height="16" border="0" />'
% rname)
- resource = ProxyFactory(zapi.getResource(rname, request))
+ resource = ProxyFactory(zapi.getAdapter(request, name=rname))
self.assertRaises(Forbidden, getattr, resource, '_testData')
resource = removeSecurityProxy(resource)
self.assertEqual(resource._testData(), open(path, 'rb').read())
def testResource(self):
- self.assertEqual(zapi.queryView(ob, 'zmi_icon', request), None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='zmi_icon'), None)
import zope.app.publisher.browser.tests as p
path = os.path.dirname(p.__file__)
@@ -112,7 +114,7 @@
''' % path
)))
- view = zapi.getView(ob, 'zmi_icon', request)
+ view = zapi.getMultiAdapter((ob, request), name='zmi_icon')
rname = "zmi_icon_res"
self.assertEqual(
view(),
@@ -120,14 +122,15 @@
'height="16" border="0" />'
% rname)
- resource = ProxyFactory(zapi.getResource(rname, request))
+ resource = ProxyFactory(zapi.getAdapter(request, name=rname))
self.assertRaises(Forbidden, getattr, resource, '_testData')
resource = removeSecurityProxy(resource)
self.assertEqual(resource._testData(), open(path, 'rb').read())
def testResourceErrors(self):
- self.assertEqual(zapi.queryView(ob, 'zmi_icon', request), None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='zmi_icon'), None)
import zope.app.publisher.browser.tests as p
path = os.path.dirname(p.__file__)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menu.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menu.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menu.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
import unittest
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
def test_suite():
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menudirectives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menudirectives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_menudirectives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.publisher.interfaces.browser import IBrowserPublisher
from zope.security.interfaces import Unauthorized, Forbidden
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
import zope.app.publisher.browser
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,11 +19,11 @@
from unittest import TestCase, main, makeSuite
from zope.publisher.interfaces import NotFound
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.security.checker import NamesChecker
from zope.publisher.browser import TestRequest
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.publisher.browser.pagetemplateresource import \
PageTemplateResourceFactory
from zope.app.traversing.interfaces import ITraversable
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.app.publisher.browser.resource import Resource
from zope.app.publisher.browser.tests import support
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
class TestResource(support.SiteHandler, PlacelessSetup, unittest.TestCase):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resources.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resources.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/test_resources.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,9 +16,8 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.i18n.interfaces import IUserPreferredCharsets
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/testi18nfileresource.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/testi18nfileresource.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/tests/testi18nfileresource.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
from zope.publisher.interfaces import NotFound
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
from zope.i18n.interfaces import IUserPreferredCharsets, IUserPreferredLanguages
@@ -33,7 +33,6 @@
from zope.app.publisher.fileresource import File
import zope.app.publisher.browser.tests as p
-from zope.app.component.metaconfigure import managerHandler
from zope.i18n.interfaces import INegotiator
from zope.i18n.negotiator import negotiator
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/viewmeta.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/viewmeta.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/browser/viewmeta.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -163,7 +163,7 @@
_context.action(
discriminator = ('view', for_, name, IBrowserRequest, layer),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, layer), Interface, name, new_class, _context.info),
)
@@ -171,7 +171,7 @@
# pages, which are just a short-hand for multiple page directives.
# Note that a class might want to access one of the defined
-# templates. If it does though, it should use getView.
+# templates. If it does though, it should use getMultiAdapter.
class pages(object):
@@ -273,7 +273,7 @@
if name in pages:
return getattr(self, pages[name])
- view = zapi.queryView(self, name, request)
+ view = zapi.queryMultiAdapter((self, request), name=name)
if view is not None:
return view
@@ -286,7 +286,7 @@
if name in pages:
return getattr(self, pages[name])
- view = zapi.queryView(self, name, request)
+ view = zapi.queryMultiAdapter((self, request), name=name)
if view is not None:
return view
@@ -339,7 +339,7 @@
_context.action(
discriminator = ('view', (for_, layer), name, self.provides),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, layer), self.provides, name, newclass,
_context.info),
)
@@ -362,7 +362,7 @@
_context.action(
discriminator = ('defaultViewName', for_, IBrowserRequest, name),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, IBrowserRequest), IDefaultViewName, '', name,
_context.info)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/metaconfigure.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/metaconfigure.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -69,7 +69,7 @@
_context.action(
discriminator = ('view', for_, name, IXMLRPCRequest),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, IXMLRPCRequest), Interface, name, class_,
_context.info)
)
@@ -89,7 +89,7 @@
_context.action(
discriminator = ('view', for_, name, IXMLRPCRequest),
callable = handler,
- args = (zapi.servicenames.Adapters, 'register',
+ args = ('provideAdapter',
(for_, IXMLRPCRequest), Interface, name, new_class,
_context.info)
)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/publisher/xmlrpc/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,14 +20,14 @@
from zope.configuration import xmlconfig
from zope.configuration.exceptions import ConfigurationError
from zope.app.component.tests.views import IC, V1
-from zope.component import getView, queryView, getDefaultViewName
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.security.proxy import ProxyFactory
from zope.component.tests.request import Request
from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
+from zope.app import zapi
from zope.app.publisher import xmlrpc
from zope.interface import implements
@@ -42,33 +42,35 @@
class DirectivesTest(PlacelessSetup, unittest.TestCase):
def testView(self):
- self.assertEqual(queryView(ob, 'test', request), None)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='test'), None)
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- self.assertEqual(queryView(ob, 'test', request).__class__, V1)
+ self.assertEqual(
+ zapi.queryMultiAdapter((ob, request), name='test').__class__, V1)
def testInterfaceProtectedView(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'test2', request)
+ v = zapi.getMultiAdapter((ob, request), name='test2')
v = ProxyFactory(v)
self.assertEqual(v.index(), 'V1 here')
self.assertRaises(Exception, getattr, v, 'action')
def testAttributeProtectedView(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'test3', request)
+ v = zapi.getMultiAdapter((ob, request), name='test3')
v = ProxyFactory(v)
self.assertEqual(v.action(), 'done')
self.assertRaises(Exception, getattr, v, 'index')
def testInterfaceAndAttributeProtectedView(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'test4', request)
+ v = zapi.getMultiAdapter((ob, request), name='test4')
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
def testDuplicatedInterfaceAndAttributeProtectedView(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'test5', request)
+ v = zapi.getMultiAdapter((ob, request), name='test5')
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
@@ -78,9 +80,9 @@
def test_no_name(self):
xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'index', request)
+ v = zapi.getMultiAdapter((ob, request), name='index')
self.assertEqual(v(), 'V1 here')
- v = getView(ob, 'action', request)
+ v = zapi.getMultiAdapter((ob, request), name='action')
self.assertEqual(v(), 'done')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -218,8 +218,7 @@
kw['script'] = self
kw['context'] = zapi.getParent(self)
- service = zapi.getService(Utilities)
- interpreter = service.queryUtility(IInterpreter, 'text/server-python')
+ interpreter = zapi.queryUtility(IInterpreter, 'text/server-python')
return interpreter.evaluate(self._v_compiled, kw)
def _print_usrc(match):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pythonpage/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.app.interpreter.interfaces import IInterpreter
from zope.app.interpreter.python import PythonInterpreter
from zope.app.location.traversing import LocationPhysicallyLocatable
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.traversing.adapters import RootPhysicallyLocatable
from zope.component.servicenames import Utilities
from zope.interface import implements
@@ -38,9 +38,8 @@
def setUp(test):
placelesssetup.setUp()
- service = zapi.getGlobalService(Utilities)
- service.provideUtility(IInterpreter, PythonInterpreter,
- 'text/server-python')
+ sm = zapi.getGlobalSiteManager()
+ sm.provideUtility(IInterpreter, PythonInterpreter, 'text/server-python')
ztapi.provideAdapter(None, IPhysicallyLocatable,
LocationPhysicallyLocatable)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/rdb/metaconfigure.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/rdb/metaconfigure.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/rdb/metaconfigure.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -31,8 +31,8 @@
Uses the Utility Service for registering
"""
- utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilities.provideUtility(IZopeDatabaseAdapter, connection, name)
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IZopeDatabaseAdapter, connection, name)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/rdb/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/rdb/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/rdb/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
from zope.app import zapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.component import getUtilitiesFor, queryUtility
from zope.configuration import xmlconfig
from zope.app.rdb.interfaces import IZopeDatabaseAdapter
Modified: Zope3/branches/srichter-blow-services/src/zope/app/renderer/tests/test_vocabulary.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/renderer/tests/test_vocabulary.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/renderer/tests/test_vocabulary.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,12 +18,12 @@
import unittest
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.renderer import SourceFactory
from zope.app.renderer.interfaces import ISource
from zope.app.renderer.vocabulary import SourceTypeVocabulary
from zope.component.interfaces import IFactory
-from zope.component.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.schema.interfaces import \
ITokenizedTerm, IVocabulary, IVocabularyTokenized
Modified: Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.publisher.interfaces.browser import IBrowserPublisher
from zope.publisher.interfaces import NotFound
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.traversing.api import traverse
from zope.app.container.interfaces import IReadContainer
@@ -31,7 +31,7 @@
from zope.app.rotterdam.xmlobject import ReadContainerXmlObjectView
from zope.app.rotterdam.xmlobject import XmlObjectView
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
class File(object):
pass
@@ -40,7 +40,6 @@
def setUp(self):
PlacefulSetup.setUp(self, site=True)
- self.createStandardServices()
def testXMLTreeViews(self):
rcxov = ReadContainerXmlObjectView
Modified: Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/xmlobject.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/xmlobject.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/rotterdam/xmlobject.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -50,7 +50,7 @@
def getIconUrl(self, item):
result = ''
- icon = zapi.queryView(item, 'zmi_icon', self.request)
+ icon = zapi.queryMultiAdapter((item, self.request), name='zmi_icon')
if icon:
result = icon.url()
return result
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/browser/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/browser/configure.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/browser/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,12 +25,13 @@
</view>
+<!-- XXX: Activate again
<addform
label="New Mutable Schema Registration"
for="zope.app.schema.interfaces.ISchemaUtility"
name="addRegistration.html"
- schema="zope.app.utility.interfaces.IUtilityRegistration"
- class="zope.app.utility.browser.AddRegistration"
+ schema="zope.app.component.interfaces.IUtilityRegistration"
+ class="zope.app.component.browser.AddRegistration"
permission="zope.ManageServices"
content_factory="zope.app.schema.schema.SchemaRegistration"
arguments="name interface componentPath"
@@ -43,8 +44,8 @@
class="zope.app.schema.schema.SchemaUtility"
permission="zope.ManageServices"
/>
+-->
-
<defaultView
for="zope.app.schema.interfaces.IMutableSchema"
name="editschema.html" />
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/configure.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
<content class=".schema.SchemaRegistration">
<require
permission="zope.ManageServices"
- interface="zope.app.utility.interfaces.IUtilityRegistration"
- set_schema="zope.app.utility.interfaces.IUtilityRegistration" />
+ interface="zope.app.component.interfaces.IUtilityRegistration"
+ set_schema="zope.app.component.interfaces.IUtilityRegistration" />
</content>
<include file="fields.zcml" />
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/schema.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/schema.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/schema.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.app import zapi
from zope.app.container.browser.adding import Adding
from zope.app.interface import PersistentInterfaceClass
-from zope.app.utility import UtilityRegistration
+from zope.app.component.site import UtilityRegistration
from zope.app.container.contained import Contained, setitem, uncontained
from zope.interface.interface import Attribute, Method, fromFunction
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/fields.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/fields.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/fields.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -4,12 +4,11 @@
<include package="zope.app.schema" file="meta.zcml" />
<include package="zope.app.component" file="meta.zcml" />
- <include package="zope.app.utility" file="meta.zcml" />
<include package="zope.app.publisher" file="meta.zcml" />
<include package="zope.app.form.browser" file="meta.zcml" />
<include package="zope.app.security" file="meta.zcml"/>
<include package="zope.app.security" file="configure.zcml"/>
- <include package="zope.app.site.browser" file="meta.zcml" />
+ <include package="zope.app.component.browser" file="meta.zcml" />
<include package="zope.app" file="menus.zcml" />
<include package="zope.app.schema" file="configure.zcml" />
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,7 +17,7 @@
"""
import unittest
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.configuration import xmlconfig
from zope.app.schema.vocabulary import ZopeVocabularyRegistry
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_field.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_field.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_field.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.schema import Text, getFieldsInOrder
from zope.security.checker import ProxyFactory
from zope.security.management import system_user, newInteraction
-from zope.app.tests import setup
+from zope.app.testing import setup
from zope.app.schema.wrapper import Struct
from zope.security.checker import getChecker, _defaultChecker
import zope.app.schema.tests
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,7 +22,7 @@
from zope.app import zapi
from zope.component.exceptions import ComponentLookupError
from zope.component.interfaces import IFactory
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.schema.interfaces import IField, IText
from zope.interface import Interface
from zope.configuration import xmlconfig
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_fieldfactory.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -5,7 +5,6 @@
<include package="zope.app.component" file="meta.zcml" />
<include package="zope.app.publisher" file="meta.zcml" />
<include package="zope.app.security" file="meta.zcml" />
- <include package="zope.app.utility" file="meta.zcml" />
<include package="zope.app.security" file="configure.zcml" />
<content class="zope.schema.Field">
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_interfaceutility.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_interfaceutility.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,28 +16,23 @@
$Id$
"""
import unittest
-from zope.app.tests import setup
-from zope.app.site.tests import placefulsetup
-from zope.app import utility
+from zope.interface import Interface, implements
+from zope.interface.interface import InterfaceClass
+from zope.interface.interfaces import IInterface
+from zope.component.exceptions import ComponentLookupError
+
from zope.app import zapi
-from zope.app.servicenames import Utilities
+from zope.app.component.interfaces import ILocalUtility
+from zope.app.component.site import UtilityRegistration
+from zope.app.component.testing import PlacefulSetup
from zope.app.component.interface import getInterface, searchInterface
-from zope.interface import Interface, implements
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.interfaces.registration import InactiveStatus
+from zope.app.component.interfaces.registration import IRegistered
from zope.app.container.contained import Contained
-from zope.component import getService
-from zope.component.exceptions import ComponentLookupError
-from zope.app.traversing.api import traverse
-from zope.app.registration.interfaces import IRegistrationStack
-from zope.app.registration.interfaces import UnregisteredStatus
-from zope.app.registration.interfaces import RegisteredStatus
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.registration.interfaces import IRegistered
-from zope.app.utility.interfaces import ILocalUtility
from zope.app.dependable.interfaces import IDependable
-from zope.app.tests import setup
-from zope.interface.interface import InterfaceClass
-from zope.interface.interfaces import IInterface
-from zope.interface import Interface
+from zope.app.testing import setup
+from zope.app.traversing.api import traverse
class IBaz(Interface): pass
@@ -88,20 +83,16 @@
class Bar(Foo): pass
-class TestInterfaceUtility(placefulsetup.PlacefulSetup, unittest.TestCase):
+class TestInterfaceUtility(PlacefulSetup, unittest.TestCase):
def setUp(self):
- sm = placefulsetup.PlacefulSetup.setUp(self, site=True)
- setup.addService(sm, Utilities,
- utility.LocalUtilityService())
+ sm = PlacefulSetup.setUp(self, site=True)
def test_getLocalInterface_delegates_to_globalUtility(self):
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, Bar("blob"),
- name="blob")
- utilityService.provideUtility(IBaz, Baz("global baz"))
- utilityService.provideUtility(IInterface, Foo("global bob"),
- name="bob")
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, Bar("blob"), name="blob")
+ gsm.provideUtility(IBaz, Baz("global baz"))
+ gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
self.assertEqual(getInterface(None, "bob").__class__, Foo)
self.assertEqual(getInterface(None, "blob").__class__, Bar)
@@ -111,18 +102,17 @@
baz = Baz("global baz")
foo = Foo("global bob")
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, foo,
- name="bob")
- utilityService.provideUtility(IInterface, bar)
- utilityService.provideUtility(IBaz, baz)
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, foo, name="bob")
+ gsm.provideUtility(IInterface, bar)
+ gsm.provideUtility(IBaz, baz)
ifaces = searchInterface(None)
self.assert_(len(ifaces), 2)
for pair in [(foo), (bar)]:
self.assert_(pair in ifaces)
- iface_utilities = utilityService.getUtilitiesFor(IInterface)
+ iface_utilities = gsm.getUtilitiesFor(IInterface)
ifaces = [iface for (name, iface) in iface_utilities]
self.assert_(len(ifaces), 2)
@@ -136,30 +126,28 @@
bar = Bar("global")
baz = Baz("global baz")
foo = Foo("global bob")
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, foo,
- name="bob")
- utilityService.provideUtility(ILocalUtility, bar)
- utilityService.provideUtility(IBaz, baz)
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, foo, name="bob")
+ gsm.provideUtility(ILocalUtility, bar)
+ gsm.provideUtility(IBaz, baz)
- iface_utilities = utilityService.getUtilitiesFor(IInterface)
+ iface_utilities = gsm.getUtilitiesFor(IInterface)
ifaces = [iface for (name, iface) in iface_utilities]
self.assertEqual(ifaces, [(foo)])
- iface_utilities = utilityService.getUtilitiesFor(ILocalUtility)
+ iface_utilities = gsm.getUtilitiesFor(ILocalUtility)
ifaces = [iface for (name, iface) in iface_utilities]
self.assertEqual(ifaces, [(bar)])
- iface_utilities = utilityService.getUtilitiesFor(IBaz)
+ iface_utilities = gsm.getUtilitiesFor(IBaz)
ifaces = [iface for (name, iface) in iface_utilities]
self.assertEqual(ifaces, [(baz)])
def test_getLocalInterface_raisesComponentLookupError(self):
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, Foo("global"))
- utilityService.provideUtility(IBaz, Baz("global baz"))
- utilityService.provideUtility(IInterface, Foo("global bob"),
- name="bob")
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, Foo("global"))
+ gsm.provideUtility(IBaz, Baz("global baz"))
+ gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
self.assertRaises(ComponentLookupError,
getInterface, None, "bobesponja")
@@ -168,107 +156,68 @@
foo = Foo("global bob")
bar = Bar("global")
baz = Baz("global baz")
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, bar)
- utilityService.provideUtility(IBaz, baz)
- utilityService.provideUtility(IInterface, foo,
- name="bob")
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, bar)
+ gsm.provideUtility(IBaz, baz)
+ gsm.provideUtility(IInterface, foo, name="bob")
self.assertEqual(searchInterface(None, search_string="bob"),
[foo])
def test_localsearchInterface_delegates_to_globalUtility(self):
+ # Same test as above!
foo = Foo("global bob")
bar = Bar("global")
baz = Baz("global baz")
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, bar)
- utilityService.provideUtility(IBaz, baz)
- utilityService.provideUtility(IInterface, foo,
- name="bob")
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, bar)
+ gsm.provideUtility(IBaz, baz)
+ gsm.provideUtility(IInterface, foo, name="bob")
self.assertEqual(searchInterface(None, search_string="bob"),
[foo])
- def test_queryUtility_delegates_to_global(self):
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, Foo("global"))
- utilityService.provideUtility(IInterface, Foo("global bob"),
- name="bob")
+ def test_query_get_Utility_delegates_to_global(self):
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, Foo("global"))
+ gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
- utility_service = getService(Utilities, self.rootFolder)
- self.assert_(utility_service != utilityService)
+ sm = zapi.getSiteManager(self.rootFolder)
+ self.assert_(gsm != sm)
- self.assertEqual(utility_service.queryUtility(IInterface).foo(),
- "foo global")
- self.assertEqual(
- utility_service.queryUtility(IInterface, "bob").foo(),
- "foo global bob")
+ # If queryUtility works on the site manager, getUtility in zapi must
+ # also work.
+ self.assertEqual(sm.queryUtility(IInterface).foo(), "foo global")
+ self.assertEqual(sm.queryUtility(IInterface, "bob").foo(),
+ "foo global bob")
- def test_getUtility_delegates_to_global(self):
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, Foo("global"))
- utilityService.provideUtility(IInterface, Foo("global bob"),
- name="bob")
-
- utility_service = getService(Utilities, self.rootFolder)
- self.assert_(utility_service != utilityService)
-
- self.assertEqual(utility_service.getUtility(IInterface).foo(),
- "foo global")
- self.assertEqual(
- utility_service.getUtility(IInterface, "bob").foo(),
- "foo global bob")
-
-
- def test_registrationsFor_methods(self):
- utilities = getService(Utilities, self.rootFolder)
- default = traverse(self.rootFolder, "++etc++site/default")
- default['foo'] = Foo("local")
- foo = default['foo']
-
- for name in ('', 'bob'):
- registration = utility.UtilityRegistration(name, IInterface, foo)
- self.assertEqual(utilities.queryRegistrationsFor(registration),
- None)
- registery = utilities.createRegistrationsFor(registration)
- self.assert_(IRegistrationStack.providedBy(registery))
- self.assertEqual(utilities.queryRegistrationsFor(registration),
- registery)
-
-
def test_local_utilities(self):
- utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
- utilityService.provideUtility(IInterface, Foo("global"))
- utilityService.provideUtility(IInterface, Foo("global bob"),
- name="bob")
+ gsm = zapi.getGlobalSiteManager()
+ gsm.provideUtility(IInterface, Foo("global"))
+ gsm.provideUtility(IInterface, Foo("global bob"), name="bob")
- utilities = getService(Utilities, self.rootFolder)
+ sm = zapi.getSiteManager(self.rootFolder)
default = traverse(self.rootFolder, "++etc++site/default")
default['foo'] = Foo("local")
foo = default['foo']
- cm = default.getRegistrationManager()
+ cm = default.registrationManager
for name in ('', 'bob'):
- registration = utility.UtilityRegistration(name, IInterface, foo)
+ registration = UtilityRegistration(name, IInterface, foo)
cname = cm.addRegistration(registration)
registration = traverse(cm, cname)
gout = name and "foo global "+name or "foo global"
+ self.assertEqual(sm.queryUtility(IInterface, name).foo(), gout)
- self.assertEqual(utilities.getUtility(IInterface, name).foo(),
- gout)
-
registration.status = ActiveStatus
+ self.assertEqual(
+ sm.queryUtility(IInterface, name).foo(), "foo local")
- self.assertEqual(utilities.getUtility(IInterface, name).foo(),
- "foo local")
+ registration.status = InactiveStatus
+ self.assertEqual(sm.queryUtility(IInterface, name).foo(), gout)
- registration.status = RegisteredStatus
- self.assertEqual(utilities.getUtility(IInterface, name).foo(), gout)
-
-
def test_suite():
return unittest.makeSuite(TestInterfaceUtility)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautility.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautility.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautility.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.schema import Text, getFieldNamesInOrder, getFieldsInOrder
from zope.security.checker import getChecker, _defaultChecker, ProxyFactory
from zope.app.schema.schema import SchemaUtility
-from zope.app.tests import setup
+from zope.app.testing import setup
from zope.app import zapi
import zope.app.schema.tests
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautilitypersistence.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautilitypersistence.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schema/tests/test_schemautilitypersistence.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.app.schema.wrapper import Struct
from zope.app.schema.schema import SchemaUtility
from zope.schema import Text, getFieldsInOrder
-from zope.app.tests import setup
+from zope.app.testing import setup
class PSchema(SchemaUtility):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/content.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/content.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/content.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,10 +21,9 @@
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.annotation.interfaces import IAnnotations
from zope.app.container.interfaces import IAdding
-from zope.app.registration.interfaces import ActiveStatus
+from zope.app.component.interfaces.registration import ActiveStatus
from zope.app.container.contained import Contained
-from zope.app.site.service import ServiceRegistration
-from zope.app.utility import UtilityRegistration
+from zope.app.component.site import UtilityRegistration
from zope.component.exceptions import ComponentLookupError
from zope.interface import directlyProvides, implements
from zope.schema import getFields
Modified: Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/tests/test_content.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/tests/test_content.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/schemacontent/tests/test_content.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,22 +17,19 @@
"""
import unittest
+from zope.component.exceptions import ComponentLookupError
+from zope.interface import Interface, classImplements
+from zope.schema import Int, TextLine, Text
+
from zope.app import zapi
from zope.app.annotation.interfaces import IAttributeAnnotatable
+from zope.app.component.interfaces import ILocalUtility
from zope.app.container.interfaces import IAdding
-from zope.app.utility.interfaces import ILocalUtility
-from zope.app.schemacontent.interfaces import IContentComponentDefinition
-from zope.app.servicenames import Utilities
-from zope.app.utility import LocalUtilityService
-from zope.app.tests import setup
from zope.app.schemacontent.content import \
ContentComponentDefinition, ContentComponentDefinitionRegistration, \
ContentComponentInstance
-from zope.component import getGlobalServices
-from zope.app.tests import ztapi
-from zope.component.exceptions import ComponentLookupError
-from zope.interface import Interface, classImplements
-from zope.schema import Int, TextLine, Text
+from zope.app.schemacontent.interfaces import IContentComponentDefinition
+from zope.app.testing import setup, ztapi
class IDocument(Interface):
id = Int(title=u"id", default=0)
@@ -48,11 +45,8 @@
setup.placefulSetUp()
self.rootFolder = setup.buildSampleFolderTree()
- mgr = setup.createServiceManager(self.rootFolder)
+ mgr = setup.createSiteManager(self.rootFolder)
- # Setup Utility Service
- setup.addService(mgr, Utilities, LocalUtilityService())
-
# Setup Definition
classImplements(ContentComponentDefinition, ILocalUtility)
classImplements(ContentComponentDefinition, IAttributeAnnotatable)
@@ -63,8 +57,8 @@
path = "%s/default/%s" % (zapi.getPath(mgr), 'TestDoc')
reg = ContentComponentDefinitionRegistration(
'TestDoc', IContentComponentDefinition, default['TestDoc'])
- key = default.getRegistrationManager().addRegistration(reg)
- self.reg = zapi.traverse(default.getRegistrationManager(), key)
+ key = default.registrationManager.addRegistration(reg)
+ self.reg = zapi.traverse(default.registrationManager, key)
def tearDown(self):
setup.placefulTearDown()
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/browser/principalterms.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/browser/principalterms.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/browser/principalterms.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -25,7 +25,7 @@
Now we need to install the authentication utility:
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IAuthenticationUtility, AuthUtility())
We need a principal source so that we can create a view from it.
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/browser/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/browser/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/browser/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
__docformat__ = "reStructuredText"
import unittest
from zope.testing import doctest
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
def test_suite():
return unittest.TestSuite((
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/configure.zcml 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/configure.zcml 2005-01-09 18:18:04 UTC (rev 28772)
@@ -12,7 +12,7 @@
<vocabulary
name="Permissions"
- factory="zope.app.utility.vocabulary.UtilityVocabulary"
+ factory="zope.app.component.vocabulary.UtilityVocabulary"
interface="zope.security.interfaces.IPermission" />
<vocabulary
@@ -40,12 +40,12 @@
</localUtility>
<subscriber
- for="..registration.interfaces.IRegistrationActivatedEvent"
+ for="..component.interfaces.registration.IRegistrationActivatedEvent"
factory=".permission.setIdOnActivation"
/>
<subscriber
- for="..registration.interfaces.IRegistrationDeactivatedEvent"
+ for="..component.interfaces.registration.IRegistrationDeactivatedEvent"
factory=".permission.unsetIdOnDeactivation"
/>
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/permission.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/permission.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/permission.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -59,7 +59,7 @@
>>> perm1.id
u'<permission not activated>'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationActivatedEvent(
... Registration(perm1, 'perm1'))
@@ -101,7 +101,7 @@
>>> perm1 = LocalPermission('Permission 1', 'A first permission')
>>> perm1.id = 'perm1'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationDeactivatedEvent(
... Registration(perm1, 'perm1'))
@@ -132,10 +132,10 @@
def checkPermission(context, permission_id):
"""Check whether a given permission exists in the provided context.
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
- >>> from zope.app.tests.ztapi import provideUtility
+ >>> from zope.app.testing.ztapi import provideUtility
>>> provideUtility(IPermission, Permission('x'), 'x')
>>> checkPermission(None, 'x')
@@ -154,10 +154,10 @@
def allPermissions(context=None):
"""Get the ids of all defined permissions
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
- >>> from zope.app.tests.ztapi import provideUtility
+ >>> from zope.app.testing.ztapi import provideUtility
>>> provideUtility(IPermission, Permission('x'), 'x')
>>> provideUtility(IPermission, Permission('y'), 'y')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_directives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_directives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_directives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,12 +21,11 @@
from zope.testing.doctestunit import DocTestSuite
from zope.security.checker import moduleChecker
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import setUp, tearDown, PlacelessSetup
from zope.app.security import metaconfigure
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
-from zope.app.tests.placelesssetup import PlacelessSetup
from zope.configuration import xmlconfig
from zope.app.security import fields
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_principalregistry.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_principalregistry.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_principalregistry.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,9 +21,8 @@
from zope.publisher.interfaces.http import IHTTPCredentials
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.servicenames import Adapters
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.testing import ztapi
+from zope.app.component.testing import PlacefulSetup
from zope.app.security.basicauthadapter import BasicAuthAdapter
from zope.app.security.interfaces import ILoginPassword
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectclass.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectclass.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectclass.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,8 @@
import unittest
from zope.interface import implements
from zope.security.checker import selectChecker
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.permission import Permission
from zope.app.security.interfaces import IPermission
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectsubclass.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectsubclass.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_protectsubclass.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,8 +17,8 @@
"""
import unittest
from zope.security.checker import selectChecker
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_securitydirectives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_securitydirectives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/tests/test_securitydirectives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
from zope.configuration import xmlconfig
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.servicenames import Authentication
from zope.app.security.interfaces import IAuthenticationUtility, IPermission
Modified: Zope3/branches/srichter-blow-services/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/security/vocabulary.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/security/vocabulary.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -24,7 +24,7 @@
from zope.schema.interfaces import ISourceQueriables
from zope.app.security.interfaces import IPermission, IAuthenticationUtility
from zope.app.security.interfaces import PrincipalLookupError
-from zope.app.utility.utility import queryNextUtility
+from zope.app.component import queryNextUtility
# BBB Backward Compatibility
from zope.exceptions import NotFoundError
@@ -46,7 +46,7 @@
To illustrate, we need to register the permission IDs vocab:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> from zope.schema.vocabulary import getVocabularyRegistry
>>> registry = getVocabularyRegistry()
@@ -57,7 +57,7 @@
>>> from zope.app.security.interfaces import IPermission
>>> from zope.app.security.permission import Permission
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
... 'zope.Public')
>>> ztapi.provideUtility(IPermission, Permission('b'), 'b')
@@ -192,7 +192,7 @@
... return ('4', 4),
>>> dummy3 = DummyUtility3()
- >>> from zope.app.utility.utility import testingNextUtility
+ >>> from zope.app.component.testing import testingNextUtility
>>> testingNextUtility(dummy1, dummy2, IAuthenticationUtility)
>>> testingNextUtility(dummy2, dummy3, IAuthenticationUtility)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/granting.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/granting.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/granting.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -6,7 +6,7 @@
- Roles
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.app.securitypolicy.role import Role
>>> from zope.app.securitypolicy.interfaces import IRole
>>> ztapi.provideUtility(IRole, Role(u'role1', u'Role 1'), u'role1')
@@ -15,7 +15,6 @@
- Permissions
- >>> from zope.app.tests import ztapi
>>> from zope.app.security.permission import Permission
>>> from zope.app.security.interfaces import IPermission
>>> ztapi.provideUtility(IPermission, Permission(u'permission1',
@@ -103,15 +102,14 @@
... IInputWidget, '', SourceInputWidget)
- Attribute Annotatable Adapter
+
+ >>> from zope.app.testing import setup
+ >>> setup.setUpAnnotations()
+ >>> setup.setUpSiteManagerLookup()
- >>> from zope.app.annotation.attribute import AttributeAnnotations
- >>> from zope.app.annotation.interfaces import IAnnotations
- >>> from zope.app.annotation.interfaces import IAttributeAnnotatable
- >>> ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
- ... AttributeAnnotations)
-
- Content Object
+ >>> from zope.app.annotation.interfaces import IAttributeAnnotatable
>>> class Content:
... implements(IAttributeAnnotatable)
... __annotations__ = {}
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_granting.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_granting.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_granting.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
__docformat__ = "reStructuredText"
import unittest
from zope.testing import doctest
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
def test_suite():
return unittest.TestSuite((
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -24,10 +24,10 @@
from zope.app.exception.interfaces import UserError
from zope.app.publisher.browser import BrowserView
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.security.permission import Permission
from zope.app.security.interfaces import IPermission
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.securitypolicy.role import Role
from zope.app.securitypolicy.interfaces import IRole
@@ -36,8 +36,6 @@
from zope.app.securitypolicy.browser.rolepermissionview \
import RolePermissionView
-from zope.app.tests import ztapi
-
class RolePermissionView(RolePermissionView, BrowserView):
"""Adding BrowserView to Utilities; this is usually done by ZCML."""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/role.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/role.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/role.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -44,7 +44,7 @@
# BBB: Renamed component on 12/05/2004
PersistentRole = LocalRole
-from zope.app.utility import UtilityRegistration
+from zope.app.component.site import UtilityRegistration
RoleRegistration = UtilityRegistration
def setIdOnActivation(event):
@@ -61,7 +61,7 @@
>>> role1 = LocalRole('Role 1', 'A first role')
>>> role1.id
u'<role not activated>'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationActivatedEvent(
... Registration(role1, 'role1'))
@@ -103,7 +103,7 @@
>>> role1 = LocalRole('Role 1', 'A first role')
>>> role1.id = 'role1'
- >>> from zope.app.registration import registration
+ >>> from zope.app.component import registration
>>> event = registration.RegistrationDeactivatedEvent(
... Registration(role1, 'role1'))
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,12 +19,12 @@
from zope.interface import implements
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.annotation.attribute import AttributeAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable, IAnnotations
from zope.app.security.principalregistry import principalRegistry
from zope.app.security.settings import Allow, Deny, Unset
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,12 +19,11 @@
from zope.interface import implements
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.annotation.interfaces import IAttributeAnnotatable, IAnnotations
+from zope.app.testing import ztapi
+from zope.app.annotation.interfaces import IAttributeAnnotatable
from zope.app.security.principalregistry import principalRegistry
from zope.app.security.settings import Allow, Deny
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.securitypolicy.role import Role
from zope.app.securitypolicy.interfaces import IRole
@@ -42,9 +41,6 @@
def setUp(self):
PlacefulSetup.setUp(self)
- ztapi.provideAdapter(
- IAttributeAnnotatable, IAnnotations,
- AttributeAnnotations)
def _make_principal(self, id=None, title=None):
p = principalRegistry.definePrincipal(
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,13 +18,12 @@
import unittest
from zope.interface import implements
-from zope.app.tests import ztapi
-from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.annotation.interfaces import IAttributeAnnotatable, IAnnotations
+from zope.app.testing import ztapi
+from zope.app.annotation.interfaces import IAttributeAnnotatable
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
from zope.app.security.settings import Allow, Deny
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.securitypolicy.role import Role
from zope.app.securitypolicy.interfaces import IRole
@@ -38,8 +37,6 @@
def setUp(self):
PlacefulSetup.setUp(self)
- ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
- AttributeAnnotations)
read = Permission('read', 'Read Something')
ztapi.provideUtility(IPermission, read, name=read.id)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,8 @@
import unittest
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
from zope.app.security.interfaces import IAuthenticationUtility
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalrolemanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_principalrolemanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,8 +18,8 @@
import unittest
from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IAuthenticationUtility
from zope.app.security.settings import Allow, Deny
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,10 +17,10 @@
"""
import unittest
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_securitydirectives.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_securitydirectives.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_securitydirectives.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,9 +21,9 @@
from zope.configuration.config import ConfigurationConflictError
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
from zope.app.security.interfaces import IAuthenticationUtility
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_zopepolicy.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_zopepolicy.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/tests/test_zopepolicy.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,7 +19,7 @@
import unittest
from zope.testing.doctestunit import DocFileSuite
from zope.app import zapi
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
from zope.app.annotation.interfaces import IAnnotatable
from zope.app.annotation.interfaces import IAttributeAnnotatable
from zope.app.annotation.interfaces import IAnnotations
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/vocabulary.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/vocabulary.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/vocabulary.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -29,7 +29,7 @@
To illustrate, we need to register the role IDs vocab:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> from zope.schema.vocabulary import getVocabularyRegistry
>>> registry = getVocabularyRegistry()
@@ -39,7 +39,7 @@
>>> from zope.app.securitypolicy.interfaces import IRole
>>> from zope.app.securitypolicy.role import Role
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IRole, Role('a_id','a_title'), 'a_id')
>>> ztapi.provideUtility(IRole, Role('b_id','b_title'), 'b_id')
Modified: Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/zopepolicy.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/zopepolicy.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/securitypolicy/zopepolicy.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -504,7 +504,7 @@
>>> auth = FauxPrincipals()
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IAuthenticationUtility, auth)
>>> from zope.app import zapi
Modified: Zope3/branches/srichter-blow-services/src/zope/app/session/http.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/session/http.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/session/http.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,7 @@
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app import zapi
from zope.app.session.interfaces import IClientIdManager
-from zope.app.utility.interfaces import ILocalUtility
+from zope.app.component.interfaces import ILocalUtility
from zope import schema
from zope.interface import implements
from zope.server.http.http_date import build_http_date
Modified: Zope3/branches/srichter-blow-services/src/zope/app/session/session.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/session/session.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/session/session.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.component import ComponentLookupError
from zope.app.zapi import getUtility
from BTrees.OOBTree import OOBTree
-from zope.app.utility.interfaces import ILocalUtility
+from zope.app.component.interfaces import ILocalUtility
from zope.app.annotation.interfaces import IAttributeAnnotatable
from interfaces import \
Modified: Zope3/branches/srichter-blow-services/src/zope/app/sqlexpr/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/sqlexpr/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/sqlexpr/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,9 +15,6 @@
$Id: test_sqlexpr.py 26878 2004-08-03 16:25:34Z jim $
"""
-
-
-
import unittest
from zope.interface import implements
@@ -27,7 +24,7 @@
from zope.tales.tests.test_expressions import Data
from zope.tales.engine import Engine
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
from zope.app.rdb.tests.stubs import ConnectionStub
from zope.app.sqlexpr.sqlexpr import SQLExpr, ConnectionError
Modified: Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/browser/sqlscript.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/browser/sqlscript.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/browser/sqlscript.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -97,7 +97,7 @@
def nextURL(self):
"""
>>> from zope.publisher.browser import TestRequest
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> rqst = TestRequest()
>>> class Base(object):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/tests/test_sqlscript.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/tests/test_sqlscript.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/sqlscript/tests/test_sqlscript.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,15 +16,12 @@
"""
import unittest
from zope.interface import implements, classImplements
-from zope.component.service import serviceManager as sm
-from zope.app.tests import ztapi
-from zope.app.rdb.interfaces import IConnectionService, IZopeDatabaseAdapter
+from zope.app.testing import ztapi
+from zope.app.rdb.interfaces import IZopeDatabaseAdapter
from zope.app.rdb.interfaces import IZopeConnection
from zope.app.rdb.interfaces import IZopeCursor
-from zope.app.servicenames import Adapters
-from zope.app.component import localservice
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable
@@ -34,16 +31,11 @@
from zope.app.cache.annotationcacheable import AnnotationCacheable
from zope.app.cache.caching import getCacheForObject
from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.site.interfaces import ISimpleService
from zope.app.sqlscript.sqlscript import SQLScript, Arguments
from zope.app.sqlscript.interfaces import ISQLScript
-# Make spme fixes, so that we overcome some of the natural ZODB properties
-def getLocalServices(context):
- return sm
-
class CursorStub(object):
implements(IZopeCursor)
@@ -82,13 +74,7 @@
def __call__(self):
return self.connection
-class ConnectionServiceStub(object):
- implements(IConnectionService, ISimpleService)
- def getConnection(self, name):
- return ConnectionStub()
-
-
class CacheStub(object):
implements(ICache)
def __init__(self):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -139,7 +139,7 @@
#------------------------------------------------------------------------
# Sample Folder Creation
from zope.app.component.site import LocalSiteManager
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
def createSiteManager(folder, setsite=False):
if not ISite.providedBy(folder):
folder.setSiteManager(LocalSiteManager(folder))
@@ -151,7 +151,7 @@
#------------------------------------------------------------------------
# Local Utility Addition
from zope.app.component.site import UtilityRegistration
-from zope.app.registration.interfaces import ActiveStatus
+from zope.app.component.interfaces.registration import ActiveStatus
def addUtility(sitemanager, name, iface, utility, suffix=''):
"""Add a utility to a site manager
Modified: Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -4,16 +4,16 @@
##############################################################################
# BBB: backward-comptibility; 12/18/2004
import sys
-from zope.app.testing import placelesssetup
-sys.modules['zope.app.tests.placelesssetup'] = placelesssetup
-from zope.app.testing import setup
-sys.modules['zope.app.tests.setup'] = setup
-from zope.app.testing import dochttp
-sys.modules['zope.app.tests.dochttp'] = dochttp
-from zope.app.testing import functional
-sys.modules['zope.app.tests.functional'] = functional
-from zope.app.testing import test
-sys.modules['zope.app.tests.test'] = test
-from zope.app.testing import ztapi
-sys.modules['zope.app.tests.ztapi'] = ztapi
+#from zope.app.testing import placelesssetup
+#sys.modules['zope.app.tests.placelesssetup'] = placelesssetup
+#from zope.app.testing import setup
+#sys.modules['zope.app.tests.setup'] = setup
+#from zope.app.testing import dochttp
+#sys.modules['zope.app.tests.dochttp'] = dochttp
+#from zope.app.testing import functional
+#sys.modules['zope.app.tests.functional'] = functional
+#from zope.app.testing import test
+#sys.modules['zope.app.tests.test'] = test
+#from zope.app.testing import ztapi
+#sys.modules['zope.app.tests.ztapi'] = ztapi
#############################################################################
Modified: Zope3/branches/srichter-blow-services/src/zope/app/traversing/namespace.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/traversing/namespace.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/traversing/namespace.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -47,7 +47,7 @@
Let's start with adapter-based transersal. We're going to use the
component architecture, so we'll need to initialize it:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> class I(zope.interface.Interface):
@@ -63,7 +63,7 @@
... def traverse(self, name, remaining):
... return name+'42'
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideAdapter(I, ITraversable, Adapter, 'foo')
Then given an object, we can traverse it with a
@@ -419,9 +419,9 @@
To demonstrate this, we need to register some adapters:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> def adapter1(ob):
... return 1
>>> def adapter2(ob):
@@ -488,7 +488,7 @@
++debug++errors enables tracebacks (by switching to debug skin)
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> from zope.publisher.interfaces.browser import IBrowserRequest
>>> class Debug(IBrowserRequest):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_conveniencefunctions.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_conveniencefunctions.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_conveniencefunctions.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,9 +16,9 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.interface import directlyProvides
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.app.traversing.adapters import Traverser
from zope.app.servicenames import Adapters
from zope.app.traversing.interfaces import ITraverser, ITraversable
Modified: Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_namespacetrversal.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_namespacetrversal.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_namespacetrversal.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,7 +18,7 @@
from unittest import main
from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests.placelesssetup import setUp, tearDown
+from zope.app.testing.placelesssetup import setUp, tearDown
def test_suite():
return DocTestSuite('zope.app.traversing.namespace',
Modified: Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_physicallocationadapters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_physicallocationadapters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_physicallocationadapters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,17 +16,14 @@
$Id$
"""
from unittest import TestCase, main, makeSuite
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi, setup
from zope.interface import implements
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.location.traversing import LocationPhysicallyLocatable
-from zope.app.traversing.adapters import RootPhysicallyLocatable
from zope.app.container.contained import contained
-from zope.component.interfaces import IServiceService
-from zope.app.site.servicecontainer import ServiceManagerContainer
+from zope.app.component.site import SiteManagerContainer
class Root(object):
@@ -39,32 +36,15 @@
pass
-class SiteManager(object):
-
- implements(IServiceService)
-
- def getService(self, object, name):
- '''See interface IServiceService'''
- raise ComponentLookupError(name)
-
- def getServiceDefinitions(self):
- '''See interface IServiceService'''
- return ()
-
-
-
class Test(PlacelessSetup, TestCase):
def test(self):
- ztapi.provideAdapter(None, IPhysicallyLocatable,
- LocationPhysicallyLocatable)
- ztapi.provideAdapter(IContainmentRoot, IPhysicallyLocatable,
- RootPhysicallyLocatable)
+ setup.setUpTraversal()
root = Root()
f1 = contained(C(), root, name='f1')
- f2 = contained(ServiceManagerContainer(), f1, name='f2')
- f3 = contained(C(), f2, name='f3')
+ f2 = contained(SiteManagerContainer(), f1, name='f2')
+ f3 = contained(C(), f2, name='f3')
adapter = IPhysicallyLocatable(f3)
@@ -73,7 +53,7 @@
self.assertEqual(adapter.getRoot(), root)
self.assertEqual(adapter.getNearestSite(), root)
- f2.setSiteManager(SiteManager())
+ setup.createSiteManager(f2)
self.assertEqual(adapter.getNearestSite(), f2)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_traverser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_traverser.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/traversing/tests/test_traverser.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -33,9 +33,8 @@
from zope.app.traversing.interfaces import TraversalError
from zope.security.interfaces import Unauthorized
-from zope.app.servicenames import Adapters
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.component.testing import PlacefulSetup
from zope.security.checker \
import ProxyFactory, defineChecker, CheckerPublic, Checker
from zope.security.management import newInteraction, endInteraction
Modified: Zope3/branches/srichter-blow-services/src/zope/app/tree/adapters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tree/adapters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tree/adapters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,7 +26,7 @@
from zope.app import zapi
from zope.app.location.interfaces import ILocation
from zope.app.container.interfaces import IReadContainer
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
from zope.app.tree.interfaces import IUniqueId, IChildObjects
Modified: Zope3/branches/srichter-blow-services/src/zope/app/tree/browser/cookie.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tree/browser/cookie.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tree/browser/cookie.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -15,22 +15,21 @@
$Id$
"""
-
from zope.app import zapi
from zope.app.container.interfaces import IContainer
from zope.app.folder.interfaces import IFolder
-from zope.app.site.interfaces import ISite, ISiteManager
+from zope.app.component.interfaces import ISite
+from zope.component.interfaces import ISiteManager
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.tree.filters import OnlyInterfacesFilter
from zope.app.tree.browser import StatefulTreeView
class CookieTreeView(StatefulTreeView):
- """A stateful tree view using cookies to remember the tree state
- """
+ """A stateful tree view using cookies to remember the tree state"""
request_variable = 'tree-state'
-
+
def cookieTree(self, root=None, filter=None):
"""Build a tree with tree state information from a request.
"""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/basetest.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/basetest.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/basetest.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -17,8 +17,8 @@
"""
import unittest
from zope.interface import implements, Interface, Attribute
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.tests import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
from zope.app.tree.interfaces import IUniqueId, IChildObjects, \
ITreeStateEncoder
Modified: Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/test_adapters.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/test_adapters.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tree/tests/test_adapters.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,14 +22,14 @@
from zope.app.location.interfaces import ILocation
from zope.app.container.interfaces import IReadContainer
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
from zope.app.traversing.interfaces import IContainmentRoot
from zope.app.container.sample import SampleContainer
from zope.app.container.contained import setitem
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.tree.interfaces import IUniqueId, IChildObjects, \
ITreeStateEncoder
Modified: Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_undoview.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_undoview.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_undoview.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,8 +21,8 @@
from zope.interface import implements
from zope.publisher.browser import TestRequest
-from zope.app.tests import ztapi
-from zope.app.site.tests.placefulsetup import PlacefulSetup
+from zope.app.testing import ztapi
+from zope.app.component.testing import PlacefulSetup
from zope.app.undo.interfaces import IUndoManager
from zope.app.undo.browser import UndoView
from zope.app.security.principalregistry import principalRegistry
Modified: Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_zodbundomanager.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_zodbundomanager.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/undo/tests/test_zodbundomanager.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -20,8 +20,8 @@
from transaction import get_transaction
from zope.testing.cleanup import CleanUp
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.undo import ZODBUndoManager
from zope.app.undo.interfaces import UndoError
Modified: Zope3/branches/srichter-blow-services/src/zope/app/versioncontrol/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/versioncontrol/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/versioncontrol/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -65,7 +65,7 @@
... def getPath(self):
... return '/' + self.__name__
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideAdapter(zope.app.annotation.interfaces.IAttributeAnnotatable,
... zope.app.annotation.interfaces.IAnnotations,
... zope.app.annotation.attribute.AttributeAnnotations)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/instance.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/instance.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/instance.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -22,7 +22,6 @@
from zope.app import zapi
from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
from zope.app.container.interfaces import IContained
-from zope.app.servicenames import Utilities
from zope.app.workflow.interfaces import IProcessInstance, IProcessDefinition
from zope.app.workflow.interfaces import IProcessInstanceContainer
@@ -53,8 +52,8 @@
def createProcessInstance(context, name):
"""Helper function to create a process instance from a process definition
name."""
- utils = zapi.getService(Utilities, context)
- pd = utils.getUtility(IProcessDefinition, name)
+ sm = zapi.getSiteManager(context)
+ pd = sm.queryUtility(IProcessDefinition, name)
return pd.createProcessInstance(name)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_contentworkflow.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_contentworkflow.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_contentworkflow.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -26,9 +26,9 @@
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.app.annotation.interfaces import IAnnotatable, IAttributeAnnotatable
from zope.app.event.interfaces import IObjectCreatedEvent
-from zope.app.utility import UtilityRegistration
-from zope.app.utility.interfaces import ILocalUtility
-from zope.app.registration.interfaces import ActiveStatus
+from zope.app.component.site import UtilityRegistration
+from zope.app.component.interfaces import ILocalUtility
+from zope.app.component.interfaces.registration import ActiveStatus
from zope.app.workflow.interfaces import IProcessDefinition
from zope.app.workflow.interfaces import IProcessInstanceContainerAdaptable
@@ -40,7 +40,7 @@
import NewObjectProcessInstanceCreator
from zope.app.workflow.tests.workflowsetup import WorkflowSetup
-from zope.app.tests import ztapi, setup
+from zope.app.testing import ztapi, setup
# define and create dummy ProcessDefinition (PD) for tests
class DummyProcessDefinition(Contained):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_definition.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_definition.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_definition.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -23,7 +23,7 @@
from zope.app.workflow.stateful.interfaces import IStatefulProcessDefinition
from zope.app.workflow.stateful.definition import StatefulProcessDefinition
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
class IDummyState(Interface):
"""A really dummy state"""
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_instance.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_instance.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_instance.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -21,7 +21,6 @@
from zope.interface.verify import verifyClass
from zope.schema import Text, Int
-from zope.component.service import serviceManager
from zope.app.event.tests.placelesssetup import events, clearEvents
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
@@ -29,10 +28,9 @@
from zope.security.management import newInteraction, endInteraction
from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.registration.interfaces import IRegisterable
-from zope.app.registration.interfaces import IRegistered
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.servicenames import Utilities
+from zope.app.component.interfaces.registration import IRegisterable
+from zope.app.component.interfaces.registration import IRegistered
+from zope.app.component.interfaces.registration import ActiveStatus
from zope.app.workflow.tests.workflowsetup import WorkflowSetup
from zope.app.workflow.interfaces import IProcessDefinition
@@ -49,9 +47,9 @@
from zope.app.workflow.stateful.instance import StateChangeInfo
from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
from zope.app.container.contained import contained
-from zope.app.utility import UtilityRegistration
+from zope.app.component.site import UtilityRegistration
class ParticipationStub(object):
@@ -104,12 +102,11 @@
name = self.cm.addRegistration(
UtilityRegistration('definition1', IProcessDefinition,
self.default['pd1']))
- zapi.traverse(self.default.getRegistrationManager(),
+ zapi.traverse(self.default.registrationManager,
name).status = ActiveStatus
- utilities = zapi.getService(Utilities, self.sm)
- self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a service
+ self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
+ # give the pi some context to find a utility
self.pi = createProcessInstance(self.sm, 'definition1')
# Let's also listen to the fired events
clearEvents()
@@ -216,12 +213,11 @@
n = self.cm.addRegistration(
UtilityRegistration('definition1', IProcessDefinition,
self.default['pd1']))
- zapi.traverse(self.default.getRegistrationManager(), n
+ zapi.traverse(self.default.registrationManager, n
).status = ActiveStatus
- utilities = zapi.getService(Utilities, self.sm)
- self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a service
+ self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
+ # give the pi some context to find a utility
self.pi = contained(
createProcessInstance(self.sm, 'definition1'),
self.rootFolder)
@@ -303,12 +299,11 @@
k = self.cm.addRegistration(
UtilityRegistration('definition1', IProcessDefinition,
self.default['pd1']))
- zapi.traverse(self.default.getRegistrationManager(),
+ zapi.traverse(self.default.registrationManager,
k).status = ActiveStatus
- utilities = zapi.getService(Utilities, self.sm)
- self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a service
+ self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
+ # give the pi some context to find a utility
self.pi = contained(
createProcessInstance(self.sm, 'definition1'),
self.rootFolder)
@@ -390,13 +385,12 @@
k = self.cm.addRegistration(
UtilityRegistration('definition1', IProcessDefinition,
self.default['pd1']))
- zapi.traverse(self.default.getRegistrationManager(),
+ zapi.traverse(self.default.registrationManager,
k).status = ActiveStatus
- utilities = zapi.getService(Utilities, self.sm)
- self.pd = utilities.getUtility(IProcessDefinition, 'definition1')
+ self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
# give the process instance container (pic) some context to find a
- # service (while this is not correct, it resembles the current
+ # utility (while this is not correct, it resembles the current
# behavior.
from zope.app.workflow.instance import ProcessInstanceContainerAdapter
pic = ProcessInstanceContainerAdapter(self.rootFolder)
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -18,27 +18,28 @@
import unittest
from StringIO import StringIO
+from zope.interface import implements, classImplements, Interface
+from zope.interface.verify import verifyClass
+from zope.schema import TextLine
+from zope.security.checker import CheckerPublic
+
from zope.app import zapi
from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable
+from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
from zope.app.dublincore.interfaces import IZopeDublinCore
+from zope.app.component.interfaces.registration import IRegisterable
from zope.app.security.interfaces import IPermission
-from zope.app.registration.interfaces import IRegisterable
+from zope.app.security.permission import Permission
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import ztapi
from zope.app.workflow.interfaces import IProcessDefinitionExportHandler
from zope.app.workflow.interfaces import IProcessDefinitionImportHandler
-from zope.app.security.permission import Permission
-from zope.app.site.tests.placefulsetup import PlacefulSetup
from zope.app.workflow.stateful.definition import StatefulProcessDefinition
from zope.app.workflow.stateful.definition import State, Transition
from zope.app.workflow.stateful.xmlimportexport import XMLExportHandler
from zope.app.workflow.stateful.xmlimportexport import XMLImportHandler
-from zope.app.tests import ztapi
-from zope.interface import implements, classImplements, Interface
-from zope.interface.verify import verifyClass
-from zope.schema import TextLine
-from zope.security.checker import CheckerPublic
class ISchema(Interface):
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/test_instance.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/test_instance.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/test_instance.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -19,7 +19,7 @@
from zope.interface.verify import verifyClass
from zope.app.annotation.interfaces import IAnnotations
-from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.testing.placelesssetup import PlacelessSetup
from zope.app.workflow.interfaces import IProcessInstance
from zope.app.workflow.instance import ProcessInstance
Modified: Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/workflowsetup.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/workflowsetup.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/workflow/tests/workflowsetup.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,26 +16,21 @@
$Id$
"""
from zope.app import zapi
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.servicenames import Utilities
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.tests import setup
-from zope.app.utility import LocalUtilityService
+from zope.app.component.testing import PlacefulSetup
+from zope.app.testing import setup
class WorkflowSetup(PlacefulSetup):
def setUp(self):
- self.root_sm = zapi.getGlobalServices()
+ self.root_sm = zapi.getSiteManager()
self.sm = PlacefulSetup.setUp(self, site=True)
- setup.addService(self.sm, Utilities, LocalUtilityService())
self.default = zapi.traverse(self.sm, "default")
- self.cm = self.default.getRegistrationManager()
+ self.cm = self.default.registrationManager
self.sm1 = self.makeSite('folder1')
- setup.addService(self.sm1, Utilities, LocalUtilityService())
self.default1 = zapi.traverse(self.sm1, "default")
- self.cm1 = self.default1.getRegistrationManager()
+ self.cm1 = self.default1.registrationManager
Modified: Zope3/branches/srichter-blow-services/src/zope/app/zapi/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/zapi/README.txt 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/zapi/README.txt 2005-01-09 18:18:04 UTC (rev 28772)
@@ -29,7 +29,7 @@
... zope.interface.implements(IAuthenticationUtility)
>>> fake = FakeAuthenticationUtility()
- >>> from zope.app.tests import ztapi
+ >>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IAuthenticationUtility, fake)
Then we should be able to get the service back when we ask for the
Modified: Zope3/branches/srichter-blow-services/src/zope/app/zapi/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/zapi/tests.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/zapi/tests.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -16,7 +16,7 @@
$Id$
"""
import unittest
-from zope.app.tests import placelesssetup
+from zope.app.testing import placelesssetup
from zope.app import zapi
Modified: Zope3/branches/srichter-blow-services/src/zope/app/zptpage/tests/test_zptpage.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/zptpage/tests/test_zptpage.py 2005-01-08 08:23:39 UTC (rev 28771)
+++ Zope3/branches/srichter-blow-services/src/zope/app/zptpage/tests/test_zptpage.py 2005-01-09 18:18:04 UTC (rev 28772)
@@ -33,7 +33,6 @@
from zope.app.traversing.interfaces import ITraverser, ITraversable
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.tests import ztapi
from zope.security.checker import NamesChecker, defineChecker
from zope.app.container.contained import contained
from zope.app.location.traversing import LocationPhysicallyLocatable
More information about the Zope3-Checkins
mailing list