[Zope3-checkins] SVN: Zope3/trunk/ - Removal of Services. You can now access the adapter and utiliy

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Feb 14 17:43:18 EST 2005


Log message for revision 29143:
  - Removal of Services. You can now access the adapter and utiliy
    registry directly via the site manager's `adapters` and `utilities`
    attribute, respecitvely.
  
    + Converted Principal Annotation Service to be a utility. Added
      database evolution code to convert all service instances to
      utilities.
    
    + Converted FSSync Service to be a utility.
  
    + Created the concept of a global site manager. The adapter and
      utility registry, formerly the adapter and utility service, are now
      managed by the site manager.
  
    + The `zope.app.utility` package has been merged into
      `zope.app.component`. The utility registration class is in
      `site.py`. The utility vocabulary is in `vocabulary.py`.
  
    + The `zope.app.site` package has been merged into
      `zope.app.component`. The site code can be found in `site.py`.
  
    + Fixed persistent modules code. Persistent modules are now simply
      utilities providing `IModuleManager`. The local site manager also
      does not know any thing about persistent modules anymore.
  
    + Updated `zope.app.pluggableauth`, so that it will work as an
      authentication utility.
  
    + Restructured `zope.app.persentation` (a.k.a page folders) to the new
      component API.
  
  - Simplified the registration framework by only supporting two states:
    active and inactive. This allowed us to get rid of the registration
    stack and the complexity it introduced to the site management.
  
  - Removed all presentation-related APIs from `zope.component`. This
    included the removal of presentation-related interfaces and the
    deprecation of all view-related API functions. One should use the
    adapter API functions instead.
  
  - Implemented some initial deprecation framework, see
    `zope.deprecation`. It allows one to deprecate methods and properties
    in classes as well as any name in a module.
  
  - Moved reusable test setups/APIs from `zope.app.tests` to
    `zope.app.testing`. No reusable testing code should be in a `tests`
    package or module.
  
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/ft.py
  D   Zope3/trunk/package-includes/bundle-configure.zcml
  D   Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml
  D   Zope3/trunk/package-includes/zope.app.site.fssync-configure.zcml
  D   Zope3/trunk/package-includes/zope.app.utility.fssync-configure.zcml
  U   Zope3/trunk/releases/ZopeX3/test.py
  U   Zope3/trunk/src/buddydemo/buddy.py
  U   Zope3/trunk/src/buddydemo/ftests.py
  U   Zope3/trunk/src/buddydemo/tests.py
  U   Zope3/trunk/src/bugtracker/browser/bug.py
  U   Zope3/trunk/src/bugtracker/browser/comment.py
  U   Zope3/trunk/src/bugtracker/tests/placelesssetup.py
  U   Zope3/trunk/src/bugtracker/tests/test_dependencies.py
  U   Zope3/trunk/src/bugtracker/tests/test_mail.py
  U   Zope3/trunk/src/bugtracker/tests/test_vocabularies.py
  U   Zope3/trunk/src/bugtracker/vocabulary.py
  U   Zope3/trunk/src/z3checkins/browser.py
  U   Zope3/trunk/src/z3checkins/configure.zcml
  U   Zope3/trunk/src/z3checkins/ftests/test_z3checkins.py
  U   Zope3/trunk/src/z3checkins/message.py
  U   Zope3/trunk/src/z3checkins/tests/test_browser.py
  U   Zope3/trunk/src/zodbcode/interfaces.py
  UU  Zope3/trunk/src/zope/app/adapter/__init__.py
  UU  Zope3/trunk/src/zope/app/adapter/adapter.py
  D   Zope3/trunk/src/zope/app/adapter/browser/
  D   Zope3/trunk/src/zope/app/adapter/configure.zcml
  D   Zope3/trunk/src/zope/app/adapter/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/browser/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/classmodule/__init__.py
  U   Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py
  U   Zope3/trunk/src/zope/app/apidoc/classmodule/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/classmodule/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/configure.zcml
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/__init__.py
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/index.pt
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py
  U   Zope3/trunk/src/zope/app/apidoc/ifacemodule/tests.py
  D   Zope3/trunk/src/zope/app/apidoc/servicemodule/
  U   Zope3/trunk/src/zope/app/apidoc/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/utilities.py
  U   Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py
  U   Zope3/trunk/src/zope/app/apidoc/utilitymodule/browser.py
  U   Zope3/trunk/src/zope/app/apidoc/utilitymodule/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/utilitymodule/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py
  U   Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py
  U   Zope3/trunk/src/zope/app/apidoc/viewmodule/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/viewmodule/tests.py
  U   Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
  U   Zope3/trunk/src/zope/app/apidoc/zcmlmodule/ftests.py
  U   Zope3/trunk/src/zope/app/apidoc/zcmlmodule/tests.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_zodbcontrol.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py
  U   Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
  U   Zope3/trunk/src/zope/app/appsetup/bootstrap.py
  U   Zope3/trunk/src/zope/app/appsetup/tests.py
  U   Zope3/trunk/src/zope/app/authentication/README.txt
  U   Zope3/trunk/src/zope/app/authentication/authentication.py
  U   Zope3/trunk/src/zope/app/authentication/browser/ftests.py
  U   Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt
  U   Zope3/trunk/src/zope/app/authentication/browser/groupfolder.txt
  U   Zope3/trunk/src/zope/app/authentication/browser/principalfolder.txt
  U   Zope3/trunk/src/zope/app/authentication/browser/schemasearch.txt
  U   Zope3/trunk/src/zope/app/authentication/browser/special-groups.txt
  U   Zope3/trunk/src/zope/app/authentication/browser/tests.py
  U   Zope3/trunk/src/zope/app/authentication/browserplugins.py
  U   Zope3/trunk/src/zope/app/authentication/groupfolder.txt
  U   Zope3/trunk/src/zope/app/authentication/tests.py
  U   Zope3/trunk/src/zope/app/basicskin/standardmacros.py
  U   Zope3/trunk/src/zope/app/basicskin/tests/test_standardmacros.py
  U   Zope3/trunk/src/zope/app/browser.zcml
  D   Zope3/trunk/src/zope/app/bundle/
  U   Zope3/trunk/src/zope/app/cache/browser/cacheable.py
  U   Zope3/trunk/src/zope/app/cache/configure.zcml
  U   Zope3/trunk/src/zope/app/cache/interfaces/ram.py
  U   Zope3/trunk/src/zope/app/cache/ram.py
  U   Zope3/trunk/src/zope/app/cache/tests/test_annotationcacheable.py
  U   Zope3/trunk/src/zope/app/cache/tests/test_caching.py
  U   Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py
  U   Zope3/trunk/src/zope/app/catalog/README.txt
  U   Zope3/trunk/src/zope/app/catalog/browser/README.txt
  U   Zope3/trunk/src/zope/app/catalog/browser/catalog.py
  U   Zope3/trunk/src/zope/app/catalog/browser/ftests.py
  U   Zope3/trunk/src/zope/app/catalog/catalog.py
  U   Zope3/trunk/src/zope/app/catalog/tests.py
  A   Zope3/trunk/src/zope/app/component/README.txt
  U   Zope3/trunk/src/zope/app/component/__init__.py
  A   Zope3/trunk/src/zope/app/component/adapter.py
  A   Zope3/trunk/src/zope/app/component/adapterregistry.txt
  A   Zope3/trunk/src/zope/app/component/bbb/
  A   Zope3/trunk/src/zope/app/component/browser/
  _U  Zope3/trunk/src/zope/app/component/browser/__init__.py
  _U  Zope3/trunk/src/zope/app/component/browser/configure.zcml
  _U  Zope3/trunk/src/zope/app/component/browser/editregistration.pt
  _U  Zope3/trunk/src/zope/app/component/browser/meta.zcml
  _U  Zope3/trunk/src/zope/app/component/browser/metaconfigure.py
  _U  Zope3/trunk/src/zope/app/component/browser/metadirectives.py
  _U  Zope3/trunk/src/zope/app/component/browser/registered.pt
  _U  Zope3/trunk/src/zope/app/component/browser/registration.pt
  _U  Zope3/trunk/src/zope/app/component/browser/registration.py
  _U  Zope3/trunk/src/zope/app/component/browser/tools.py
  _U  Zope3/trunk/src/zope/app/component/browser/utility.py
  _U  Zope3/trunk/src/zope/app/component/browser/xxx_tests/test_changeregistrations.py
  _U  Zope3/trunk/src/zope/app/component/browser/xxx_tests/test_directives.py
  _U  Zope3/trunk/src/zope/app/component/browser/xxx_tests/test_editregistration.py
  _U  Zope3/trunk/src/zope/app/component/browser/xxx_tests/test_registrationview.py
  U   Zope3/trunk/src/zope/app/component/configure.zcml
  U   Zope3/trunk/src/zope/app/component/contentdirective.py
  U   Zope3/trunk/src/zope/app/component/fields.py
  U   Zope3/trunk/src/zope/app/component/hooks.py
  U   Zope3/trunk/src/zope/app/component/interface.py
  A   Zope3/trunk/src/zope/app/component/interfaces/
  _U  Zope3/trunk/src/zope/app/component/interfaces/__init__.py
  _U  Zope3/trunk/src/zope/app/component/interfaces/registration.py
  D   Zope3/trunk/src/zope/app/component/localservice.py
  U   Zope3/trunk/src/zope/app/component/meta.zcml
  U   Zope3/trunk/src/zope/app/component/metaconfigure.py
  U   Zope3/trunk/src/zope/app/component/metadirectives.py
  A   Zope3/trunk/src/zope/app/component/registration.py
  A   Zope3/trunk/src/zope/app/component/registration.txt
  A   Zope3/trunk/src/zope/app/component/site.py
  A   Zope3/trunk/src/zope/app/component/site.txt
  A   Zope3/trunk/src/zope/app/component/statusproperty.txt
  A   Zope3/trunk/src/zope/app/component/testing.py
  UU  Zope3/trunk/src/zope/app/component/tests/adapter.py
  A   Zope3/trunk/src/zope/app/component/tests/components.py
  _U  Zope3/trunk/src/zope/app/component/tests/exampleclass.py
  UU  Zope3/trunk/src/zope/app/component/tests/factory.py
  _U  Zope3/trunk/src/zope/app/component/tests/module.py
  D   Zope3/trunk/src/zope/app/component/tests/service.py
  A   Zope3/trunk/src/zope/app/component/tests/test_adapter.py
  A   Zope3/trunk/src/zope/app/component/tests/test_api.py
  U   Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py
  U   Zope3/trunk/src/zope/app/component/tests/test_directives.py
  D   Zope3/trunk/src/zope/app/component/tests/test_factory.py
  U   Zope3/trunk/src/zope/app/component/tests/test_fields.py
  D   Zope3/trunk/src/zope/app/component/tests/test_localservice.py
  A   Zope3/trunk/src/zope/app/component/tests/test_registration.py
  D   Zope3/trunk/src/zope/app/component/tests/test_requirepermissions.py
  D   Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py
  D   Zope3/trunk/src/zope/app/component/tests/test_servicemanagercontainer.py
  A   Zope3/trunk/src/zope/app/component/tests/test_site.py
  UU  Zope3/trunk/src/zope/app/component/tests/views.py
  A   Zope3/trunk/src/zope/app/component/vocabulary.py
  U   Zope3/trunk/src/zope/app/configure.zcml
  U   Zope3/trunk/src/zope/app/container/browser/adding.py
  U   Zope3/trunk/src/zope/app/container/browser/contents.py
  U   Zope3/trunk/src/zope/app/container/browser/find.py
  U   Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py
  U   Zope3/trunk/src/zope/app/container/browser/metaconfigure.py
  U   Zope3/trunk/src/zope/app/container/browser/tests/test_adding.py
  U   Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py
  U   Zope3/trunk/src/zope/app/container/browser/tests/test_directive.py
  U   Zope3/trunk/src/zope/app/container/constraints.py
  U   Zope3/trunk/src/zope/app/container/contained.py
  U   Zope3/trunk/src/zope/app/container/ftests/test_view_permissions.py
  U   Zope3/trunk/src/zope/app/container/interfaces.py
  U   Zope3/trunk/src/zope/app/container/tests/placelesssetup.py
  U   Zope3/trunk/src/zope/app/container/tests/test_btree.py
  U   Zope3/trunk/src/zope/app/container/tests/test_contained.py
  U   Zope3/trunk/src/zope/app/container/tests/test_containertraverser.py
  U   Zope3/trunk/src/zope/app/container/tests/test_icontainer.py
  U   Zope3/trunk/src/zope/app/container/tests/test_objectcopier.py
  U   Zope3/trunk/src/zope/app/container/tests/test_objectmover.py
  U   Zope3/trunk/src/zope/app/container/tests/test_ordered.py
  U   Zope3/trunk/src/zope/app/container/traversal.py
  U   Zope3/trunk/src/zope/app/content/configure.zcml
  U   Zope3/trunk/src/zope/app/copypastemove/__init__.py
  U   Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py
  U   Zope3/trunk/src/zope/app/copypastemove/tests/test_rename.py
  U   Zope3/trunk/src/zope/app/dav/configure.zcml
  U   Zope3/trunk/src/zope/app/dav/ftests/dav.py
  U   Zope3/trunk/src/zope/app/dav/ftests/test_propfind.py
  U   Zope3/trunk/src/zope/app/dav/ftests/test_proppatch.py
  U   Zope3/trunk/src/zope/app/dav/mkcol.py
  U   Zope3/trunk/src/zope/app/dav/propfind.py
  U   Zope3/trunk/src/zope/app/dav/proppatch.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_adapter.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_mkcol.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_propfind.py
  U   Zope3/trunk/src/zope/app/dav/tests/test_proppatch.py
  U   Zope3/trunk/src/zope/app/demo/insensitivefolder/__init__.py
  U   Zope3/trunk/src/zope/app/demo/insensitivefolder/ftests.py
  U   Zope3/trunk/src/zope/app/demo/jobboard/browser.py
  U   Zope3/trunk/src/zope/app/demo/jobboard/job.py
  U   Zope3/trunk/src/zope/app/demo/pagelet/app.py
  U   Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py
  U   Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
  U   Zope3/trunk/src/zope/app/demo/pageletchooser/adapters.py
  U   Zope3/trunk/src/zope/app/demo/pageletchooser/configure.zcml
  U   Zope3/trunk/src/zope/app/demo/pageletchooser/ftests.py
  U   Zope3/trunk/src/zope/app/dependable/tests.py
  U   Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py
  U   Zope3/trunk/src/zope/app/dtmlpage/ftests.py
  U   Zope3/trunk/src/zope/app/dtmlpage/tests/test_dtmlpage.py
  U   Zope3/trunk/src/zope/app/dublincore/tests/test_creatorannotator.py
  U   Zope3/trunk/src/zope/app/dublincore/tests/test_dcsv.py
  U   Zope3/trunk/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py
  U   Zope3/trunk/src/zope/app/error/browser/__init__.py
  U   Zope3/trunk/src/zope/app/error/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/error/tests.py
  U   Zope3/trunk/src/zope/app/event/dispatching.py
  U   Zope3/trunk/src/zope/app/event/tests/placelesssetup.py
  U   Zope3/trunk/src/zope/app/event/tests/test_objectevent.py
  U   Zope3/trunk/src/zope/app/exception/browser/ftests.py
  U   Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py
  U   Zope3/trunk/src/zope/app/externaleditor/browser/__init__.py
  U   Zope3/trunk/src/zope/app/externaleditor/interfaces.py
  U   Zope3/trunk/src/zope/app/externaleditor/tests/test_external_edit.py
  U   Zope3/trunk/src/zope/app/file/browser/ftests.py
  U   Zope3/trunk/src/zope/app/file/browser/image.py
  U   Zope3/trunk/src/zope/app/file/file.py
  U   Zope3/trunk/src/zope/app/file/ftests/test_file.py
  U   Zope3/trunk/src/zope/app/file/ftests/test_image.py
  U   Zope3/trunk/src/zope/app/folder/filerepresentation.py
  U   Zope3/trunk/src/zope/app/folder/folder.py
  U   Zope3/trunk/src/zope/app/folder/fssync/adapter.py
  U   Zope3/trunk/src/zope/app/folder/interfaces.py
  U   Zope3/trunk/src/zope/app/folder/tests.py
  U   Zope3/trunk/src/zope/app/form/browser/add.py
  U   Zope3/trunk/src/zope/app/form/browser/addwizard.py
  U   Zope3/trunk/src/zope/app/form/browser/editview.py
  U   Zope3/trunk/src/zope/app/form/browser/editwizard.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_checkboxwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_datetimewidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_editview.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_filewidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_floatwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_objectwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_textwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
  U   Zope3/trunk/src/zope/app/form/browser/schemadisplay.py
  U   Zope3/trunk/src/zope/app/form/browser/sequencewidget.py
  U   Zope3/trunk/src/zope/app/form/browser/source.py
  U   Zope3/trunk/src/zope/app/form/browser/source.txt
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_add.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_choicecollections.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_choicewidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_editview.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_objectwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_registrations.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_sequencewidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_source.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_widgetdirective.py
  U   Zope3/trunk/src/zope/app/form/browser/widget.py
  U   Zope3/trunk/src/zope/app/form/tests/test_utility.py
  U   Zope3/trunk/src/zope/app/form/tests/test_widget.py
  U   Zope3/trunk/src/zope/app/form/utility.py
  U   Zope3/trunk/src/zope/app/fssync/configure.zcml
  U   Zope3/trunk/src/zope/app/fssync/fsbundle.py
  U   Zope3/trunk/src/zope/app/fssync/fsregistry.py
  U   Zope3/trunk/src/zope/app/fssync/interfaces.py
  U   Zope3/trunk/src/zope/app/fssync/syncer.py
  U   Zope3/trunk/src/zope/app/fssync/tests/sampleclass.py
  U   Zope3/trunk/src/zope/app/fssync/tests/test_committer.py
  U   Zope3/trunk/src/zope/app/fssync/tests/test_fsbundle.py
  U   Zope3/trunk/src/zope/app/fssync/tests/test_fsdirective.py
  U   Zope3/trunk/src/zope/app/fssync/tests/test_fsregistry.py
  U   Zope3/trunk/src/zope/app/ftests/doctest.txt
  U   Zope3/trunk/src/zope/app/ftests/test_functional.py
  U   Zope3/trunk/src/zope/app/ftests/test_introspector.py
  U   Zope3/trunk/src/zope/app/ftp/tests/test_ftpview.py
  U   Zope3/trunk/src/zope/app/generations/README.txt
  U   Zope3/trunk/src/zope/app/generations/browser/ftests.py
  U   Zope3/trunk/src/zope/app/generations/browser/managerdetails.py
  U   Zope3/trunk/src/zope/app/generations/browser/managers.py
  U   Zope3/trunk/src/zope/app/generations/generations.py
  U   Zope3/trunk/src/zope/app/homefolder/README.txt
  U   Zope3/trunk/src/zope/app/homefolder/tests.py
  U   Zope3/trunk/src/zope/app/http/options.py
  U   Zope3/trunk/src/zope/app/http/tests/test_delete.py
  U   Zope3/trunk/src/zope/app/http/tests/test_put.py
  U   Zope3/trunk/src/zope/app/i18n/browser/__init__.py
  U   Zope3/trunk/src/zope/app/i18n/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/i18n/browser/synchronize.pt
  U   Zope3/trunk/src/zope/app/i18n/browser/synchronize.py
  U   Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py
  U   Zope3/trunk/src/zope/app/i18n/browser/translatemessage.pt
  U   Zope3/trunk/src/zope/app/i18n/configure.zcml
  U   Zope3/trunk/src/zope/app/i18n/metadirectives.py
  U   Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py
  U   Zope3/trunk/src/zope/app/i18n/tests/test_filters.py
  U   Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py
  U   Zope3/trunk/src/zope/app/i18n/translationdomain.py
  U   Zope3/trunk/src/zope/app/interface/tests/test_interface.py
  U   Zope3/trunk/src/zope/app/interface/tests/test_vocabulary.py
  U   Zope3/trunk/src/zope/app/interpreter/python.py
  U   Zope3/trunk/src/zope/app/intid/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/intid/browser/ftests.py
  U   Zope3/trunk/src/zope/app/intid/browser/tracking.txt
  U   Zope3/trunk/src/zope/app/intid/ftests.py
  U   Zope3/trunk/src/zope/app/intid/tests.py
  U   Zope3/trunk/src/zope/app/introspector/__init__.py
  U   Zope3/trunk/src/zope/app/introspector/browser.py
  U   Zope3/trunk/src/zope/app/introspector/interfaces.py
  U   Zope3/trunk/src/zope/app/introspector/introspector.pt
  U   Zope3/trunk/src/zope/app/introspector/marker.pt
  U   Zope3/trunk/src/zope/app/introspector/tests/test_introspector.py
  U   Zope3/trunk/src/zope/app/introspector/tests/test_introspectorview.py
  U   Zope3/trunk/src/zope/app/location/traversing.py
  U   Zope3/trunk/src/zope/app/locking/tests.py
  U   Zope3/trunk/src/zope/app/mail/interfaces.py
  U   Zope3/trunk/src/zope/app/mail/metaconfigure.py
  U   Zope3/trunk/src/zope/app/mail/metadirectives.py
  U   Zope3/trunk/src/zope/app/mail/tests/test_delivery.py
  U   Zope3/trunk/src/zope/app/mail/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/mail/tests/test_event.py
  U   Zope3/trunk/src/zope/app/meta.zcml
  A   Zope3/trunk/src/zope/app/module/README.txt
  U   Zope3/trunk/src/zope/app/module/__init__.py
  U   Zope3/trunk/src/zope/app/module/browser/__init__.py
  D   Zope3/trunk/src/zope/app/module/browser/add_module.pt
  U   Zope3/trunk/src/zope/app/module/browser/browse_module.pt
  U   Zope3/trunk/src/zope/app/module/browser/configure.zcml
  D   Zope3/trunk/src/zope/app/module/browser/edit_module.pt
  U   Zope3/trunk/src/zope/app/module/configure.zcml
  U   Zope3/trunk/src/zope/app/module/fssync/adapter.py
  U   Zope3/trunk/src/zope/app/module/fssync/configure.zcml
  U   Zope3/trunk/src/zope/app/module/interfaces.py
  A   Zope3/trunk/src/zope/app/module/manager.py
  D   Zope3/trunk/src/zope/app/module/tests/
  A   Zope3/trunk/src/zope/app/module/tests.py
  U   Zope3/trunk/src/zope/app/observable/ftests.py
  U   Zope3/trunk/src/zope/app/onlinehelp/browser/__init__.py
  U   Zope3/trunk/src/zope/app/onlinehelp/browser/ftests.py
  U   Zope3/trunk/src/zope/app/onlinehelp/onlinehelp.py
  U   Zope3/trunk/src/zope/app/onlinehelp/tests/test_helpdirectives.py
  U   Zope3/trunk/src/zope/app/onlinehelp/tests/test_onlinehelp.py
  U   Zope3/trunk/src/zope/app/pagelet/README.txt
  U   Zope3/trunk/src/zope/app/pagelet/collector.py
  U   Zope3/trunk/src/zope/app/pagelet/metaconfigure.py
  U   Zope3/trunk/src/zope/app/pagelet/tales.py
  U   Zope3/trunk/src/zope/app/pagelet/tests/test_pagelet.py
  U   Zope3/trunk/src/zope/app/pageletchooser/adapters.py
  U   Zope3/trunk/src/zope/app/pageletchooser/collector.py
  U   Zope3/trunk/src/zope/app/pageletchooser/configure.zcml
  U   Zope3/trunk/src/zope/app/pageletchooser/tests.py
  U   Zope3/trunk/src/zope/app/pageletchooser/vocabulary.py
  U   Zope3/trunk/src/zope/app/pagetemplate/engine.py
  U   Zope3/trunk/src/zope/app/pagetemplate/simpleviewclass.py
  U   Zope3/trunk/src/zope/app/pagetemplate/tests/test_binding.py
  U   Zope3/trunk/src/zope/app/pagetemplate/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/pagetemplate/tests/test_simpleviewclass.py
  U   Zope3/trunk/src/zope/app/pagetemplate/tests/test_viewzpt.py
  U   Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py
  U   Zope3/trunk/src/zope/app/pluggableauth/__init__.py
  U   Zope3/trunk/src/zope/app/pluggableauth/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/pluggableauth/configure.zcml
  U   Zope3/trunk/src/zope/app/pluggableauth/interfaces.py
  U   Zope3/trunk/src/zope/app/pluggableauth/tests/authsetup.py
  U   Zope3/trunk/src/zope/app/pluggableauth/tests/test_pluggableauth.py
  U   Zope3/trunk/src/zope/app/presentation/__init__.py
  D   Zope3/trunk/src/zope/app/presentation/browser/
  A   Zope3/trunk/src/zope/app/presentation/browser.py
  A   Zope3/trunk/src/zope/app/presentation/browser.zcml
  U   Zope3/trunk/src/zope/app/presentation/configure.zcml
  A   Zope3/trunk/src/zope/app/presentation/fssync.py
  A   Zope3/trunk/src/zope/app/presentation/interfaces.py
  U   Zope3/trunk/src/zope/app/presentation/pagefolder.py
  D   Zope3/trunk/src/zope/app/presentation/pagefolder.zcml
  A   Zope3/trunk/src/zope/app/presentation/pagereg_details.pt
  D   Zope3/trunk/src/zope/app/presentation/presentation.py
  A   Zope3/trunk/src/zope/app/presentation/registration.py
  U   Zope3/trunk/src/zope/app/presentation/tests/test_pagefolder.py
  U   Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py
  U   Zope3/trunk/src/zope/app/presentation/tests/test_zpt.py
  U   Zope3/trunk/src/zope/app/presentation/zpt.py
  D   Zope3/trunk/src/zope/app/presentation/zpt.zcml
  U   Zope3/trunk/src/zope/app/principalannotation/__init__.py
  U   Zope3/trunk/src/zope/app/principalannotation/configure.zcml
  U   Zope3/trunk/src/zope/app/principalannotation/interfaces.py
  U   Zope3/trunk/src/zope/app/principalannotation/tests.py
  U   Zope3/trunk/src/zope/app/publication/browser.py
  U   Zope3/trunk/src/zope/app/publication/ftests.py
  U   Zope3/trunk/src/zope/app/publication/ftp.py
  U   Zope3/trunk/src/zope/app/publication/http.py
  U   Zope3/trunk/src/zope/app/publication/httpfactory.py
  U   Zope3/trunk/src/zope/app/publication/publicationtraverse.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_http.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_httpfactory.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py
  U   Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py
  U   Zope3/trunk/src/zope/app/publication/traversers.py
  U   Zope3/trunk/src/zope/app/publication/zopepublication.py
  U   Zope3/trunk/src/zope/app/publisher/browser/__init__.py
  U   Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/publisher/browser/fields.py
  U   Zope3/trunk/src/zope/app/publisher/browser/i18nresourcemeta.py
  U   Zope3/trunk/src/zope/app/publisher/browser/icon.py
  U   Zope3/trunk/src/zope/app/publisher/browser/menu.py
  U   Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py
  U   Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py
  U   Zope3/trunk/src/zope/app/publisher/browser/resource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/resourcemeta.py
  U   Zope3/trunk/src/zope/app/publisher/browser/resources.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/support.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_fields.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_fileresource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_menu.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_menudirectives.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_resource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_resources.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/testi18nfileresource.py
  U   Zope3/trunk/src/zope/app/publisher/browser/viewmeta.py
  U   Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt
  U   Zope3/trunk/src/zope/app/publisher/xmlrpc/__init__.py
  U   Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py
  U   Zope3/trunk/src/zope/app/publisher/xmlrpc/metaconfigure.py
  U   Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/pythonpage/__init__.py
  U   Zope3/trunk/src/zope/app/pythonpage/tests.py
  U   Zope3/trunk/src/zope/app/rdb/__init__.py
  U   Zope3/trunk/src/zope/app/rdb/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/rdb/interfaces.py
  U   Zope3/trunk/src/zope/app/rdb/metaconfigure.py
  U   Zope3/trunk/src/zope/app/rdb/tests/test_directives.py
  D   Zope3/trunk/src/zope/app/registration/PACKAGE.cfg
  D   Zope3/trunk/src/zope/app/registration/README.txt
  UU  Zope3/trunk/src/zope/app/registration/__init__.py
  D   Zope3/trunk/src/zope/app/registration/browser/
  D   Zope3/trunk/src/zope/app/registration/configure.zcml
  D   Zope3/trunk/src/zope/app/registration/fssync/
  UU  Zope3/trunk/src/zope/app/registration/interfaces.py
  UU  Zope3/trunk/src/zope/app/registration/registration.py
  D   Zope3/trunk/src/zope/app/registration/tests/
  U   Zope3/trunk/src/zope/app/renderer/metaconfigure.py
  U   Zope3/trunk/src/zope/app/renderer/tests/test_vocabulary.py
  U   Zope3/trunk/src/zope/app/rotterdam/ftests.py
  U   Zope3/trunk/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py
  U   Zope3/trunk/src/zope/app/rotterdam/xmlobject.py
  U   Zope3/trunk/src/zope/app/schema/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/schema/browser/traversal.py
  U   Zope3/trunk/src/zope/app/schema/configure.zcml
  U   Zope3/trunk/src/zope/app/schema/fields.zcml
  U   Zope3/trunk/src/zope/app/schema/metadirectives.py
  U   Zope3/trunk/src/zope/app/schema/schema.py
  U   Zope3/trunk/src/zope/app/schema/tests/fields.zcml
  U   Zope3/trunk/src/zope/app/schema/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_field.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.zcml
  U   Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_schemautility.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_schemautilitypersistence.py
  U   Zope3/trunk/src/zope/app/schema/vocabulary.py
  U   Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py
  U   Zope3/trunk/src/zope/app/schemacontent/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/schemacontent/configure.zcml
  U   Zope3/trunk/src/zope/app/schemacontent/content.py
  U   Zope3/trunk/src/zope/app/schemacontent/interfaces.py
  U   Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
  U   Zope3/trunk/src/zope/app/security/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/security/browser/principalterms.txt
  U   Zope3/trunk/src/zope/app/security/browser/tests.py
  U   Zope3/trunk/src/zope/app/security/configure.zcml
  U   Zope3/trunk/src/zope/app/security/interfaces.py
  U   Zope3/trunk/src/zope/app/security/permission.py
  U   Zope3/trunk/src/zope/app/security/tests/__init__.py
  U   Zope3/trunk/src/zope/app/security/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py
  U   Zope3/trunk/src/zope/app/security/tests/test_protectclass.py
  U   Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py
  U   Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
  U   Zope3/trunk/src/zope/app/security/vocabulary.py
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/ftests.py
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/granting.pt
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_granting.py
  U   Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
  U   Zope3/trunk/src/zope/app/securitypolicy/configure.zcml
  U   Zope3/trunk/src/zope/app/securitypolicy/role.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/functional.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
  U   Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py
  U   Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py
  U   Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt
  U   Zope3/trunk/src/zope/app/session/bootstrap.py
  U   Zope3/trunk/src/zope/app/session/ftests.py
  U   Zope3/trunk/src/zope/app/session/http.py
  U   Zope3/trunk/src/zope/app/session/interfaces.py
  U   Zope3/trunk/src/zope/app/session/session.py
  U   Zope3/trunk/src/zope/app/session/tests.py
  D   Zope3/trunk/src/zope/app/site/PACKAGE.cfg
  UU  Zope3/trunk/src/zope/app/site/__init__.py
  D   Zope3/trunk/src/zope/app/site/browser/
  D   Zope3/trunk/src/zope/app/site/configure.zcml
  UU  Zope3/trunk/src/zope/app/site/folder.py
  D   Zope3/trunk/src/zope/app/site/fssync/
  UU  Zope3/trunk/src/zope/app/site/interfaces.py
  U   Zope3/trunk/src/zope/app/site/metaconfigure.py
  UU  Zope3/trunk/src/zope/app/site/service.py
  UU  Zope3/trunk/src/zope/app/site/servicecontainer.py
  UU  Zope3/trunk/src/zope/app/site/tests/__init__.py
  UU  Zope3/trunk/src/zope/app/site/tests/placefulsetup.py
  D   Zope3/trunk/src/zope/app/site/tests/test_directives.py
  D   Zope3/trunk/src/zope/app/site/tests/test_folder.py
  D   Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
  D   Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py
  U   Zope3/trunk/src/zope/app/sqlexpr/tests.py
  U   Zope3/trunk/src/zope/app/sqlscript/browser/ftests.py
  U   Zope3/trunk/src/zope/app/sqlscript/browser/sqlscript.py
  U   Zope3/trunk/src/zope/app/sqlscript/configure.zcml
  U   Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py
  A   Zope3/trunk/src/zope/app/testing/
  _U  Zope3/trunk/src/zope/app/testing/dochttp.py
  _U  Zope3/trunk/src/zope/app/testing/dochttp.txt
  _U  Zope3/trunk/src/zope/app/testing/functional.py
  _U  Zope3/trunk/src/zope/app/testing/placelesssetup.py
  _U  Zope3/trunk/src/zope/app/testing/setup.py
  UU  Zope3/trunk/src/zope/app/testing/test.py
  _U  Zope3/trunk/src/zope/app/testing/ztapi.py
  U   Zope3/trunk/src/zope/app/tests/__init__.py
  D   Zope3/trunk/src/zope/app/tests/dochttp.py
  D   Zope3/trunk/src/zope/app/tests/dochttp.txt
  D   Zope3/trunk/src/zope/app/tests/functional.py
  D   Zope3/trunk/src/zope/app/tests/placelesssetup.py
  D   Zope3/trunk/src/zope/app/tests/recorded/
  D   Zope3/trunk/src/zope/app/tests/setup.py
  D   Zope3/trunk/src/zope/app/tests/test.py
  D   Zope3/trunk/src/zope/app/tests/test_dochttp.py
  D   Zope3/trunk/src/zope/app/tests/test_functional.py
  D   Zope3/trunk/src/zope/app/tests/ztapi.py
  U   Zope3/trunk/src/zope/app/traversing/browser/absoluteurl.py
  U   Zope3/trunk/src/zope/app/traversing/browser/tests.py
  U   Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
  U   Zope3/trunk/src/zope/app/traversing/namespace.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_etc.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_namespacetrversal.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_physicallocationadapters.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_presentation.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_skin.py
  U   Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py
  U   Zope3/trunk/src/zope/app/tree/adapters.py
  U   Zope3/trunk/src/zope/app/tree/browser/cookie.py
  U   Zope3/trunk/src/zope/app/tree/browser/tests.py
  U   Zope3/trunk/src/zope/app/tree/configure.zcml
  U   Zope3/trunk/src/zope/app/tree/tests/basetest.py
  U   Zope3/trunk/src/zope/app/tree/tests/test_adapters.py
  U   Zope3/trunk/src/zope/app/undo/__init__.py
  U   Zope3/trunk/src/zope/app/undo/tests/test_undoview.py
  U   Zope3/trunk/src/zope/app/undo/tests/test_zodbundomanager.py
  D   Zope3/trunk/src/zope/app/utility/PACKAGE.cfg
  UU  Zope3/trunk/src/zope/app/utility/__init__.py
  D   Zope3/trunk/src/zope/app/utility/browser/
  D   Zope3/trunk/src/zope/app/utility/configure.zcml
  D   Zope3/trunk/src/zope/app/utility/fssync/
  UU  Zope3/trunk/src/zope/app/utility/interfaces.py
  D   Zope3/trunk/src/zope/app/utility/meta.zcml
  D   Zope3/trunk/src/zope/app/utility/metaconfigure.py
  D   Zope3/trunk/src/zope/app/utility/tests.py
  UU  Zope3/trunk/src/zope/app/utility/utility.py
  UU  Zope3/trunk/src/zope/app/utility/vocabulary.py
  U   Zope3/trunk/src/zope/app/versioncontrol/README.txt
  U   Zope3/trunk/src/zope/app/wfmc/__init__.py
  U   Zope3/trunk/src/zope/app/wfmc/metaconfigure.py
  U   Zope3/trunk/src/zope/app/wfmc/metadirectives.py
  U   Zope3/trunk/src/zope/app/wfmc/tests.py
  U   Zope3/trunk/src/zope/app/workflow/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/workflow/browser/definition.py
  U   Zope3/trunk/src/zope/app/workflow/definition.py
  U   Zope3/trunk/src/zope/app/workflow/instance.py
  U   Zope3/trunk/src/zope/app/workflow/interfaces/__init__.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/contentworkflow.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/instance.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/tests/test_definition.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py
  U   Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
  U   Zope3/trunk/src/zope/app/workflow/tests/test_instance.py
  U   Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py
  U   Zope3/trunk/src/zope/app/zapi/README.txt
  U   Zope3/trunk/src/zope/app/zapi/__init__.py
  U   Zope3/trunk/src/zope/app/zapi/interfaces.py
  U   Zope3/trunk/src/zope/app/zapi/tests.py
  U   Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py
  U   Zope3/trunk/src/zope/app/zopetop/ftests.py
  U   Zope3/trunk/src/zope/app/zopetop/widget_macros.pt
  U   Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
  U   Zope3/trunk/src/zope/app/zptpage/tests/test_zptpage.py
  U   Zope3/trunk/src/zope/app/zptpage/textindex/tests.py
  U   Zope3/trunk/src/zope/app/zptpage/zptpage.py
  U   Zope3/trunk/src/zope/component/__init__.py
  D   Zope3/trunk/src/zope/component/adapter.py
  A   Zope3/trunk/src/zope/component/bbb/
  _U  Zope3/trunk/src/zope/component/bbb/__init__.py
  _U  Zope3/trunk/src/zope/component/bbb/adapter.py
  _U  Zope3/trunk/src/zope/component/bbb/contextdependent.py
  _U  Zope3/trunk/src/zope/component/bbb/exceptions.py
  _U  Zope3/trunk/src/zope/component/bbb/interfaces.py
  _U  Zope3/trunk/src/zope/component/bbb/service.py
  _U  Zope3/trunk/src/zope/component/bbb/servicenames.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/components.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/placelesssetup.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/request.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/test_adapter.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/test_api.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/test_service.py
  _U  Zope3/trunk/src/zope/component/bbb/tests/test_utilityservice.py
  _U  Zope3/trunk/src/zope/component/bbb/utility.py
  D   Zope3/trunk/src/zope/component/contextdependent.py
  D   Zope3/trunk/src/zope/component/exceptions.py
  A   Zope3/trunk/src/zope/component/factory.txt
  U   Zope3/trunk/src/zope/component/interfaces.py
  D   Zope3/trunk/src/zope/component/service.py
  D   Zope3/trunk/src/zope/component/servicenames.py
  A   Zope3/trunk/src/zope/component/site.py
  A   Zope3/trunk/src/zope/component/socketexample.txt
  A   Zope3/trunk/src/zope/component/testing.py
  D   Zope3/trunk/src/zope/component/tests/
  A   Zope3/trunk/src/zope/component/tests.py
  D   Zope3/trunk/src/zope/component/utility.py
  U   Zope3/trunk/src/zope/configuration/config.py
  A   Zope3/trunk/src/zope/deprecation/
  U   Zope3/trunk/src/zope/deprecation/README.txt
  U   Zope3/trunk/src/zope/deprecation/tests.py
  U   Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py
  U   Zope3/trunk/src/zope/i18n/tests/test_translationdomain.py
  U   Zope3/trunk/src/zope/interface/declarations.py
  U   Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py
  U   Zope3/trunk/src/zope/testing/cleanup.py
  U   Zope3/trunk/src/zope/wfmc/tests.py
  U   Zope3/trunk/src/zwiki/browser/wikipage.py
  U   Zope3/trunk/src/zwiki/tests/test_docstrings.py
  U   Zope3/trunk/src/zwiki/tests/test_traverser.py
  U   Zope3/trunk/src/zwiki/tests/test_wikimail.py
  U   Zope3/trunk/src/zwiki/tests/test_wikipagehierarchy.py
  U   Zope3/trunk/src/zwiki/traversal.py
  U   Zope3/trunk/test.py
  U   Zope3/trunk/zpl.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/doc/CHANGES.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -12,6 +12,10 @@
 
       - New schema field: Timedelta.
 
+      - Implemented some initial deprecation framework, see
+        `zope.deprecation`. It allows one to deprecate methods and properties
+        in classes as well as any name in a module.
+
       - The browser:containerViews directive provides an optional layer
         attribute.
 
@@ -218,8 +222,14 @@
         doctest count a test for every example that is preceeded by
         prose. (Although a doctest will never count less than 1 test.)
 
-      - Removal of Services.
+      - Moved reusable test setups/APIs from `zope.app.tests` to
+        `zope.app.testing`. No reusable testing code should be in a `tests`
+        package or module.
 
+      - Removal of Services. You can now access the adapter and utiliy
+        registry directly via the site manager's `adapters` and `utilities`
+        attribute, respecitvely.
+
         + Converted Error Reporting Service to a utility. Added database
           evolution code to convert all service instances to utilities.
 
@@ -229,7 +239,39 @@
         + Converted Principal Annotation Service to be a utility. Added
           database evolution code to convert all service instances to
           utilities.
+        
+        + Converted FSSync Service to be a utility.
 
+        + Created the concept of a global site manager. The adapter and
+          utility registry, formerly the adapter and utility service, are now
+          managed by the site manager.
+
+        + The `zope.app.utility` package has been merged into
+          `zope.app.component`. The utility registration class is in
+          `site.py`. The utility vocabulary is in `vocabulary.py`.
+
+        + The `zope.app.site` package has been merged into
+          `zope.app.component`. The site code can be found in `site.py`.
+
+        + Fixed persistent modules code. Persistent modules are now simply
+          utilities providing `IModuleManager`. The local site manager also
+          does not know any thing about persistent modules anymore.
+
+        + Updated `zope.app.pluggableauth`, so that it will work as an
+          authentication utility.
+
+        + Restructured `zope.app.persentation` (a.k.a page folders) to the new
+          component API.
+
+      - Simplified the registration framework by only supporting two states:
+        active and inactive. This allowed us to get rid of the registration
+        stack and the complexity it introduced to the site management.
+
+      - Removed all presentation-related APIs from `zope.component`. This
+        included the removal of presentation-related interfaces and the
+        deprecation of all view-related API functions. One should use the
+        adapter API functions instead.
+
       - The `pluggableauth` package has been deprecated. The `authentication`
         module provides a much more modular approach with many more
         capabilities.

Modified: Zope3/trunk/ft.py
===================================================================
--- Zope3/trunk/ft.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/ft.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import FunctionalTestCase
+from zope.app.testing.functional import FunctionalTestCase
 
 __docformat__ = "reStructuredText"
 
@@ -61,7 +61,7 @@
         #
         # There are helper methods in FunctionalTestCase and BrowserTestCase
         # for accessing the ZODB and emulating publication requests.  See the
-        # docstrings in zope.app.tests.functional module.
+        # docstrings in zope.app.testing.functional module.
         pass
 
 

Deleted: Zope3/trunk/package-includes/bundle-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/bundle-configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/package-includes/bundle-configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +0,0 @@
-<include package="zope.app.bundle"/>

Deleted: Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +0,0 @@
-<include package="zope.app.registration.fssync" />

Deleted: Zope3/trunk/package-includes/zope.app.site.fssync-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/zope.app.site.fssync-configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/package-includes/zope.app.site.fssync-configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +0,0 @@
-<include package="zope.app.site.fssync" />

Deleted: Zope3/trunk/package-includes/zope.app.utility.fssync-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/zope.app.utility.fssync-configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/package-includes/zope.app.utility.fssync-configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +0,0 @@
-<include package="zope.app.utility.fssync" />

Modified: Zope3/trunk/releases/ZopeX3/test.py
===================================================================
--- Zope3/trunk/releases/ZopeX3/test.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/releases/ZopeX3/test.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -29,8 +29,8 @@
 lib = os.path.join(here, "build", "lib." + PLAT_SPEC)
 sys.path.append(lib)
 
-import zope.app.tests.test
+import zope.app.testing.test
 
 if __name__ == '__main__':
     args = sys.argv[:1] + ["-ul", lib] + sys.argv[1:]
-    zope.app.tests.test.process_args(args)
+    zope.app.testing.test.process_args(args)

Modified: Zope3/trunk/src/buddydemo/buddy.py
===================================================================
--- Zope3/trunk/src/buddydemo/buddy.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/buddydemo/buddy.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -38,7 +38,7 @@
     sake of the example, we'll install one, but first,
     we have to set up the component architecture:
 
-      >>> from zope.app.tests import placelesssetup, ztapi
+      >>> from zope.app.testing import placelesssetup, ztapi
       >>> placelesssetup.setUp()
 
     and then we can provide the utility:

Modified: Zope3/trunk/src/buddydemo/ftests.py
===================================================================
--- Zope3/trunk/src/buddydemo/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/buddydemo/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,6 @@
 import unittest
 from buddydemo.buddy import Buddy
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class Test(BrowserTestCase):
 

Modified: Zope3/trunk/src/buddydemo/tests.py
===================================================================
--- Zope3/trunk/src/buddydemo/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/buddydemo/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -58,7 +58,7 @@
     Our rename view is going to generate an event. Because
     of that, we need to setup an event service:
 
-      >>> from zope.app.tests import placelesssetup
+      >>> from zope.app.testing import placelesssetup
       >>> placelesssetup.setUp()
       
     We should be able to create a BuddyRename on this

Modified: Zope3/trunk/src/bugtracker/browser/bug.py
===================================================================
--- Zope3/trunk/src/bugtracker/browser/bug.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/browser/bug.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -74,7 +74,8 @@
         if ttype is not None:
             source = zapi.createObject(None, self.context.description.ttype,
                                        self.context.description)
-            view = zapi.getView(removeAllProxies(source), '', self.request)
+            view = zapi.getMultiAdapter(
+                (removeAllProxies(source), self.request))
             html = view.render()
         else:
             html = self.context.description

Modified: Zope3/trunk/src/bugtracker/browser/comment.py
===================================================================
--- Zope3/trunk/src/bugtracker/browser/comment.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/browser/comment.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -55,7 +55,8 @@
         if ttype is not None:
             source = zapi.createObject(None, self.context.body.ttype,
                                        self.context.body)
-            view = zapi.getView(removeAllProxies(source), '', self.request)
+            view = zapi.getMultiAdapter(
+                (removeAllProxies(source), self.request))
             html = view.render()
         else:
             html = self.context.body

Modified: Zope3/trunk/src/bugtracker/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/bugtracker/tests/placelesssetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/tests/placelesssetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,13 +22,12 @@
 from datetime import datetime
 
 from zope.component.interfaces import IFactory
-from zope.component.service import defineService, serviceManager
 from zope.interface import classImplements, implements
 from zope.schema.vocabulary import getVocabularyRegistry
 
 from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.placelesssetup import PlacelessSetup as SetupBase
+from zope.app.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup as SetupBase
 from zope.app.annotation.attribute import AttributeAnnotations
 from zope.app.file import File
 from zope.app.container.interfaces import INameChooser
@@ -105,10 +104,7 @@
         registry.register('Releases', ReleaseVocabulary)
         registry.register('Users', UserVocabulary)
 
-        defineService(zapi.servicenames.Authentication,
-                      IAuthentication)
-        serviceManager.provideService(zapi.servicenames.Authentication,
-                                      principalRegistry)
+        ztapi.provideUtility(IAuthentication, principalRegistry)
 
         principalRegistry.definePrincipal(u'zope.srichter',
                                           u'Stephan Richter', u'',

Modified: Zope3/trunk/src/bugtracker/tests/test_dependencies.py
===================================================================
--- Zope3/trunk/src/bugtracker/tests/test_dependencies.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/tests/test_dependencies.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,7 @@
 from zope.interface import classImplements
 from zope.component.tests.placelesssetup import PlacelessSetup
 
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.annotation.attribute import AttributeAnnotations
 from zope.app.location.interfaces import ILocation

Modified: Zope3/trunk/src/bugtracker/tests/test_mail.py
===================================================================
--- Zope3/trunk/src/bugtracker/tests/test_mail.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/tests/test_mail.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,11 +17,10 @@
 """
 import unittest
 
-from zope.component.service import defineService, serviceManager
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.interface import classImplements, implements
 
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.dublincore.interfaces import IWriteZopeDublinCore
 from zope.app.traversing.interfaces import IPhysicallyLocatable

Modified: Zope3/trunk/src/bugtracker/tests/test_vocabularies.py
===================================================================
--- Zope3/trunk/src/bugtracker/tests/test_vocabularies.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/tests/test_vocabularies.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,14 +17,13 @@
 """
 import unittest
 
-from zope.component.service import defineService, serviceManager
 from zope.interface import classImplements, implements
 from zope.schema.interfaces import ITokenizedTerm
 from zope.schema.vocabulary import getVocabularyRegistry
 
 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.annotation.attribute import AttributeAnnotations
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.container.contained import contained, Contained
@@ -195,9 +194,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        defineService(zapi.servicenames.Authentication, IAuthentication)
-        serviceManager.provideService(zapi.servicenames.Authentication,
-                                      principalRegistry)
+        ztapi.provideUtility(IAuthentication, principalRegistry)
         principalRegistry.definePrincipal(
             '0', 'title0', 'desc0', 'zero', 'pass0')
         principalRegistry.definePrincipal(

Modified: Zope3/trunk/src/bugtracker/vocabulary.py
===================================================================
--- Zope3/trunk/src/bugtracker/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/bugtracker/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -191,7 +191,7 @@
     implements(IVocabulary, IVocabularyTokenized)
 
     def __init__(self, context):
-        self.auth = zapi.getService(zapi.servicenames.Authentication)
+        self.auth = zapi.principals()
     
     def __contains__(self, value):
         ids = map(lambda p: p.id, self.auth.getPrincipals(''))

Modified: Zope3/trunk/src/z3checkins/browser.py
===================================================================
--- Zope3/trunk/src/z3checkins/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/z3checkins/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -3,15 +3,15 @@
 
 $Id$
 """
-
 import re
 import mailbox
 from StringIO import StringIO
 
-from zope.component import getUtility, getView
 from zope.interface import implements
 from zope.exceptions import DuplicationError
 from zope.proxy import removeAllProxies
+
+from zope.app import zapi
 from zope.app.datetimeutils import parseDatetimetz, DateTimeError
 from zope.app.publisher.browser import BrowserView
 from zope.app.form import CustomWidgetFactory
@@ -35,7 +35,7 @@
     def createAndAdd(self, data):
         if data.has_key('data'): # XXX should we bark if no data is given?
             msg_raw = data['data']
-            parser = getUtility(IMessageParser)
+            parser = zapi.getUtility(IMessageParser)
             if msg_raw.startswith("From "):
                 # detected an mbox file
                 mbox = StringIO(msg_raw)
@@ -165,7 +165,7 @@
                 previous_message = item.log_message
             else:
                 same_as_previous = None
-            view = getView(item, 'html', self.request)
+            view = zapi.getMultiAdapter((item, self.request), name='html')
             output = view(same_as_previous=same_as_previous)
             html.append(output)
         return "".join(html)

Modified: Zope3/trunk/src/z3checkins/configure.zcml
===================================================================
--- Zope3/trunk/src/z3checkins/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/z3checkins/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -70,7 +70,7 @@
 
 <!-- Generic views for date/time formatting -->
 
-  <!-- XXX: there should be an interface that datetime.datetime implements -->
+  <!-- TODO: there should be an interface that datetime.datetime implements -->
 
   <view
     for="*"

Modified: Zope3/trunk/src/z3checkins/ftests/test_z3checkins.py
===================================================================
--- Zope3/trunk/src/z3checkins/ftests/test_z3checkins.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/z3checkins/ftests/test_z3checkins.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -7,7 +7,7 @@
 
 import unittest
 import os
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestCheckins(BrowserTestCase):

Modified: Zope3/trunk/src/z3checkins/message.py
===================================================================
--- Zope3/trunk/src/z3checkins/message.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/z3checkins/message.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
 """
 The z3checkins product.
 
@@ -3,13 +16,26 @@
 $Id$
 """
-
 import email
 import email.Utils
-from datetime import datetime
+import mailbox
+import time
+from datetime import datetime, tzinfo, timedelta
+from persistent import Persistent
+from StringIO import StringIO
 
-from persistent import Persistent
-from zope.app.container.contained import Contained
+from zope.exceptions import DuplicationError
 from zope.interface import implements
+from zope.proxy import removeAllProxies
 
+from zope.app import zapi
+from zope.app.container.contained import Contained
+from zope.app.container.interfaces import IReadContainer
+from zope.app.datetimeutils import parseDatetimetz, DateTimeError
+from zope.app.dublincore.interfaces import IZopeDublinCore
+from zope.app.form import CustomWidgetFactory
+from zope.app.form.browser import FileWidget
+from zope.app.pagetemplate import ViewPageTemplateFile
+from zope.app.publisher.browser import BrowserView
+
 from z3checkins.interfaces import IMessage, ICheckinMessage, IMessageContained
 from z3checkins.interfaces import IBookmark, IMessageParser, FormatError
@@ -217,4 +243,3 @@
         pos2 += 4
     return min(pos1, pos2)
 
-

Modified: Zope3/trunk/src/z3checkins/tests/test_browser.py
===================================================================
--- Zope3/trunk/src/z3checkins/tests/test_browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/z3checkins/tests/test_browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -12,8 +12,8 @@
 from zope.publisher.browser import TestRequest
 from zope.interface import Interface, implements
 from zope.exceptions import DuplicationError
-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 z3checkins.interfaces import ICheckinMessage, IBookmark, IMessageParser
 from z3checkins.tests.test_message import MessageStub, open_test_data

Modified: Zope3/trunk/src/zodbcode/interfaces.py
===================================================================
--- Zope3/trunk/src/zodbcode/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zodbcode/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,6 +11,10 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Persistent Module Interfaces
+
+$Id$
+"""
 from zope.interface import Interface, Attribute
 
 class IPersistentModuleImportRegistry(Interface):

Modified: Zope3/trunk/src/zope/app/adapter/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/adapter/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/adapter/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,22 +1 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Local-adapter support
-
-$Id$
-"""
-
-from zope.app.adapter.adapter import IAdapterRegistration
-from zope.app.adapter.adapter import LocalAdapterRegistry
-from zope.app.adapter.adapter import LocalAdapterBasedService
-
+# Make package


Property changes on: Zope3/trunk/src/zope/app/adapter/__init__.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/adapter/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/adapter/adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/adapter/adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,4 @@
-##############################################################################
-#
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -9,344 +7,18 @@
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-#
 ##############################################################################
-"""Adapter Service
+"""Local adapter service implementation.
 
-$Id$
+$Id: adapter.py 27880 2004-10-10 09:27:16Z srichter $
 """
-__docformat__ = 'restructuredtext' 
-
-from persistent.dict import PersistentDict
 from persistent import Persistent
-from zope.app import zapi
-from zope.app.registration.registration import NotifyingRegistrationStack
-from zope.interface.adapter import adapterImplied, Default
-from zope.interface.adapter import Surrogate, AdapterRegistry
-from zope.security.proxy import removeSecurityProxy
-import sys
-import zope.app.component.localservice
-import zope.app.container.contained
-import zope.app.registration.interfaces
-import zope.app.site.interfaces
-import zope.app.registration
-import zope.component.interfaces
-import zope.component.adapter
-import zope.interface
-import zope.schema
-from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.deprecation import deprecated
 
-class LocalSurrogate(Surrogate):
-    """Local surrogates
+# Hopefully noone was using this yet.
+class LocalAdapterService(Persistent):
+    pass
 
-    Local surrogates are transient, rather than persistent.
-
-    Their adapter data are stored in their registry objects.
-    """
-
-    def __init__(self, spec, registry):
-        Surrogate.__init__(self, spec, registry)
-        self.registry = registry
-        registry.baseFor(spec).subscribe(self)
-
-    def clean(self):
-        spec = self.spec()
-        base = self.registry.baseFor(spec)
-        ladapters = self.registry.adapters.get(spec)
-        if ladapters:
-            adapters = base.adapters.copy()
-            adapters.update(ladapters)
-        else:
-            adapters = base.adapters
-        self.adapters = adapters
-        Surrogate.clean(self)
-
-class LocalAdapterRegistry(AdapterRegistry, Persistent):
-    """Local/persistent surrogate registry
-    """
-
-    zope.interface.implements(
-        zope.app.registration.interfaces.IRegistry,
-        )
-    
-    _surrogateClass = LocalSurrogate
-
-    # Next local registry, may be None
-    next = None
-
-    subs = ()
-
-    def __init__(self, base, next=None):
-
-        # Base registry. This is always a global registry
-        self.base = base
-
-        self.adapters = {}
-        self.stacks = PersistentDict()
-        AdapterRegistry.__init__(self)
-        self.setNext(next)
-
-    def setNext(self, next, base=None):
-        if base is not None:
-            self.base = base
-        if self.next is not None:
-            self.next.removeSub(self)
-        if next is not None:
-            next.addSub(self)
-        self.next = next
-        self.adaptersChanged()
-
-    def addSub(self, sub):
-        self.subs += (sub, )
-
-    def removeSub(self, sub):
-        self.subs = tuple([s for s in self.subs if s is not sub])
-
-    def __getstate__(self):
-        state = Persistent.__getstate__(self).copy()
-        
-        for name in ('_default', '_null', 'adapter_hook',
-                     'lookup', 'lookup1', 'queryAdapter', 'get',
-                     'subscriptions', 'queryMultiAdapter', 'subscribers'
-                     ):
-            del state[name]
-        return state
-
-    def __setstate__(self, state):
-        Persistent.__setstate__(self, state)
-        AdapterRegistry.__init__(self)
-    
-    def baseFor(self, spec):
-        return self.base.get(spec)
-
-    def queryRegistrationsFor(self, registration, default=None):
-        stacks = self.stacks.get(registration.required)
-        if stacks:
-            stack = stacks.get((False, registration.with, registration.name,
-                                registration.provided))
-            if stack is not None:
-                return stack
-
-        return default
-
-    _stackType = NotifyingRegistrationStack
-
-    def createRegistrationsFor(self, registration):
-        stacks = self.stacks.get(registration.required)
-        if stacks is None:
-            stacks = PersistentDict()
-            self.stacks[registration.required] = stacks
-
-        key = (False, registration.with, registration.name,
-               registration.provided)
-        stack = stacks.get(key)
-        if stack is None:
-            stack = self._stackType(self)
-            stacks[key] = stack
-
-        return stack
-
-
-    def _updateAdaptersFromLocalData(self, adapters):
-        for required, stacks in self.stacks.iteritems():
-            if required is None:
-                required = Default
-            radapters = adapters.get(required)
-            if not radapters:
-                radapters = {}
-                adapters[required] = radapters
-
-            for key, stack in stacks.iteritems():
-                registration = stack.active()
-                if registration is not None:
-
-                    # Needs more thought:
-                    # We have to remove the proxy because we're
-                    # 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
-                    
-                    radapters[key] = removeSecurityProxy(registration.factory)
-
-    def adaptersChanged(self, *args):
-
-        adapters = {}
-        if self.next is not None:
-            for required, radapters in self.next.adapters.iteritems():
-                adapters[required] = radapters.copy()
-        
-        self._updateAdaptersFromLocalData(adapters)
-
-        if adapters != self.adapters:
-            self.adapters = adapters
-
-            # Throw away all of our surrogates, rather than dirtrying
-            # them individually
-            AdapterRegistry.__init__(self)
-
-            for sub in self.subs:
-                sub.adaptersChanged()
-
-    notifyActivated = notifyDeactivated = adaptersChanged
-
-    def baseChanged(self):
-        """Someone changed the base service
-
-        This should only happen during testing
-        """
-        AdapterRegistry.__init__(self)
-        for sub in self.subs:
-            sub.baseChanged()
-                
-
-    def registrations(self):
-        for stacks in self.stacks.itervalues():
-            for stack in stacks.itervalues():
-                for info in stack.info():
-                    yield info['registration']
-
-class LocalAdapterBasedService(
-    zope.app.container.contained.Contained,
-    Persistent,
-    ):
-    """A service that uses local surrogate registries
-
-    A local surrogate-based service needs to maintain connections
-    between it's surrogate registries and those of containing ans
-    sub-services.
-
-    The service must implement a `setNext` method that will be called
-    with the next local service, which may be ``None``, and the global
-    service. This method will be called when a service is bound.
-    
-    """
-
-    zope.interface.implements(
-        zope.app.site.interfaces.IBindingAware,
-        )
-
-    def __updateNext(self, servicename):
-        next = zope.app.component.localservice.getNextService(
-            self, servicename)
-        global_ = zapi.getGlobalServices().getService(servicename)
-        if next == global_:
-            next = None
-        self.setNext(next, global_)
-        
-    def bound(self, servicename):
-        self.__updateNext(servicename)
-        
-        # Now, we need to notify any sub-site services. This is
-        # a bit complicated because our immediate subsites might not have
-        # the same service. Sigh
-        sm = zapi.getServices(self)
-        self.__notifySubs(sm.subSites, servicename)
-
-    def unbound(self, servicename):
-        sm = zapi.getServices(self)
-        self.__notifySubs(sm.subSites, servicename)
-
-    def __notifySubs(self, subs, servicename):
-        for sub in subs:
-            s = sub.queryLocalService(servicename)
-            if s is not None:
-                s.__updateNext(servicename)
-            else:
-                self.__notifySubs(sub.subSites, servicename)
-
-
-class LocalAdapterService(LocalAdapterRegistry,
-                          LocalAdapterBasedService,
-                          zope.component.adapter.AdapterService):
-
-    zope.interface.implements(
-        zope.component.interfaces.IAdapterService,
-        )
-
-    serviceType = zapi.servicenames.Adapters
-
-    def __init__(self, base=None):
-        if base is None:
-            base = zapi.getGlobalService(self.serviceType)
-        LocalAdapterRegistry.__init__(self, base)
-
-    def registrations(self, localOnly=False):
-        for registration in LocalAdapterRegistry.registrations(self):
-            yield registration
-
-        if localOnly:
-            return
-
-        next = self.next
-        if next is None:
-            next = self.base
-
-        for registration in next.registrations():
-            yield registration
-
-class IAdapterRegistration(
-    zope.app.registration.interfaces.IRegistration):
-
-    required = zope.schema.Choice(
-        title = _(u"For interface"),
-        description = _(u"The interface of the objects being adapted"),
-        vocabulary="Interfaces",
-        readonly = True)
-
-    provided = zope.schema.Choice(
-        title = _(u"Provided interface"),
-        description = _(u"The interface provided"),
-        vocabulary="Interfaces",
-        readonly = True,
-        required = True)
-
-    name = zope.schema.TextLine(
-        title=_(u"Name"),
-        readonly=True,
-        required=False,
-        )
-
-    factoryName = zope.schema.BytesLine(
-        title=_(u"The dotted name of a factory for creating the adapter"),
-        readonly = True,
-        required = True,
-        )
-
-    permission = zope.schema.Choice(
-        title=_(u"The permission required for use"),
-        vocabulary="Permission Ids",
-        readonly=False,
-        required=False,
-        )
-        
-    factory = zope.interface.Attribute(
-        _("Factory to be called to construct the component")
-        )
-
-class AdapterRegistration(
-    zope.app.registration.registration.SimpleRegistration):
-
-    zope.interface.implements(IAdapterRegistration)
-
-    serviceType = zapi.servicenames.Adapters
-
-    with = () # Don't support multi-adapters yet
-
-    # TODO: These should be positional arguments, except that required
-    #       isn't passed in if it is omitted. To fix this, we need a
-    #       required=False,explicitly_unrequired=True in the schema field
-    #       so None will get passed in.
-    def __init__(self, provided, factoryName,
-                 name='', required=None, permission=None):
-        self.required = required
-        self.provided = provided
-        self.name = name
-        self.factoryName = factoryName
-        self.permission = permission
-
-    def factory(self):
-        folder = self.__parent__.__parent__
-        factory = folder.resolve(self.factoryName)
-        return factory
-    factory = property(factory)
-
+deprecated('LocalAdapterService',
+           'Services have been removed. Use site manager API. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/adapter/adapter.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.12
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/adapter/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/adapter/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/adapter/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,27 +0,0 @@
-<configure
-    xmlns='http://namespaces.zope.org/zope'
-    xmlns:event='http://namespaces.zope.org/event'
-    i18n_domain='zope'
-    >
-
-<!-- Adapter Service -->
-
-<localService class=".adapter.LocalAdapterService">
-  <factory />
-  <require
-      permission="zope.ManageServices"
-      interface="zope.app.registration.interfaces.IRegistry"
-      />
-</localService>
-
-<content class=".adapter.AdapterRegistration">
-  <require
-      permission="zope.ManageServices"
-      interface=".adapter.IAdapterRegistration"
-      set_schema=".adapter.IAdapterRegistration"
-      />
-</content>
-
-<include package=".browser" />
-
-</configure>

Deleted: Zope3/trunk/src/zope/app/adapter/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/adapter/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/adapter/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,877 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Local Adapter and Service Tests
-
-$Id$
-"""
-import unittest
-import zope.interface
-from transaction import get_transaction
-from ZODB.tests.util import DB
-
-from zope.testing.doctestunit import DocTestSuite
-from zope.interface.adapter import AdapterRegistry
-from zope.component.adapter import GlobalAdapterService
-
-from zope.app import zapi
-from zope.app.adapter.adapter import LocalAdapterRegistry, LocalAdapterService
-from zope.app.registration.interfaces import RegisteredStatus
-
-class IF0(zope.interface.Interface):
-    pass
-
-class IF1(IF0):
-    pass
-
-class IF2(IF1):
-    pass
-
-class IB0(zope.interface.Interface):
-    pass
-
-class IB1(IB0):
-    pass
-
-class IR0(zope.interface.Interface):
-    pass
-
-class IR1(IR0):
-    pass
-
-class R1(object):
-    zope.interface.implements(IR1)
-
-class F0(object):
-    zope.interface.implements(IF0)
-
-class F2(object):
-    zope.interface.implements(IF2)
-
-class Registration(object):
-    name=u''
-    with=()
-    provided=zope.interface.Interface
-    required=None
-    
-    def __init__(self, **kw):
-        self.__dict__.update(kw)
-
-    def __repr__(self):
-        return "Registration(%r, %s, %r, %r, %r)" % (
-            getattr(self.required, '__name__', None),
-            tuple([i.__name__ for i in self.with]),
-            self.provided.__name__, self.name, self.factory
-            )
-    
-
-    def factories(self):
-        return self.factory,
-    factories = property(factories)
-
-# Create a picklable global registry. The pickleability of other
-# global adapter registries is beyond the scope of these tests:
-class GlobalAdapterRegistry(AdapterRegistry):
-    def __reduce__(self):
-        return 'globalAdapterRegistry'
-
-globalAdapterRegistry = GlobalAdapterRegistry()
-
-class TestStack(object):
-    registration = None
-    registrations = ()
-
-    def __init__(self, parent):
-        self.__parent__ = parent
-
-    def active(self):
-        return self.registration
-
-    def info(self):
-        for registration in self.registrations:
-            yield {'registration': registration}
-
-    def activate(self, registration):
-        self.registration = registration
-        if registration not in self.registrations:
-            self.registrations += (registration,)
-        self.__parent__.notifyActivated(self, registration)
-
-    def deactivate(self, registration):
-        self.registration = None
-        self.__parent__.notifyDeactivated(self, registration)
-
-
-class LocalAdapterRegistry(LocalAdapterRegistry):
-    """For testing, use custom stack type
-    """
-    _stackType = TestStack
-
-
-def test_local_adapter():
-    """Local Adapter Tests
-
-   Local surrogates and adapter registries share declarations with
-   those "above" them.
-
-   Suppose we have a global AdapterRegistry:
-
-   >>> G = AdapterRegistry()
-
-   we also have a local adapter registry, with G as it's base:
-
-   >>> L1 = LocalAdapterRegistry(G)
-
-   and so on:
-
-   >>> L2 = LocalAdapterRegistry(G, L1)
-
-   Now, if we declare an adapter globally:
-
-   >>> G.register([IF1], IB1, '', 'A11G')
-
-   we can query it locally:
-
-   >>> L1.lookup([IF2], IB1)
-   'A11G'
-   
-   >>> L2.lookup([IF2], IB1)
-   'A11G'
-
-   We can add local definitions:
-
-   >>> ra011 = Registration(required = IF0, provided=IB1, factory='A011')
-   >>> L1.createRegistrationsFor(ra011).activate(ra011)
-
-   and use it:
-
-   >>> L1.lookup([IF0], IB1)
-   'A011'
-   
-   >>> L2.lookup([IF0], IB1)
-   'A011'
-   
-   but not outside L1:
-
-   >>> G.lookup([IF0], IB1)
-
-   Note that it doesn't override the non-local adapter:
-
-   >>> L1.lookup([IF2], IB1)
-   'A11G'
-   
-   >>> L2.lookup([IF2], IB1)
-   'A11G'
-   
-   because it was more specific.
-
-   Let's override the adapter in L2:
-
-   >>> ra112 = Registration(required = IF1, provided=IB1, factory='A112')
-   >>> L2.createRegistrationsFor(ra112).activate(ra112)
-
-   Now, in L2, we get the new adapter, because it's as specific and more
-   local than the one from G:
-
-   >>> L2.lookup([IF2], IB1)
-   'A112'
-   
-   But we still get the old one in L1
-
-   >>> L1.lookup([IF2], IB1)
-   'A11G'
-   
-   Note that we can ask for less specific interfaces and still get the adapter:
-
-   >>> L2.lookup([IF2], IB0)
-   'A112'
-
-   >>> L1.lookup([IF2], IB0)
-   'A11G'
-
-   We get the more specific adapter even if there is a less-specific
-   adapter to B0:
-
-   >>> G.register([IF1], IB1, '', 'A10G')
-
-   >>> L2.lookup([IF2], IB0)
-   'A112'
-
-   But if we have an equally specific and equally local adapter to B0, it
-   will win:
-
-   >>> ra102 = Registration(required = IF1, provided=IB0, factory='A102')
-   >>> L2.createRegistrationsFor(ra102).activate(ra102)
-
-   >>> L2.lookup([IF2], IB0)
-   'A102'
-
-   We can deactivate registrations, which has the effect of deleting adapters:
-
-
-   >>> L2.queryRegistrationsFor(ra112).deactivate(ra112)
-
-   >>> L2.lookup([IF2], IB0)
-   'A102'
-
-   >>> L2.lookup([IF2], IB1)
-   'A10G'
-
-   >>> L2.queryRegistrationsFor(ra102).deactivate(ra102)
-
-   >>> L2.lookup([IF2], IB0)
-   'A10G'
-
-   We can ask for all of the registrations :
-
-   >>> registrations = list(L1.registrations())
-   >>> registrations
-   [Registration('IF0', (), 'IB1', u'', 'A011')]
-
-   This shows only the local registrations in L1.
-   """
-
-def test_named_adapters():
-    """
-    Suppose we have a global AdapterRegistry:
-
-    >>> G = AdapterRegistry()
-
-    we also have a local adapter registry, with G as it's base:
-
-    >>> L1 = LocalAdapterRegistry(G)
-
-    and so on:
-
-    >>> L2 = LocalAdapterRegistry(G, L1)
-
-    Now, if we declare an adapter globally:
-
-    >>> G.register([IF1], IB1, 'bob', 'A11G')
-
-    we can query it locally:
-
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    We can add local definitions:
-
-    >>> ra011 = Registration(required = IF0, provided=IB1, factory='A011',
-    ...                      name='bob')
-    >>> L1.createRegistrationsFor(ra011).activate(ra011)
-    
-    and use it:
-
-    >>> L1.lookup([IF0], IB1)
-    >>> L1.lookup([IF0], IB1, 'bob')
-    'A011'
-
-    >>> L2.lookup([IF0], IB1)
-    >>> L2.lookup([IF0], IB1, 'bob')
-    'A011'
-
-    but not outside L1:
-
-    >>> G.lookup([IF0], IB1, 'bob')
-
-    Note that it doesn't override the non-local adapter:
-
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    because it was more specific.
-
-    Let's override the adapter in L2:
-
-    >>> ra112 = Registration(required = IF1, provided=IB1, factory='A112',
-    ...                      name='bob')
-    >>> L2.createRegistrationsFor(ra112).activate(ra112)
-
-    Now, in L2, we get the new adapter, because it's as specific and more
-    local than the one from G:
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A112'
-
-    But we still get thye old one in L1
-
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    Note that we can ask for less specific interfaces and still get the adapter:
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A112'
-
-    >>> L1.lookup([IF2], IB0)
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-
-    We get the more specific adapter even if there is a less-specific
-    adapter to B0:
-
-    >>> G.register([IF1], IB1, 'bob', 'A10G')
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A112'
-
-    But if we have an equally specific and equally local adapter to B0, it
-    will win:
-
-    >>> ra102 = Registration(required = IF1, provided=IB0, factory='A102',
-    ...                      name='bob')
-    >>> L2.createRegistrationsFor(ra102).activate(ra102)
-    
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A102'
-
-    We can deactivate registrations, which has the effect of deleting adapters:
-
-
-    >>> L2.queryRegistrationsFor(ra112).deactivate(ra112)
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A102'
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A10G'
-
-    >>> L2.queryRegistrationsFor(ra102).deactivate(ra102)
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A10G'
-    """
-
-def test_multi_adapters():
-    """
-    Suppose we have a global AdapterRegistry:
-
-    >>> G = AdapterRegistry()
-
-    we also have a local adapter registry, with G as it's base:
-
-    >>> L1 = LocalAdapterRegistry(G)
-
-    and so on:
-
-    >>> L2 = LocalAdapterRegistry(G, L1)
-
-    Now, if we declare an adapter globally:
-
-    >>> G.register([IF1, IR0], IB1, 'bob', 'A11G')
-
-    we can query it locally:
-
-    >>> L1.lookup([IF2, IR1], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup([IF2, IR1], IB1, 'bob')
-    'A11G'
-
-    We can add local definitions:
-
-    >>> ra011 = Registration(required = IF0, provided=IB1, factory='A011',
-    ...                      name='bob', with=(IR0,))
-    >>> L1.createRegistrationsFor(ra011).activate(ra011)
-    
-    and use it:
-
-    >>> L1.lookup([IF0, IR1], IB1, 'bob')
-    'A011'
-
-    >>> L2.lookup([IF0, IR1], IB1, 'bob')
-    'A011'
-
-    but not outside L1:
-
-    >>> G.lookup((IF0, IR1), IB1, 'bob')
-
-    Note that it doesn't override the non-local adapter:
-
-    >>> L1.lookup([IF2, IR1], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup((IF2, IR1), IB1, 'bob')
-    'A11G'
-
-    because it was more specific.
-
-    Let's override the adapter in L2:
-
-    >>> ra112 = Registration(required = IF1, provided=IB1, factory='A112',
-    ...                      name='bob', with=(IR0,))
-    >>> L2.createRegistrationsFor(ra112).activate(ra112)
-
-    Now, in L2, we get the new adapter, because it's as specific and more
-    local than the one from G:
-
-    >>> L2.lookup((IF2, IR1), IB1, 'bob')
-    'A112'
-
-    But we still get the old one in L1
-
-    >>> L1.lookup((IF2, IR1), IB1, 'bob')
-    'A11G'
-
-    Note that we can ask for less specific interfaces and still get
-    the adapter:
-
-    >>> L2.lookup((IF2, IR1), IB0, 'bob')
-    'A112'
-
-    >>> L1.lookup((IF2, IR1), IB0, 'bob')
-    'A11G'
-
-    We get the more specific adapter even if there is a less-specific
-    adapter to B0:
-
-    >>> G.register([IF1, IR0], IB1, 'bob', 'A10G')
-
-    >>> L2.lookup((IF2, IR1), IB0, 'bob')
-    'A112'
-
-    But if we have an equally specific and equally local adapter to B0, it
-    will win:
-
-    >>> ra102 = Registration(required = IF1, provided=IB0, factory='A102',
-    ...                      name='bob', with=(IR0,))
-    >>> L2.createRegistrationsFor(ra102).activate(ra102)
-    
-    >>> L2.lookup((IF2, IR1), IB0, 'bob')
-    'A102'
-
-    We can deactivate registrations, which has the effect of deleting adapters:
-
-    >>> L2.queryRegistrationsFor(ra112).deactivate(ra112)
-
-    >>> L2.lookup((IF2, IR1), IB0, 'bob')
-    'A102'
-
-    >>> L2.lookup((IF2, IR1), IB1, 'bob')
-    'A10G'
-
-    >>> L2.queryRegistrationsFor(ra102).deactivate(ra102)
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup((IF2, IR1), IB0, 'bob')
-    'A10G'
-    """
-
-def test_persistence():
-    """
-    >>> db = DB()
-    >>> conn1 = db.open()
-
-    >>> G = globalAdapterRegistry
-    >>> L1 = LocalAdapterRegistry(G)
-    >>> L2 = LocalAdapterRegistry(G, L1)
-
-    >>> conn1.root()['L1'] = L1
-    >>> conn1.root()['L2'] = L2
-    
-    >>> G.register([IF1], IB1, 'bob', 'A11G')
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    We can add local definitions:
-
-    >>> ra011 = Registration(required = IF0, provided=IB1, factory='A011',
-    ...                      name='bob')
-    >>> L1.createRegistrationsFor(ra011).activate(ra011)
-
-    and use it:
-
-    >>> L1.lookup([IF0], IB1)
-    >>> L1.lookup([IF0], IB1, 'bob')
-    'A011'
-
-    >>> L2.lookup([IF0], IB1)
-    >>> L2.lookup([IF0], IB1, 'bob')
-    'A011'
-
-    but not outside L1:
-
-    >>> G.lookup([IF0], IB1)
-
-    Note that it doesn't override the non-local adapter:
-
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    because it was more specific.
-
-    Let's override the adapter in L2:
-
-    >>> ra112 = Registration(required = IF1, provided=IB1, factory='A112',
-    ...                      name='bob')
-    >>> L2.createRegistrationsFor(ra112).activate(ra112)
-
-    Now, in L2, we get the new adapter, because it's as specific and more
-    local than the one from G:
-
-    >>> L2.lookup([IF2], IB1)
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A112'
-
-    But we still get the old one in L1
-
-    >>> L1.lookup([IF2], IB1)
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    Note that we can ask for less specific interfaces and still get
-    the adapter:
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A112'
-
-    >>> L1.lookup([IF2], IB0)
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-
-    We get the more specific adapter even if there is a less-specific
-    adapter to B0:
-
-    >>> G.register([IF0], IB0, 'bob', 'A00G')
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A112'
-
-    But if we have an equally specific and equally local adapter to B0, it
-    will win:
-
-    >>> ra102 = Registration(required = IF1, provided=IB0, factory='A102',
-    ...                      name='bob')
-    >>> L2.createRegistrationsFor(ra102).activate(ra102)
-
-    >>> L2.lookup([IF2], IB0)
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A102'
-
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A102'
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A112'
-
-    >>> get_transaction().commit()
-
-    Now, let's open another transaction:
-
-    >>> conn2 = db.open()
-
-    >>> L1 = conn2.root()['L1']
-    >>> L2 = conn2.root()['L2']
-
-    We should get the same outputs:
-
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A102'
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A112'
-    
-    We can deactivate registrations, which has the effect of deleting adapters:
-
-    >>> L2.queryRegistrationsFor(ra112).deactivate(ra112)
-    >>> L2.queryRegistrationsFor(ra102).deactivate(ra102)
-
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    >>> get_transaction().commit()
-
-    If we look back at the first connection, we should get the same data:
-
-    >>> conn1.sync()
-    >>> L1 = conn1.root()['L1']
-    >>> L2 = conn1.root()['L2']
-
-    We should see the result of the deactivations:
-    
-    >>> L1.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L1.lookup([IF2], IB1, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB0, 'bob')
-    'A11G'
-    >>> L2.lookup([IF2], IB1, 'bob')
-    'A11G'
-
-    Cleanup:
-    >>> G.__init__()
-    >>> db.close()
-    """
-
-
-def test_local_default():
-    """
-    >>> G = AdapterRegistry()
-    >>> L1 = LocalAdapterRegistry(G)
-    >>> r = Registration(required = None, provided=IB1, factory='Adapter')
-    >>> L1.createRegistrationsFor(r).activate(r)
-    >>> L1.lookup([IF2], IB1)
-    'Adapter'
-    """
-
-
-def test_changing_next():
-    """
-    >>> G = AdapterRegistry()
-    >>> L1 = LocalAdapterRegistry(G)
-    >>> L2 = LocalAdapterRegistry(G, L1)
-    >>> f2 = F2()
-
-    >>> L2.lookup([IF2], IB1)
-
-    >>> G.register([IF1], IB1, '', 'A11G')
-    >>> L2.lookup([IF2], IB1)
-    'A11G'
-
-
-    >>> ra111 = Registration(required = IF1, provided=IB1, factory='A111')
-    >>> L1.createRegistrationsFor(ra111).activate(ra111)
-    >>> L2.lookup([IF2], IB1)
-    'A111'
-
-    >>> L1.next
-    >>> L2.next == L1
-    True
-    >>> L1.subs == (L2,)
-    True
-    >>> L3 = LocalAdapterRegistry(G, L1)
-    >>> L2.setNext(L3)
-    >>> L2.next == L3
-    True
-    >>> L3.next == L1
-    True
-    >>> L1.subs == (L3,)
-    True
-    >>> L3.subs == (L2,)
-    True
-
-    >>> ra113 = Registration(required = IF1, provided=IB1, factory='A113')
-    >>> L3.createRegistrationsFor(ra113).activate(ra113)
-
-    >>> L2.lookup([IF2], IB1)
-    'A113'
-    >>> L2.setNext(L1)
-    >>> L2.next == L1
-    True
-    >>> L3.next == L1
-    True
-    >>> L1.subs == (L3, L2)
-    True
-    >>> L3.subs == ()
-    True
-    >>> L2.lookup([IF2], IB1)
-    'A111'
-
-    """
-
-def test_LocalAdapterBasedService():
-    """
-    Setup folders and service managers:
-    
-    >>> from zope.app.tests import setup
-    >>> setup.placefulSetUp()
-    >>> root = setup.buildSampleFolderTree()
-    >>> sm = setup.createServiceManager(root)
-    >>> sm1 = setup.createServiceManager(root['folder1'])
-    >>> sm1_1 = setup.createServiceManager(root['folder1']['folder1_1'])
-    >>> sm1_1_1 = setup.createServiceManager(
-    ...                         root['folder1']['folder1_1']['folder1_1_1'])
-
-    Define the service
-
-    >>> gsm = zapi.getGlobalServices()
-    >>> gsm.defineService('F', IF1)
-
-    Create the global service
-
-    >>> g = F2()
-    >>> gsm.provideService('F', g)
-
-    Create a local service class, which must define setNext:
-
-    >>> import zope.app.site.interfaces
-    >>> from zope.app.adapter.adapter import LocalAdapterBasedService
-    >>> class LocalF(LocalAdapterBasedService):
-    ...     zope.interface.implements(
-    ...         IF2,
-    ...         zope.app.site.interfaces.ISimpleService,
-    ...         )
-    ...     def setNext(self, next, global_):
-    ...         self.next, self.global_ = next, global_
-
-    If we add a local service, It gets it's next and global_ attrs set:
-
-    >>> f1 = LocalF()
-    >>> hasattr(f1, 'next') or hasattr(f1, 'global_')
-    False
-    >>> setup.addService(sm1, 'F', f1) is f1
-    True
-    >>> (f1.next, f1.global_) == (None, g)
-    True
-
-    If we add another service below, it's next will point to the one
-    above:
-    
-    >>> f1_1_1 = LocalF()
-    >>> setup.addService(sm1_1_1, 'F', f1_1_1) is f1_1_1
-    True
-    >>> (f1_1_1.next, f1_1_1.global_) == (f1, g)
-    True
-
-    We can insert a service in an intermediate site:
-    
-    >>> f1_1 = LocalF()
-    >>> setup.addService(sm1_1, 'F', f1_1) is f1_1
-    True
-    >>> (f1_1.next, f1_1.global_) == (f1, g)
-    True
-    >>> (f1_1_1.next, f1_1_1.global_) == (f1_1, g)
-    True
-
-    Deactivating services adjust the relevant next pointers
-
-    >>> default = zapi.traverse(sm1_1, 'default')
-    >>> rm = default.getRegistrationManager()
-    >>> rm.values()[0].status = RegisteredStatus
-    >>> (f1_1_1.next, f1_1_1.global_) == (f1, g)
-    True
-
-    >>> default = zapi.traverse(sm1, 'default')
-    >>> rm = default.getRegistrationManager()
-    >>> rm.values()[0].status = RegisteredStatus
-    >>> (f1_1_1.next, f1_1_1.global_) == (None, g)
-    True
-    
-    >>> setup.placefulTearDown()
-    """
-
-def test_service_registrations():
-    """
-    Local Adapter Service Registration Tests
-
-
-    Local adapter services share declarations and registrations with those
-    "above" them.
-
-    Suppose we have a global adapter service, which is a type of
-    adapter registry that is an zope.component.interfaces.IRegistry:
-
-    >>> G = GlobalAdapterService()
-
-    we also have a local adapter registry, with G as it's base:
-    
-    >>> L1 = LocalAdapterService(G)
-    
-    and another local, with G as it's base:
-
-    >>> L2 = LocalAdapterService(G)
-    
-    and L1 as it's next service:
-    
-    >>> L2.setNext(L1)
-    
-    Now will register some adapters:
-    
-    >>> G.register([IF1], IB1, '', 'A11G')
-    >>> ra011 = Registration(required = IF0, provided=IB1, factory='A011')
-    >>> L1.createRegistrationsFor(ra011).register(ra011)
-    >>> ra112 = Registration(required = IF1, provided=IB1, factory='A112')
-    >>> L2.createRegistrationsFor(ra112).register(ra112)
-    >>> ra102 = Registration(required = IF1, provided=IB0, factory='A102')
-    >>> L2.createRegistrationsFor(ra102).register(ra102)
-    
-    We can ask for all of the registrations locally:
-    
-    >>> registrations = map(repr, L1.registrations())
-    >>> registrations.sort()
-    >>> for registration in registrations:
-    ...     print registration
-    AdapterRegistration(('IF1',), 'IB1', '', 'A11G', '')
-    Registration('IF0', (), 'IB1', u'', 'A011')
-    
-    This shows the local registrations in L1 and the global registrations.
-    
-    If we ask L2, we'll see the registrations from G, L1, and L2:
-    
-    >>> registrations = map(repr, L2.registrations())
-    >>> registrations.sort()
-    >>> for registration in registrations:
-    ...     print registration
-    AdapterRegistration(('IF1',), 'IB1', '', 'A11G', '')
-    Registration('IF0', (), 'IB1', u'', 'A011')
-    Registration('IF1', (), 'IB0', u'', 'A102')
-    Registration('IF1', (), 'IB1', u'', 'A112')
-    
-    Now we just want the local registrations for L1:
-    
-    >>> registrations = map(repr, L1.registrations(localOnly=True))
-    >>> registrations.sort()
-    >>> for registration in registrations:
-    ...     print registration
-    Registration('IF0', (), 'IB1', u'', 'A011')
-
-    """
-    
-def test_suite():
-    return unittest.TestSuite((
-        DocTestSuite(),
-        ))
-
-if __name__ == '__main__': unittest.main()

Modified: Zope3/trunk/src/zope/app/apidoc/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class APIDocTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -26,6 +26,7 @@
 from types import ClassType, TypeType, FunctionType
 
 import zope
+import zope.deprecation
 from zope.security.checker import getCheckerForInstancesOf
 from zope.interface import Interface, Attribute, implements, implementedBy
 
@@ -240,6 +241,7 @@
                     self.__children[file] = ZCMLFile(self, file, path)
 
         # Setup classes in module, if any are available.
+        zope.deprecation.__show__.off()
         for name in self.__module.__dict__.keys():
             attr = getattr(self.__module, name)
             # We do not want to register duplicates or non-"classes"
@@ -252,6 +254,7 @@
 
                 elif type(attr) is FunctionType and not name.startswith('_'):
                     self.__children[attr.__name__] = Function(self, name, attr)
+        zope.deprecation.__show__.on()
 
 
     def getDocString(self):

Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +16,6 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
-import inspect
-import os
 import re
 from types import TypeType, ClassType, FunctionType, ModuleType
 import xml.dom.minidom
@@ -27,7 +25,6 @@
 from zope.configuration.config import ConfigurationContext
 from zope.configuration.fields import GlobalObject, Tokens
 from zope.app.traversing.interfaces import TraversalError
-from zope.interface import implementedBy
 from zope.interface.interface import InterfaceClass
 from zope.proxy import removeAllProxies
 from zope.schema import getFieldsInOrder
@@ -85,6 +82,7 @@
           
           >>> menu.request = TestRequest(form={'path': 'Foo'})
           >>> info = menu.findClasses()
+
           >>> pprint(info)
           [[('path', 'zope.app.apidoc.classmodule.browser.Foo'),
             ('url',
@@ -99,7 +97,7 @@
           [[('path', 'zope.app.apidoc.classmodule.browser.Foo2'),
             ('url',
              'http://127.0.0.1/zope/app/apidoc/classmodule/browser/Foo2')]]
-
+          
           >>> menu.request = TestRequest(form={'path': 'Blah'})
           >>> info = menu.findClasses()
           >>> pprint(info)
@@ -117,7 +115,7 @@
                 klass = zapi.traverse(classModule, p.replace('.', '/'))
                 results.append(
                     {'path': p,
-                     'url': zapi.getView(klass, 'absolute_url', self.request)()
+                     'url': zapi.absoluteURL(klass, self.request)
                      })
         results.sort(lambda x, y: cmp(x['path'], y['path']))
         return results
@@ -168,7 +166,7 @@
           'http://127.0.0.1'
         """
         m = zapi.getUtility(IDocumentationModule, "Class")
-        return zapi.getView(zapi.getParent(m), 'absolute_url', self.request)()
+        return zapi.absoluteURL(zapi.getParent(m), self.request)
 
     def getHTMLContents(self):
         """Return an HTML markup version of the ZCML file with links to other
@@ -477,7 +475,7 @@
             path = getPythonPath(unwrapped_cls)
             try:
                 klass = zapi.traverse(classModule, path.replace('.', '/'))
-                url = zapi.getView(klass, 'absolute_url', self.request)()
+                url = zapi.absoluteURL(klass, self.request)
             except TraversalError:
                 # If one of the classes is implemented in C, we will not
                 # be able to find it.
@@ -501,7 +499,7 @@
           'http://127.0.0.1'
         """
         m = zapi.getUtility(IDocumentationModule, "Class")
-        return zapi.getView(zapi.getParent(m), 'absolute_url', self.request)()
+        return zapi.absoluteURL(zapi.getParent(m), self.request)
 
 
     def getInterfaces(self):
@@ -684,7 +682,7 @@
             ('url', 'http://127.0.0.1/zope/app/apidoc/classmodule/cleanUp')]]
         """
         entries = [{'name': name,
-                    'url': zapi.getView(obj, 'absolute_url', self.request)(),
+                    'url': zapi.absoluteURL(obj, self.request),
                     'ismodule': zapi.isinstance(obj, Module),
                     'isclass': zapi.isinstance(obj, Class),
                     'isfunction': zapi.isinstance(obj, Function),
@@ -723,13 +721,14 @@
         while removeSecurityProxy(module).__class__ is Module:
             crumbs.append(
                 {'name': zapi.name(module),
-                 'url': zapi.getView(module, 'absolute_url', self.request)()}
+                 'url': zapi.absoluteURL(module, self.request)}
                 )
             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/trunk/src/zope/app/apidoc/classmodule/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class ClassModuleTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/classmodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/classmodule/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/classmodule/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/apidoc/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/apidoc/ifacemodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -14,7 +14,7 @@
 """Interface Documentation Module
 
 The interface documentation module retrieves its information from the
-interface service. Therefore, currently there are no unregsitered interfaces
+site manager. Therefore, currently there are no unregsitered interfaces
 listed in the documentation. This might be good, since unregistered interfaces
 are usually private and not of interest to a general developer.
 
@@ -43,7 +43,7 @@
 
     This documentation is implemented using a simple `IReadContainer`. The
     items of the container are all the interfaces listed in the closest
-    interface service and above.
+    site manager and above.
 
     Demonstration::
 
@@ -58,8 +58,7 @@
       >>> module.get(id).getName()
       'IDocumentationModule'
 
-      Here we find an interface that is not in the interface service, but
-      exists.
+      Here we find an interface that is not in the site manager, but exists.
 
       >>> module.get('zope.app.content.interfaces.IContentType').getName()
       'IContentType'
@@ -76,14 +75,14 @@
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
     description = _("""
-    All used and important interfaces are registered through the interface
-    service. While it would be possible to just list all attributes, it is
+    All used and important interfaces are registered through the site
+    manager. While it would be possible to just list all attributes, it is
     hard on the user to read such an overfull list. Therefore, interfaces that
     have partial common module paths are bound together.
 
     The documentation of an interface also provides a wide variety of
     information, including of course the declared attributes/fields and
-    methods, but also available adapters, services and utilities that provide
+    methods, but also available adapters, and utilities that provide
     this interface.
     """)
 

Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 __docformat__ = 'restructuredtext'
 
 from types import FunctionType, MethodType, ClassType, TypeType
-from zope.component import ComponentLookupError
+from zope.component.site import AdapterRegistration
 from zope.interface.declarations import providedBy
 from zope.interface.interfaces import IMethod, IInterface 
 from zope.proxy import removeAllProxies
@@ -28,7 +28,6 @@
 from zope.security.proxy import removeSecurityProxy
 
 from zope.app import zapi
-from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.apidoc.utilities import getPythonPath, renderText
 from zope.app.apidoc.classmodule import classRegistry
 
@@ -432,13 +431,8 @@
 
           >>> adapters = details.getRequiredAdapters()
           >>> adapters.sort()
-          >>> pprint(adapters[:2])
-          [[('factory', 'None.append'),
-            ('factory_url', 'None/append'),
-            ('name', None),
-            ('provided', None),
-            ('required', [])],
-           [('factory',
+          >>> pprint(adapters)
+          [[('factory',
              'zope.app.location.traversing.LocationPhysicallyLocatable'),
             ('factory_url',
              'zope/app/location/traversing/LocationPhysicallyLocatable'),
@@ -447,12 +441,15 @@
              '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 adapters
+            if not isinstance(reg, AdapterRegistration):
+                continue
             # 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 +492,15 @@
             ('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
+            if not isinstance(reg, AdapterRegistration):
+                continue
             # 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/trunk/src/zope/app/apidoc/ifacemodule/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class InterfaceModuleTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/index.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/index.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/index.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/apidoc/ifacemodule/menu.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -2,8 +2,7 @@
 <body>
 
   <p metal:fill-slot="post_menu" class="small" i18n:translate="">
-    Note: These are only interfaces that are registered with the Interface
-    Service. 
+    Note: These are only interfaces that are registered with the site manager. 
   </p>
 
 </body>

Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Interface Module Browser Menu (Tree)
 
-A list of interfaces from the Interface Service is pretty much unmanagable and
+A list of interfaces from the global site manager is pretty much unmanagable and
 is very confusing. Therefore it is nice to split the path of the interface, so
 that we get a deeper tree with nodes having shorter, manageable names.
 

Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,7 +25,6 @@
 from zope.schema import TextLine, Text
 from zope.testing.doctestunit import DocTestSuite
 
-from zope.app import zapi
 from zope.app.component.interface import provideInterface
 from zope.app.location import LocationProxy
 from zope.app.location.traversing import LocationPhysicallyLocatable
@@ -35,7 +34,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
@@ -43,7 +42,6 @@
 
 from zope.app.apidoc.classmodule import classRegistry
 from zope.app.apidoc.ifacemodule import IInterfaceModule, InterfaceModule
-from zope.app.apidoc.ifacemodule.menu import IModule
 from zope.app.apidoc.ifacemodule.browser import InterfaceDetails
 from zope.app.apidoc.interfaces import IDocumentationModule
 
@@ -117,9 +115,6 @@
     ztapi.provideUtility(IFactory, Factory(Foo, title='Foo Factory'),
                          'FooFactory')
     ztapi.provideUtility(IFoo, Foo(), 'The Foo')
-    sm = zapi.getGlobalServices()
-    sm.defineService('Foo', IFoo)
-    sm.provideService('Foo', Foo())
 
     
 def test_suite():

Modified: Zope3/trunk/src/zope/app/apidoc/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/apidoc/utilities.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilities.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/utilities.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/apidoc/utilitymodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,13 +17,13 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.component.site import UtilityRegistration
 from zope.interface import implements
 
 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 +83,20 @@
 
     def get(self, key, default=None):
         """See zope.app.container.interfaces.IReadContainer"""
-        service = zapi.getService(Utilities)
+        sm = zapi.getGlobalSiteManager()
         if key == NONAME:
             key = ''
         utils = [Utility(self, reg)
-                 for reg in service.registrations()
-                 if reg.name == key and reg.provided == self.interface]
-
+                 for reg in sm.registrations()
+                 if zapi.isinstance(reg, UtilityRegistration) and \
+                     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
@@ -107,7 +107,7 @@
 
     This documentation is implemented using a simple `IReadContainer`. The
     items of the container are all factories listed in the closest
-    factory service and above.
+    site manager and above.
 
     Demonstration::
 
@@ -130,14 +130,14 @@
 
     # See zope.app.apidoc.interfaces.IDocumentationModule
     description = _("""
-    Utilities are also nicely registered in a service, so that it is easy to
-    create a listing of available utilities. A utility is identified by the
+    Utilities are also nicely registered in a site manager, so that it is easy
+    to create a listing of available utilities. A utility is identified by the
     providing interface and a name, which can be empty. The menu provides you
     with a list of interfaces that utilities provide and as sub-items the
     names of the various implementations.
 
     Again, the documentation of a utility lists all the attributes/fields and
-    methods the utility provides and provides a link to the implementation. 
+    methods the utility provides and provides a link to the implementation.
     """)
 
     def get(self, key, default=None):
@@ -150,13 +150,14 @@
             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():
-                path = getPythonPath(reg.provided)
-                ifaces[path] = UtilityInterface(self, path, reg.provided)
-            service = queryNextService(service, Utilities)
+        while sm is not None:
+            for reg in sm.registrations():
+                if isinstance(reg, UtilityRegistration):
+                    path = getPythonPath(reg.provided)
+                    ifaces[path] = UtilityInterface(self, path, reg.provided)
+            sm = queryNextSiteManager(sm)
 
         items = ifaces.items()
         items.sort(lambda x, y: cmp(x[0].split('.')[-1], y[0].split('.')[-1]))

Modified: Zope3/trunk/src/zope/app/apidoc/utilitymodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,6 @@
 """
 __docformat__ = 'restructuredtext'
 
-from types import InstanceType
 from zope.app import zapi
 from zope.app.location import LocationProxy
 from zope.app.apidoc.ifacemodule.browser import InterfaceDetails

Modified: Zope3/trunk/src/zope/app/apidoc/utilitymodule/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class UtilityModuleTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/utilitymodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilitymodule/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/utilitymodule/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,12 +17,11 @@
 """
 import unittest
 
-from zope.interface import implements
 from zope.publisher.browser import TestRequest
 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 +39,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/trunk/src/zope/app/apidoc/viewmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -96,11 +96,11 @@
           >>> skins
           [u'skinA', u'skinB', u'skinC']
         """ 
-        # Only the global presentation service defines skins
-        utils = zapi.getService(zapi.servicenames.Utilities)
+        # Only the global site manager defines skins
+        sm = zapi.getGlobalSiteManager()
         skins = [SkinDocumentation(reg)
-                 for reg in utils.registrations()
-                 if reg.name != '' and reg.provided is ISkin]
+                 for reg in sm.registrations()
+                 if reg.provided is ISkin and reg.name != '']
         skins.sort(lambda x, y: cmp(x.name, y.name))
         # Make sure skins have a location
         [locate(skin, self, skin.name) for skin in skins]
@@ -118,8 +118,8 @@
 
       >>> from zope.app.apidoc.tests import pprint
 
-      >>> utils = zapi.getGlobalService(zapi.servicenames.Utilities)
-      >>> reg = utils._registrations[(ISkin, 'skinA')]
+      >>> sm = zapi.getGlobalSiteManager()
+      >>> reg = sm._registrations[(ISkin, 'skinA')]
       >>> doc = SkinDocumentation(reg)
       >>> doc.name
       u'skinA'
@@ -130,7 +130,7 @@
       >>> doc.interface
       'zope.app.apidoc.viewmodule.tests.SkinA'
 
-      >>> reg = utils._registrations[(ISkin, 'skinC')]
+      >>> reg = sm._registrations[(ISkin, 'skinC')]
       >>> doc = SkinDocumentation(reg)
       >>> doc.name
       u'skinC'
@@ -155,8 +155,8 @@
 
     def isDefault(self):
         """Return whether this skin is the default skin."""
-        adapters = zapi.getService(zapi.servicenames.Adapters)
-        skin = adapters.lookup((self.context.component,), IDefaultSkin, '')
+        sm = zapi.getSiteManager()
+        skin = sm.adapters.lookup((self.context.component,), IDefaultSkin, '')
         if skin is self.context.component:
             return True
         return False
@@ -169,10 +169,10 @@
 
         Each element of the list is a LayerDocumentation component.
         """
-        utils = zapi.getService(zapi.servicenames.Utilities)
+        sm = zapi.getSiteManager()
         layers = [LayerDocumentation(reg)
-                  for reg in utils.registrations()
-                  if reg.name != '' and reg.provided is ILayer and \
+                  for reg in sm.registrations()
+                  if reg.provided is ILayer and reg.name != '' and \
                      self.context.component.isOrExtends(reg.component)]
         
         # Make sure skins have a location
@@ -220,8 +220,8 @@
       ...                   {'file': u'Zope3/src/zope/app/configure.zcml',
       ...                    'line': 5})
 
-      >>> utils = zapi.getGlobalService(zapi.servicenames.Utilities)
-      >>> reg = utils._registrations[(ILayer, 'layer1')]
+      >>> sm = zapi.getGlobalSiteManager()
+      >>> reg = sm._registrations[(ILayer, 'layer1')]
 
       >>> layerdoc = LayerDocumentation(reg)
       >>> layerdoc.name

Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -67,7 +67,7 @@
 
     def getInterfaceIds(self):
         """Get a list of the ids of all interfaces registered with the
-        interface service.
+        site manager.
 
         Example::
 
@@ -243,14 +243,14 @@
 
         self.show_all = request.has_key('all')
 
-        service = zapi.getService(zapi.servicenames.Adapters)
-        # This is okay here, since we only read from the service. Once
+        sm = zapi.getSiteManager()
+        # This is okay here, since we only read from the site manager. Once
         # registration objects have sensible security declarations, we can
         # remove that call. 
         from zope.proxy import removeAllProxies
-        service = removeAllProxies(service)
+        sm = removeAllProxies(sm)
         self.regs = [reg
-                     for reg in service.registrations()
+                     for reg in sm.registrations()
                      if (isinstance(reg, AdapterRegistration) and
                          reg.required[-1] is not None and
                          # TODO: Handle multiple required ifaces at some point.

Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class ViewModuleTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,13 +17,12 @@
 """
 import unittest
 
-from zope.interface import Interface, directlyProvides
+from zope.interface import Interface
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.interfaces.browser import ISkin, ILayer, IDefaultSkin
 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/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,6 @@
 """
 __docformat__ = 'restructuredtext'
 
-import os
-
 from zope.configuration import docutils, xmlconfig
 from zope.interface import implements
 
@@ -158,7 +156,7 @@
 
     This documentation is implemented using a simple `IReadContainer`. The
     items of the container are all the interfaces listed in the closest
-    interface service and above.
+    site manager and above.
 
     Demonstration::
 

Modified: Zope3/trunk/src/zope/app/apidoc/zcmlmodule/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class ZCMLModuleTests(BrowserTestCase):
     """Just a couple of tests ensuring that the templates render."""

Modified: Zope3/trunk/src/zope/app/apidoc/zcmlmodule/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_translationdomaincontrol.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class ZODBControlTest(BrowserTestCase):
 

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_zodbcontrol.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_zodbcontrol.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/ftests/test_zodbcontrol.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 import unittest
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class ZODBControlTest(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_runtimeinfoview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,7 @@
 from zope.app.applicationcontrol.applicationcontrol import applicationController
 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 +46,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/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py
===================================================================
--- Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -14,35 +14,27 @@
 """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
+    """Check that there's a basic object in the site
     manager. If not, add one.
 
     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
+    """Add a utility to the top site manager
 
     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,60 +62,19 @@
     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."""
+    """Add and configure a utility to the root folder."""
     utility_name = addUtility(root_folder, utility_type, utility_factory, **kw)
     configureUtility(root_folder, interface, utility_type, name, utility_name)
     return name
 
 def addUtility(root_folder, utility_type, utility_factory, **kw):
-    """ Add a Utility to the root folder's Utility Service.
+    """ Add a Utility to the root folder's site manager.
 
     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 +88,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 +115,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 +123,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 +135,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/trunk/src/zope/app/appsetup/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/appsetup/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/authentication/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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.IPrincipalCreated], None, add_info)
 
 Now, if we authenticate a principal, its title will be set:
@@ -319,7 +319,7 @@
 the ID '123'. Therefore it will 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 IAuthentication
 
   >>> class FakeAuthUtility:

Modified: Zope3/trunk/src/zope/app/authentication/authentication.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/authentication.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/authentication.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 from zope.event import notify
 import zope.interface
 import zope.schema
@@ -26,9 +25,9 @@
 from zope.security.interfaces import IGroupAwarePrincipal, IGroup
 from zope.app.security.interfaces import IAuthentication
 from zope.app.security.interfaces import IAuthenticatedGroup, IEveryoneGroup
-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.authentication.interfaces import IExtractionPlugin

Modified: Zope3/trunk/src/zope/app/authentication/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 import unittest
 
 def test_suite():
-    from zope.app.tests import functional
+    from zope.app.testing import functional
     return unittest.TestSuite((
         functional.FunctionalDocFileSuite('principalfolder.txt'),
         functional.FunctionalDocFileSuite('groupfolder.txt'),
@@ -29,4 +29,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -24,14 +24,18 @@
   ... 
   ... 
   ... -----------------------------8474411127918531132143183931
-  ... Content-Disposition: form-data; name="field.interface"
+  ... Content-Disposition: form-data; name="field.provided"
   ... 
   ... zope.app.security.interfaces.IAuthentication
   ... -----------------------------8474411127918531132143183931
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
   ... 
   ... 1
   ... -----------------------------8474411127918531132143183931
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... -----------------------------8474411127918531132143183931
   ... Content-Disposition: form-data; name="field.permission"
   ... 
   ... 
@@ -52,17 +56,16 @@
 Next, we'll add the group folder:
 
   >>> print http(r"""
-  ... POST /++etc++site/@@contents.html HTTP/1.1
+  ... POST /++etc++site/SiteManagement/index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: application/x-www-form-urlencoded
-  ... Referer: http://localhost:8081/++etc++site/@@contents.html
   ... 
-  ... container_add_button=Add&single_new_value=tools&single_type_name=BrowserAdd__zope.app.site.folder.SiteManagementFolder""")
-  HTTP/1.1 303 See Other
+  ... activeTool=IPrincipalSearchPlugin""")
+  HTTP/1.1 200 Ok
   ...
 
   >>> print http(r"""
-  ... POST /++etc++site/AddIPrincipalSearchPluginTool/AddGroupFolder.html%3D HTTP/1.1
+  ... POST /++etc++site/SiteManagement/AddGroupFolder.html= HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------1160081710811409419323271465
   ... Referer: http://localhost:8081/++etc++site/AddIPrincipalSearchPluginTool/AddGroupFolder.html=

Modified: Zope3/trunk/src/zope/app/authentication/browser/groupfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/groupfolder.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/groupfolder.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,23 +15,20 @@
 
 First, we'll create a principal folder:
 
-  (The first request is a bit weird.  It is part of the current
-   tools UI.  It arranges for a tools site-management folder to be
-   created.  We really need to rethink how we manage TTW utilities.)
-
   >>> print http(r"""
-  ... GET /++etc++site/AddISearchableAuthenticationPluginTool HTTP/1.1
+  ... POST /++etc++site/SiteManagement/index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/@@manageISearchableAuthenticationPluginTool.html
-  ... """)
+  ... Content-Type: application/x-www-form-urlencoded
+  ... 
+  ... activeTool=ISearchableAuthenticationPlugin""")
   HTTP/1.1 200 Ok
   ...
 
   >>> print http(r"""
-  ... POST /++etc++site/AddISearchableAuthenticationPluginTool/AddPrincipalFolder.html%3D HTTP/1.1
+  ... POST /++etc++site/SiteManagement/AddPrincipalFolder.html=users HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------190685539214643056941988788830
-  ... Referer: http://localhost:8081/++etc++site/AddISearchableAuthenticationPluginTool/AddPrincipalFolder.html=
+  ... Referer: http://localhost:8081/++etc++site/SiteManagement/AddPrincipalFolder.html=
   ... 
   ... -----------------------------190685539214643056941988788830
   ... Content-Disposition: form-data; name="field.prefix"
@@ -49,8 +46,6 @@
   ... """)
   HTTP/1.1 303 See Other
   ...
-  Location: ../@@manageISearchableAuthenticationPluginTool.html
-  ...
 
 Next we'l add some users:
 
@@ -309,8 +304,17 @@
 Next, we'll add out groups folder:
 
   >>> print http(r"""
-  ... POST /++etc++site/AddIPrincipalSearchPluginTool/AddGroupFolder.html%3D HTTP/1.1
+  ... POST /++etc++site/SiteManagement/index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
+  ... Content-Type: application/x-www-form-urlencoded
+  ... 
+  ... activeTool=IPrincipalSearchPlugin""")
+  HTTP/1.1 200 Ok
+  ...
+
+  >>> print http(r"""
+  ... POST /++etc++site/SiteManagement/AddGroupFolder.html= HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------18984415031531709165482618952
   ... 
   ... -----------------------------18984415031531709165482618952
@@ -329,8 +333,6 @@
   ... """)
   HTTP/1.1 303 See Other
   ...
-  Location: ../@@manageIPrincipalSearchPluginTool.html
-  ...
 
 Now, before we can define any groups, we have to add and register a
 pluggable authentication utility:
@@ -356,11 +358,11 @@
   ... 
   ... 
   ... -----------------------------1649392783947785437368129046
-  ... Content-Disposition: form-data; name="field.interface"
+  ... Content-Disposition: form-data; name="field.provided"
   ... 
   ... zope.app.security.interfaces.IAuthentication
   ... -----------------------------1649392783947785437368129046
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
   ... 
   ... 1
   ... -----------------------------1649392783947785437368129046
@@ -368,6 +370,10 @@
   ... 
   ... 
   ... -----------------------------1649392783947785437368129046
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... -----------------------------1649392783947785437368129046
   ... Content-Disposition: form-data; name="field.permission-empty-marker"
   ... 
   ... 1

Modified: Zope3/trunk/src/zope/app/authentication/browser/principalfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/principalfolder.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/principalfolder.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,20 +18,17 @@
 To allow Bob to log in, we'll start by adding a principal folder:
 
 
-(The following request is a bit weird.  It is part of the current
- tools UI.  It arranges for a tools site-management folder to be
- created.  We really need to rethink how we manage TTW utilities.)
-
   >>> print http(r"""
-  ... GET /++etc++site/AddISearchableAuthenticationPluginTool HTTP/1.1
+  ... POST /++etc++site/SiteManagement/index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/@@manageISearchableAuthenticationPluginTool.html
-  ... """)
+  ... Content-Type: application/x-www-form-urlencoded
+  ... 
+  ... activeTool=ISearchableAuthenticationPlugin""")
   HTTP/1.1 200 Ok
   ...
 
   >>> print http(r"""
-  ... POST /++etc++site/AddISearchableAuthenticationPluginTool/AddPrincipalFolder.html%3D HTTP/1.1
+  ... POST /++etc++site/SiteManagement/AddPrincipalFolder.html= HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
   ... Content-Length: 434
   ... Content-Type: multipart/form-data; boundary=---------------------------190685539214643056941988788830
@@ -53,8 +50,6 @@
   ... """)
   HTTP/1.1 303 See Other
   ...
-  Location: ../@@manageISearchableAuthenticationPluginTool.html
-  ...
 
 We specify a prefix, `users.`.  This is used to make sure that ids
 used by this plugin don't conflict with ids of other plugins.  We also
@@ -138,14 +133,18 @@
   ... 
   ... 
   ... -----------------------------1649392783947785437368129046
-  ... Content-Disposition: form-data; name="field.interface"
+  ... Content-Disposition: form-data; name="field.provided"
   ... 
   ... zope.app.security.interfaces.IAuthentication
   ... -----------------------------1649392783947785437368129046
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
   ... 
   ... 1
   ... -----------------------------1649392783947785437368129046
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... -----------------------------1649392783947785437368129046
   ... Content-Disposition: form-data; name="field.permission"
   ... 
   ... 

Modified: Zope3/trunk/src/zope/app/authentication/browser/schemasearch.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/schemasearch.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/schemasearch.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -3,11 +3,11 @@
 
 Placefull setup for making the search plugin IPhysicallyLocatable:
 
-  >>> from zope.app.tests import ztapi
+  >>> from zope.app.testing import ztapi
   >>> from zope.schema.interfaces import ITextLine
   >>> from zope.app.form.browser import TextWidget
   >>> from zope.app.form.interfaces import IInputWidget
-  >>> from zope.app.tests.setup import placefulSetUp, placefulTearDown
+  >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown
   >>> site = placefulSetUp(True)
   >>> ztapi.browserView(ITextLine, '', TextWidget, providing=IInputWidget)
 

Modified: Zope3/trunk/src/zope/app/authentication/browser/special-groups.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/special-groups.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/special-groups.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,19 +21,19 @@
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------51955270618919134971413296540
   ... 
-  ... -----------------------------51955270618919134971413296540
-  ... Content-Disposition: form-data; name="field.prefix"
-  ... 
-  ... users.
-  ... -----------------------------51955270618919134971413296540
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------51955270618919134971413296540
-  ... Content-Disposition: form-data; name="add_input_name"
-  ... 
-  ... 
-  ... -----------------------------51955270618919134971413296540--
+  ... -----------------------------51955270618919134971413296540
+  ... Content-Disposition: form-data; name="field.prefix"
+  ... 
+  ... users.
+  ... -----------------------------51955270618919134971413296540
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------51955270618919134971413296540
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... 
+  ... -----------------------------51955270618919134971413296540--
   ... """)
   HTTP/1.1 303 See Other
   ...
@@ -45,31 +45,35 @@
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------1211945862063657304996683149
   ... 
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="field.name"
-  ... 
-  ... users
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="field.interface"
-  ... 
-  ... zope.app.authentication.interfaces.ISearchableAuthenticationPlugin
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="field.permission"
-  ... 
-  ... 
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------1211945862063657304996683149
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------1211945862063657304996683149--
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.name"
+  ... 
+  ... users
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.provided"
+  ... 
+  ... zope.app.authentication.interfaces.ISearchableAuthenticationPlugin
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
+  ... 
+  ... 1
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.permission"
+  ... 
+  ... 
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="field.permission-empty-marker"
+  ... 
+  ... 1
+  ... -----------------------------1211945862063657304996683149
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------1211945862063657304996683149--
   ... """)
   HTTP/1.1 303 See Other
   ...
@@ -81,31 +85,31 @@
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------10033016405103631412002637985
   ... 
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="field.login"
-  ... 
-  ... bob
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="field.password"
-  ... 
-  ... 123
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="field.title"
-  ... 
-  ... Bob
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="field.description"
-  ... 
-  ... 
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------10033016405103631412002637985
-  ... Content-Disposition: form-data; name="add_input_name"
-  ... 
-  ... 
-  ... -----------------------------10033016405103631412002637985--
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="field.login"
+  ... 
+  ... bob
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="field.password"
+  ... 
+  ... 123
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="field.title"
+  ... 
+  ... Bob
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="field.description"
+  ... 
+  ... 
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------10033016405103631412002637985
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... 
+  ... -----------------------------10033016405103631412002637985--
   ... """)
   HTTP/1.1 303 See Other
   ...
@@ -129,31 +133,35 @@
   ... Content-Type: multipart/form-data; boundary=---------------------------2567744622114531019698320091
   ... Referer: http://localhost:8081/++etc++site/default/LocalPluggableAuthentication/addRegistration.html
   ... 
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="field.name"
-  ... 
-  ... 
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="field.interface"
-  ... 
-  ... zope.app.security.interfaces.IAuthentication
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="field.permission"
-  ... 
-  ... 
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------2567744622114531019698320091
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------2567744622114531019698320091--
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.name"
+  ... 
+  ... 
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.provided"
+  ... 
+  ... zope.app.security.interfaces.IAuthentication
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
+  ... 
+  ... 1
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.permission"
+  ... 
+  ... 
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="field.permission-empty-marker"
+  ... 
+  ... 1
+  ... -----------------------------2567744622114531019698320091
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------2567744622114531019698320091--
   ... """)
   HTTP/1.1 303 See Other
   ...
@@ -165,79 +173,79 @@
   ... Authorization: Basic mgr:mgrpw
   ... Content-Type: multipart/form-data; boundary=---------------------------12424310211503201098946683515
   ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.extractors.to"
-  ... 
-  ... HTTP Basic
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.extractors-empty-marker"
-  ... 
-  ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.authenticators.to"
-  ... 
-  ... users
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.authenticators-empty-marker"
-  ... 
-  ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.challengers.to"
-  ... 
-  ... No Challenge if Authenticated
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.challengers.to"
-  ... 
-  ... Zope Realm HTTP Basic
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.challengers-empty-marker"
-  ... 
-  ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.factories.to"
-  ... 
-  ... Default
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.factories-empty-marker"
-  ... 
-  ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.searchers.to"
-  ... 
-  ... users
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.searchers-empty-marker"
-  ... 
-  ... 
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Change
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.extractors"
-  ... 
-  ... HTTP Basic
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.authenticators"
-  ... 
-  ... users
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.challengers"
-  ... 
-  ... No Challenge if Authenticated
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.challengers"
-  ... 
-  ... Zope Realm HTTP Basic
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.factories"
-  ... 
-  ... Default
-  ... -----------------------------12424310211503201098946683515
-  ... Content-Disposition: form-data; name="field.searchers"
-  ... 
-  ... users
-  ... -----------------------------12424310211503201098946683515--
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.extractors.to"
+  ... 
+  ... HTTP Basic
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.extractors-empty-marker"
+  ... 
+  ... 
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.authenticators.to"
+  ... 
+  ... users
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.authenticators-empty-marker"
+  ... 
+  ... 
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.challengers.to"
+  ... 
+  ... No Challenge if Authenticated
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.challengers.to"
+  ... 
+  ... Zope Realm HTTP Basic
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.challengers-empty-marker"
+  ... 
+  ... 
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.factories.to"
+  ... 
+  ... Default
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.factories-empty-marker"
+  ... 
+  ... 
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.searchers.to"
+  ... 
+  ... users
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.searchers-empty-marker"
+  ... 
+  ... 
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Change
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.extractors"
+  ... 
+  ... HTTP Basic
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.authenticators"
+  ... 
+  ... users
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.challengers"
+  ... 
+  ... No Challenge if Authenticated
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.challengers"
+  ... 
+  ... Zope Realm HTTP Basic
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.factories"
+  ... 
+  ... Default
+  ... -----------------------------12424310211503201098946683515
+  ... Content-Disposition: form-data; name="field.searchers"
+  ... 
+  ... users
+  ... -----------------------------12424310211503201098946683515--
   ... """)
   HTTP/1.1 200 Ok
   ...
@@ -420,4 +428,3 @@
   ... """)
   HTTP/1.1 200 Ok
   ...
-

Modified: Zope3/trunk/src/zope/app/authentication/browser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browser/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 __docformat__ = "reStructuredText"
 import unittest
 from zope.testing import doctest
-from zope.app.tests.setup import placefulSetUp, placefulTearDown
+from zope.app.testing.setup import placefulSetUp, placefulTearDown
 
 
 def schemaSearchSetUp(self):

Modified: Zope3/trunk/src/zope/app/authentication/browserplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browserplugins.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/browserplugins.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -168,7 +168,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/trunk/src/zope/app/authentication/groupfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/groupfolder.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/groupfolder.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -65,7 +65,7 @@
 created.  In order for `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.authentication.groupfolder.IGroupFolder,
   ...                      groups)
 

Modified: Zope3/trunk/src/zope/app/authentication/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/authentication/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -91,4 +91,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/trunk/src/zope/app/basicskin/standardmacros.py
===================================================================
--- Zope3/trunk/src/zope/app/basicskin/standardmacros.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/basicskin/standardmacros.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/basicskin/tests/test_standardmacros.py
===================================================================
--- Zope3/trunk/src/zope/app/basicskin/tests/test_standardmacros.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/basicskin/tests/test_standardmacros.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/browser.zcml
===================================================================
--- Zope3/trunk/src/zope/app/browser.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/browser.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -10,10 +10,8 @@
   <include package="zope.app.security.browser" />
 
   <include package="zope.app.container.browser" />
-  <include package="zope.app.registration.browser" />
   <include package="zope.app.form.browser" />
-  <include package="zope.app.utility.browser" />
 
-  <include package="zope.app.site.browser" />
+  <include package="zope.app.component.browser" />
 
 </configure>

Modified: Zope3/trunk/src/zope/app/cache/browser/cacheable.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/browser/cacheable.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/browser/cacheable.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -45,7 +45,8 @@
     def current_cache_url(self):
         "Returns the current cache provider's URL."
         cache = getCacheForObject(self.context)
-        absolute_url = zapi.getView(cache, 'absolute_url', self.request)
+        absolute_url = zapi.getMultiView((cache, self.request),
+                                         name='absolute_url')
         try:
             return absolute_url()
         except TypeError:

Modified: Zope3/trunk/src/zope/app/cache/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/cache/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,7 +25,7 @@
 
   <vocabulary
       name="Cache Names"
-      factory="zope.app.utility.vocabulary.UtilityVocabulary"
+      factory="zope.app.component.vocabulary.UtilityVocabulary"
       interface="zope.app.cache.interfaces.ICache"
       nameOnly="True" />
 

Modified: Zope3/trunk/src/zope/app/cache/interfaces/ram.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/interfaces/ram.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/interfaces/ram.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/cache/ram.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/ram.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/ram.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,7 +23,6 @@
 from persistent import Persistent
 
 from zope.interface import implements
-from zope.app import zapi
 from zope.app.container.contained import Contained
 from zope.app.cache.interfaces.ram import IRAMCache
 

Modified: Zope3/trunk/src/zope/app/cache/tests/test_annotationcacheable.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/tests/test_annotationcacheable.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/tests/test_annotationcacheable.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/cache/tests/test_caching.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/tests/test_caching.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/tests/test_caching.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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, 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/trunk/src/zope/app/cache/tests/test_ramcache.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/catalog/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/catalog/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/catalog/browser/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/catalog/browser/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/browser/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,11 +17,11 @@
 objects.  Before creating a catalog, you must create a intid tool:
 
   >>> print http(r"""
-  ... POST /++etc++site/default/AddUtility/action.html HTTP/1.1
+  ... POST /++etc++site/default/@@+/action.html HTTP/1.1
   ... Authorization: Basic bWdyOm1ncnB3
   ... Content-Length: 78
   ... Content-Type: application/x-www-form-urlencoded
-  ... Referer: http://localhost:8081/++etc++site/default/AddUtility
+  ... Referer: http://localhost:8081/++etc++site/default/@@+
   ... 
   ... type_name=BrowserAdd__zope.app.intid.IntIds&id=&add=+Add+""")
   HTTP/1.1 303 ...
@@ -30,38 +30,48 @@
 
   >>> print http(r"""
   ... POST /++etc++site/default/IntIds/addRegistration.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 864
-  ... Content-Type: multipart/form-data; boundary=---------------------------68417209514430962931254091825
-  ... Referer: http://localhost:8081/++etc++site/default/IntIds/addRegistration.html
+  ... Authorization: Basic mgr:mgrpw
+  ... Referer: http://localhost:8081/++etc++site/default/IntIds/
+  ... Content-Type: multipart/form-data; boundary=----------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... 
-  ... -----------------------------68417209514430962931254091825
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... Content-Disposition: form-data; name="field.name"
   ... 
   ... 
-  ... -----------------------------68417209514430962931254091825
-  ... Content-Disposition: form-data; name="field.interface"
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.provided"
   ... 
   ... zope.app.intid.interfaces.IIntIds
-  ... -----------------------------68417209514430962931254091825
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
   ... 
   ... 1
-  ... -----------------------------68417209514430962931254091825
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.status-empty-marker"
+  ... 
+  ... 1
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... Content-Disposition: form-data; name="field.permission"
   ... 
-  ... zope.Public
-  ... -----------------------------68417209514430962931254091825
+  ... 
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... Content-Disposition: form-data; name="field.permission-empty-marker"
   ... 
   ... 1
-  ... -----------------------------68417209514430962931254091825
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
   ... 
   ... Add
-  ... -----------------------------68417209514430962931254091825--
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ--
   ... """)
-  HTTP/1.1 303 ...
+  HTTP/1.1 303 See Other
+  ...
+  Location: @@SelectedManagementView.html
+  ...
 
 
 Moving short-id management outside of catalogs make it possible to
@@ -83,50 +93,56 @@
 Once we have a unique-id tool, you can add a catalog:
 
   >>> print http(r"""
-  ... POST /++etc++site/default/AddUtility/action.html HTTP/1.1
+  ... POST /++etc++site/default/@@+/action.html HTTP/1.1
   ... Authorization: Basic bWdyOm1ncnB3
   ... Content-Length: 77
   ... Content-Type: application/x-www-form-urlencoded
-  ... Referer: http://localhost:8081/++etc++site/default/AddUtility
+  ... Referer: http://localhost:8081/++etc++site/default/@@+
   ... 
   ... type_name=BrowserAdd__zope.app.catalog.catalog.Catalog&id=&add=+Add+""")
   HTTP/1.1 303 ...
 
 and register it:
 
-
   >>> print http(r"""
   ... POST /++etc++site/default/Catalog/addRegistration.html HTTP/1.1
   ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 855
-  ... Content-Type: multipart/form-data; boundary=---------------------------17974048709381505781405189947
-  ... Referer: http://localhost:8081/++etc++site/default/Catalog/addRegistration.html
+  ... Referer: http://localhost:8081/++etc++site/default/Catalog/
+  ... Content-Type: multipart/form-data; boundary=----------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
   ... 
-  ... -----------------------------17974048709381505781405189947
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
   ... Content-Disposition: form-data; name="field.name"
   ... 
   ... 
-  ... -----------------------------17974048709381505781405189947
-  ... Content-Disposition: form-data; name="field.interface"
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
+  ... Content-Disposition: form-data; name="field.provided"
   ... 
   ... zope.app.catalog.interfaces.ICatalog
-  ... -----------------------------17974048709381505781405189947
-  ... Content-Disposition: form-data; name="field.interface-empty-marker"
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
   ... 
   ... 1
-  ... -----------------------------17974048709381505781405189947
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
+  ... Content-Disposition: form-data; name="field.status-empty-marker"
+  ... 
+  ... 1
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
   ... Content-Disposition: form-data; name="field.permission"
   ... 
   ... zope.Public
-  ... -----------------------------17974048709381505781405189947
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
   ... Content-Disposition: form-data; name="field.permission-empty-marker"
   ... 
   ... 1
-  ... -----------------------------17974048709381505781405189947
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa
   ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
   ... 
   ... Add
-  ... -----------------------------17974048709381505781405189947--
+  ... ------------61t9UJyoacebBevQVdNrlvXP6T9Ik3Xo4RyXkwJJWvuhao65RTuAPRa--
   ... """)
   HTTP/1.1 303 ...
 

Modified: Zope3/trunk/src/zope/app/catalog/browser/catalog.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/browser/catalog.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/browser/catalog.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-from zope.app.container.browser.adding import Adding
 from zope.app.catalog.interfaces import ICatalog
 
 class Advanced:

Modified: Zope3/trunk/src/zope/app/catalog/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,9 +15,9 @@
 
 $Id: ftests.py 27323 2004-08-28 19:31:22Z jim $
 """
+from zope.app.testing.functional import FunctionalDocFileSuite
 
 def test_suite():
-    from zope.app.tests.functional import FunctionalDocFileSuite
     return FunctionalDocFileSuite('README.txt')
 
 if __name__ == '__main__':

Modified: Zope3/trunk/src/zope/app/catalog/catalog.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/catalog.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/catalog.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,10 +15,7 @@
 
 $Id$
 """
-from persistent import Persistent
 from zope.interface import implements
-from zope.app.zapi import getUtility
-from zope.security.proxy import removeSecurityProxy
 from zope.app.container.btree import BTreeContainer
 import zope.index.interfaces
 

Modified: Zope3/trunk/src/zope/app/catalog/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/catalog/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/catalog/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
 

Copied: Zope3/trunk/src/zope/app/component/README.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/README.txt)

Modified: Zope3/trunk/src/zope/app/component/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/component/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,2 +1,74 @@
+##############################################################################
 #
-# This file is necessary to make this directory a package.
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Local Component Architecture
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import zope.component
+from zope.app import zapi
+
+# BBB: Will go away in 3.3.
+from zope.app.component.bbb import localservice
+import sys
+sys.modules['zope.app.component.localservice'] = localservice
+
+_marker = object()
+
+def getNextSiteManager(context):
+    """Get the next site manager."""
+    sm = queryNextSiteManager(context, _marker)
+    if sm is _marker:
+        raise zope.component.interfaces.ComponentLookupError, \
+              "No more site managers have been found."
+    return sm
+
+
+def queryNextSiteManager(context, default=None):
+    """Get the next site manager.
+
+    If the site manager of the given context is the global site manager, then
+    `default` is returned.
+    """
+    sm = zapi.getSiteManager(context)
+    if zope.component.site.IGlobalSiteManager.providedBy(sm):
+        return default
+    if sm.next is None:
+        return zapi.getGlobalSiteManager()
+    return sm.next
+
+
+def getNextUtility(context, interface, name=''):
+    """Get the next available utility.
+
+    If no utility was found, a `ComponentLookupError` is raised.
+    """
+    util = queryNextUtility(context, interface, name, _marker)
+    if util is _marker:
+        raise zope.component.interfaces.ComponentLookupError, \
+              "No more utilities for %s, '%s' have been found." %(interface,
+                                                                  name)
+    return util
+
+
+def queryNextUtility(context, interface, name='', default=None):
+    """Query for the next available utility.
+
+    Find the next available utility providing `interface` and having the
+    specified name. If no utility was found, return the specified `default`
+    value."""    
+    sm = queryNextSiteManager(context)
+    if sm is None:
+        return default
+    return sm.queryUtility(interface, name, default)

Copied: Zope3/trunk/src/zope/app/component/adapter.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/adapter.py)


Property changes on: Zope3/trunk/src/zope/app/component/adapter.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.12
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/app/component/adapterregistry.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/adapterregistry.txt)

Copied: Zope3/trunk/src/zope/app/component/bbb (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/bbb)

Copied: Zope3/trunk/src/zope/app/component/browser (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/browser)

Modified: Zope3/trunk/src/zope/app/component/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/component/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,45 +1,168 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
-  <serviceType
-      id="Utilities"
-      interface="zope.component.interfaces.IUtilityService" />
+  <interface interface="zope.interface.Interface" />
 
-  <service
-      serviceType="Utilities"
-      permission="zope.Public"
-      factory="zope.component.utility.GlobalUtilityService" />
 
-  <serviceType
-      id="Adapters"
-      interface="zope.component.interfaces.IAdapterService" />
+  <!-- Registration Framework -->
 
-  <service
-      serviceType="Adapters"
-      permission="zope.Public"
-      factory="zope.component.adapter.GlobalAdapterService" />
+  <content class=".registration.RegistrationManager">
+    <factory
+        id="zope.app.component.RegistrationManager"
+        title="Registration Manager" />
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.app.container.interfaces.IWriteContainer
+                   zope.app.container.interfaces.IReadContainer
+                   zope.app.container.interfaces.INameChooser" 
+        attributes="addRegistration"
+        />
+  </content>
 
-  <vocabulary
-      name="Interfaces"
-      factory="zope.app.utility.vocabulary.UtilityVocabulary"
-      interface="zope.interface.interfaces.IInterface" />
+  <!-- ++registrations++ namespace registrations -->
+  <view
+      name="registrations" type="*"
+      for=".interfaces.registration.IRegisterableContainer"
+      provides="zope.app.traversing.interfaces.ITraversable"
+      factory=".registration.RegistrationManagerNamespace"
+      />
+  <adapter
+      name="registrations"
+      for=".interfaces.registration.IRegisterableContainer"
+      provides="zope.app.traversing.interfaces.ITraversable"
+      factory=".registration.RegistrationManagerNamespace"
+      />
 
-  <interface interface="zope.interface.Interface" />
+  <class class=".registration.Registered">
+    <allow attributes="registrations" />
+  </class>
 
   <adapter
-      factory=".localservice.serviceServiceAdapter"
-      provides="zope.component.IServiceService"
-      for="zope.interface.Interface" />
+      for=".interfaces.registration.IRegisterable"
+      provides=".interfaces.registration.IRegistered"
+      factory=".registration.Registered"
+      trusted="true"
+      />
 
   <subscriber
-      handler=".localservice.threadSiteSubscriber"
+      for=".interfaces.registration.IComponentRegistration
+           zope.app.container.interfaces.IObjectRemovedEvent"
+      handler=".registration.ComponentRegistrationRemoveSubscriber"
+      />
+
+  <subscriber
+      for=".interfaces.registration.IComponentRegistration
+           zope.app.container.interfaces.IObjectAddedEvent"
+      handler=".registration.ComponentRegistrationAddSubscriber"
+      />
+
+  <subscriber
+      for=".interfaces.registration.IComponentRegistration
+           .interfaces.registration.IRegistrationEvent"
+      handler=".registration.componentRegistrationEventNotify"
+      />
+
+  <subscriber
+      for=".interfaces.registration.IRegisterable
+           zope.app.container.interfaces.IObjectMovedEvent"
+      handler=".registration.RegisterableMoveSubscriber"
+      />
+
+
+  <!-- Site and Site Manager Framework -->
+
+  <module module=".interfaces">
+    <allow attributes="ISite" />
+  </module>
+
+  <content class=".site.LocalSiteManager">
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.app.container.interfaces.IReadContainer" />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.component.interfaces.ISiteManager
+                   zope.app.container.interfaces.IWriteContainer" />
+  </content>
+
+  <!-- XXX: We allow these attributes to be changed. We need some subscriber
+       that updated the registries once attributes change. -->
+  <content class=".site.AdapterRegistration">
+    <require
+        permission="zope.ManageSite"
+        interface=".interfaces.IAdapterRegistration"
+        set_schema=".interfaces.IAdapterRegistration"
+        />
+  </content>
+
+  <content class=".site.UtilityRegistration">    
+    <require
+        permission="zope.ManageSite"
+        interface=".interfaces.IUtilityRegistration"
+        set_schema=".interfaces.IUtilityRegistration" 
+        />
+  </content>
+
+  <content class=".site.SiteManagementFolder">
+    <factory />
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.app.container.interfaces.IReadContainer" />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.app.container.interfaces.IWriteContainer"
+        attributes="registrationManager" 
+        />
+  </content>
+  
+  <adapter 
+      for="zope.component.interfaces.ISiteManager"
+      provides="zope.app.filerepresentation.interfaces.IDirectoryFactory"
+      factory=".site.SMFolderFactory"
+      permission="zope.ManageContent"
+      />
+
+  <adapter
+      for="zope.interface.Interface" 
+      provides="zope.component.interfaces.ISiteManager"
+      factory=".site.SiteManagerAdapter"
+      />
+
+  <subscriber
       for="zope.app.publication.interfaces.IBeforeTraverseEvent"
+      handler=".site.threadSiteSubscriber"
       />
 
   <subscriber
-      handler=".localservice.clearThreadSiteSubscriber"
       for="zope.app.publication.interfaces.IEndRequestEvent"
+      handler=".site.clearThreadSiteSubscriber"
       />
 
+  <subscriber
+      for=".interfaces.ISite
+           zope.app.container.interfaces.IObjectMovedEvent"
+      handler=".site.changeSiteConfigurationAfterMove"
+      />
+
+
+  <!-- Vocabularies -->
+ 
+  <vocabulary
+      name="Interfaces"
+      factory=".vocabulary.UtilityVocabulary"
+      interface="zope.interface.interfaces.IInterface" />
+
+  <vocabulary
+    name="Utility Component Interfaces"
+    factory=".vocabulary.UtilityComponentInterfacesVocabulary" />
+
 </configure>
 
 

Modified: Zope3/trunk/src/zope/app/component/contentdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/contentdirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/contentdirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,15 +18,19 @@
 __docformat__ = 'restructuredtext'
 
 from types import ModuleType
+from persistent.interfaces import IPersistent
+from zope.component.factory import Factory
 from zope.interface import classImplements
 from zope.schema.interfaces import IField
 from zope.configuration.exceptions import ConfigurationError
 
-from zope.app import zapi
-from zope.component.factory import Factory
-from zope.app.security.protectclass \
-    import protectLikeUnto, protectName, protectSetAttribute
+from zope.app.annotation.interfaces import IAttributeAnnotatable
 from zope.app.component.interface import provideInterface
+from zope.app.component.interfaces import ILocalUtility
+from zope.app.location.interfaces import ILocation
+from zope.app.security.protectclass import protectLikeUnto, protectName
+from zope.app.security.protectclass import protectSetAttribute
+
 from metaconfigure import factory
 
 PublicPermission = 'zope.Public'
@@ -40,10 +44,6 @@
     """Security-protection-specific exceptions."""
     pass
 
-def handler(serviceName, methodName, *args, **kwargs):
-    method=getattr(zapi.getGlobalService(serviceName), methodName)
-    method(*args, **kwargs)
-
 class ContentDirective(object):
 
     def __init__(self, _context, class_):
@@ -51,9 +51,6 @@
         self.__class = class_
         if isinstance(self.__class, ModuleType):
             raise ConfigurationError('Content class attribute must be a class')
-        # not used yet
-        #self.__name = class_
-        #self.__normalized_name = _context.getNormalizedName(class_)
         self.__context = _context
 
     def implements(self, _context, interface):
@@ -171,7 +168,63 @@
         id = id or self.__id
         factoryObj = Factory(self.__class, title, description)
 
-        # note factories are all in one pile, services and content,
+        # note factories are all in one pile, utilities and content,
         # so addable names must also act as if they were all in the
-        # same namespace, despite the service/content division
+        # same namespace, despite the utilities/content division
         factory(_context, factoryObj, id, title, description)
+
+
+class LocalUtilityDirective(ContentDirective):
+    r"""localUtility directive handler.
+
+    Examples:
+
+      >>> from zope.interface import implements
+      >>> class LU1(object):
+      ...     pass
+
+      >>> class LU2(LU1):
+      ...     implements(ILocation)
+
+      >>> class LU3(LU1):
+      ...     __parent__ = None
+
+      >>> class LU4(LU2):
+      ...     implements(IPersistent)
+
+      >>> dir = LocalUtilityDirective(None, LU4)
+      >>> IAttributeAnnotatable.implementedBy(LU4)
+      True
+      >>> ILocalUtility.implementedBy(LU4)
+      True
+
+      >>> LocalUtilityDirective(None, LU3)
+      Traceback (most recent call last):
+      ...
+      ConfigurationError: Class `LU3` does not implement `IPersistent`.
+
+      >>> LocalUtilityDirective(None, LU2)
+      Traceback (most recent call last):
+      ...
+      ConfigurationError: Class `LU2` does not implement `IPersistent`.
+
+      >>> LocalUtilityDirective(None, LU1)
+      Traceback (most recent call last):
+      ...
+      ConfigurationError: Class `LU1` does not implement `ILocation`.
+    """
+
+    def __init__(self, _context, class_):
+        if not ILocation.implementedBy(class_) and \
+               not hasattr(class_, '__parent__'):
+            raise ConfigurationError, \
+                  'Class `%s` does not implement `ILocation`.' %class_.__name__
+
+        if not IPersistent.implementedBy(class_):
+            raise ConfigurationError, \
+                 'Class `%s` does not implement `IPersistent`.' %class_.__name__
+
+        classImplements(class_, IAttributeAnnotatable)
+        classImplements(class_, ILocalUtility)
+
+        super(LocalUtilityDirective, self).__init__(_context, class_)

Modified: Zope3/trunk/src/zope/app/component/fields.py
===================================================================
--- Zope3/trunk/src/zope/app/component/fields.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/fields.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,17 +21,16 @@
 from zope.component.exceptions import ComponentLookupError
 from zope.configuration.exceptions import ConfigurationError
 from zope.configuration.fields import GlobalObject
-from zope.interface.interfaces import IInterface
 from zope.publisher.interfaces.browser import ILayer
 
 from zope.app import zapi
 
 
 class LayerField(GlobalObject):
-    r"""This fields represents a layer.
+    r"""This field represents a layer.
 
     Besides being able to look up the layer by importing it, we also try
-    to look up the name in the utility service.
+    to look up the name in the site manager.
 
     >>> from zope.interface import directlyProvides
     >>> from zope.interface.interface import InterfaceClass
@@ -78,10 +77,10 @@
     >>> if old is not None:
     ...     sys.modules['zope.app.layers'] = old
 
-    Test 3: Get the layer from the utility service
-    ----------------------------------------------
+    Test 3: Get the layer from the site manager
+    -------------------------------------------
 
-    >>> from zope.app.tests import ztapi
+    >>> from zope.app.testing import ztapi
     >>> ztapi.provideUtility(ILayer, layer1, 'layer1')
 
     >>> field.fromUnicode('layer1') is layer1

Modified: Zope3/trunk/src/zope/app/component/hooks.py
===================================================================
--- Zope3/trunk/src/zope/app/component/hooks.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/hooks.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,19 +18,8 @@
 __docformat__ = 'restructuredtext'
 
 import zope.component
-from zope.component import getService
-from zope.component.interfaces import IServiceService
-from zope.app.site.interfaces import ISite
-from zope.component.service import serviceManager
-from zope.component.exceptions import ComponentLookupError
-from zope.security.proxy import removeSecurityProxy
-from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.location.interfaces import ILocation
-from zope.app.location import locate
-from zope.interface import Interface
-from zope.component.servicenames import Adapters
-import warnings
 import zope.thread
+import zope.security
 
 class read_property(object):
     def __init__(self, func):
@@ -44,12 +33,10 @@
 
 class SiteInfo(zope.thread.local):
     site = None
-    services = serviceManager
+    sm = zope.component.getGlobalSiteManager()
 
     def adapter_hook(self):
-        services = self.services
-        adapters = services.getService(Adapters)
-        adapter_hook = adapters.adapter_hook
+        adapter_hook = self.sm.adapters.adapter_hook
         self.adapter_hook = adapter_hook
         return adapter_hook
     
@@ -59,7 +46,7 @@
 
 def setSite(site=None):
     if site is None:
-        services = serviceManager
+        sm = zope.component.getGlobalSiteManager()
     else:
 
         # We remove the security proxy because there's no way for
@@ -69,11 +56,11 @@
         # once site managers do less.  There's probably no good reason why
         # they can't be proxied.  Well, except maybe for performance.
         
-        site = removeSecurityProxy(site)
-        services = site.getSiteManager()
+        site = zope.security.proxy.removeSecurityProxy(site)
+        sm = site.getSiteManager()
 
     siteinfo.site = site
-    siteinfo.services = services
+    siteinfo.sm = sm
     try:
         del siteinfo.adapter_hook
     except AttributeError:
@@ -81,56 +68,41 @@
     
 def getSite():
     return siteinfo.site
-    
-def getServices_hook(context=None):
 
-    if context is None:
-        return siteinfo.services
 
-    # Deprecated support for a context that isn't adaptable to
-    # IServiceService.  Return the default service manager.
-    try:
+def getSiteManager(context=None):
+    """A special hook for getting the site manager.
 
+    Here we take the currently set site into account to find the appropriate
+    site manager.
+    """
+    if context is None:
+        return siteinfo.sm
 
-        # We remove the security proxy because there's no way for
-        # untrusted code to get at it without it being proxied again.
+    # We remove the security proxy because there's no way for
+    # untrusted code to get at it without it being proxied again.
 
-        # We should really look look at this again though, especially
-        # once site managers do less.  There's probably no good reason why
-        # they can't be proxied.  Well, except maybe for performance.
+    # We should really look look at this again though, especially
+    # once site managers do less.  There's probably no good reason why
+    # they can't be proxied.  Well, except maybe for performance.
+    sm = zope.component.interfaces.ISiteManager(
+        context, zope.component.getGlobalSiteManager())
+    return zope.security.proxy.removeSecurityProxy(sm)
 
 
-        return removeSecurityProxy(IServiceService(context,
-                                                   serviceManager))
-    except ComponentLookupError:
-        return serviceManager
-
 def adapter_hook(interface, object, name='', default=None):
     try:
         return siteinfo.adapter_hook(interface, object, name, default)
-    except ComponentLookupError:
+    except zope.component.exceptions.ComponentLookupError:
         return default
-    
-def queryView(object, name, request, default=None,
-              providing=Interface, context=None):
-    adapters = getService(Adapters, context)
-    view = adapters.queryMultiAdapter((object, request), providing,
-                                      name, default)
-    if ILocation.providedBy(view):
-        locate(view, object, name)
 
-    return view
 
-
 def setHooks():
-    # Hook up a new implementation of looking up views.
-    zope.component.getServices.sethook(getServices_hook)
     zope.component.adapter_hook.sethook(adapter_hook)
-    zope.component.queryView.sethook(queryView)
+    zope.component.getSiteManager.sethook(getSiteManager)
 
 def resetHooks():
     # Reset hookable functions to original implementation.
-    zope.component.getServices.reset()
     zope.component.adapter_hook.reset()
-    zope.component.queryView.reset()
+    zope.component.getSiteManager.reset()
     

Modified: Zope3/trunk/src/zope/app/component/interface.py
===================================================================
--- Zope3/trunk/src/zope/app/component/interface.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/interface.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,35 +16,36 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
-
+from types import ClassType
 from zope.component.exceptions import ComponentLookupError
 from zope.interface import directlyProvides
 from zope.interface.interfaces import IInterface
-from types import ClassType
 from zope.app import zapi
 
 def provideInterface(id, interface, iface_type=None, info=''):
-    """register Interface with utility service
+    """register Interface with global site manager as utility
 
-    >>> from zope.app.tests.placelesssetup import setUp, tearDown
-    >>> setUp()
-    >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+    >>> from zope.app.testing import placelesssetup
+    >>> placelesssetup.setUp()
+    >>> gsm = zapi.getGlobalSiteManager()
+
     >>> from zope.interface import Interface
     >>> from zope.interface.interfaces import IInterface
     >>> from zope.app.content.interfaces import IContentType
+
     >>> class I(Interface):
     ...     pass
     >>> IInterface.providedBy(I)
     True
     >>> IContentType.providedBy(I)
     False
-    >>> interfaces = utilities.getUtilitiesFor(IContentType)
+    >>> interfaces = gsm.getUtilitiesFor(IContentType)
     >>> list(interfaces)
     []
     >>> provideInterface('', I, IContentType)
     >>> IContentType.providedBy(I)
     True
-    >>> interfaces = list(utilities.getUtilitiesFor(IContentType))
+    >>> interfaces = list(gsm.getUtilitiesFor(IContentType))
     >>> [name for (name, iface) in interfaces]
     [u'zope.app.component.interface.I']
     >>> [iface.__name__ for (name, iface) in interfaces]
@@ -56,13 +57,12 @@
     True
     >>> IContentType.providedBy(I1)
     False
-    >>> interfaces = list(utilities.getUtilitiesFor(IContentType))
+    >>> interfaces = list(gsm.getUtilitiesFor(IContentType))
     >>> [name for (name, iface) in interfaces]
     [u'zope.app.component.interface.I']
     >>> [iface.__name__ for (name, iface) in interfaces]
     ['I']
-    >>> tearDown()
-    
+    >>> placelesssetup.tearDown()
     """
     if not id:
         id = "%s.%s" % (interface.__module__, interface.__name__)
@@ -79,19 +79,19 @@
     else:
         iface_type = IInterface
         
-    utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
-    utilityService.provideUtility(iface_type, interface, id, info)
+    gsm = zapi.getGlobalSiteManager()
+    gsm.provideUtility(iface_type, interface, id, info)
 
 
-
 def getInterface(context, id):
     """return interface or ComponentLookupError
 
-    >>> from zope.app.tests.placelesssetup import setUp, tearDown
-    >>> setUp()
-    >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+    >>> from zope.app.testing import placelesssetup
+    >>> placelesssetup.setUp()
+
     >>> from zope.interface import Interface
     >>> from zope.app.content.interfaces import IContentType
+
     >>> class I4(Interface):
     ...     pass
     >>> IInterface.providedBy(I4)
@@ -109,24 +109,25 @@
                 """ 'zope.app.component.interface.I4')
     >>> iface.__name__
     'I4'
-    >>> tearDown()
-    
+    >>> placelesssetup.tearDown()    
     """
     iface = queryInterface(id, None)
     if iface is None:
         raise ComponentLookupError(id)
     return iface
 
+
 def queryInterface(id, default=None):
     """return interface or ``None``
 
-    >>> from zope.app.tests.placelesssetup import setUp, tearDown
-    >>> tearDown()
-    >>> setUp()
-    >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+    >>> from zope.app.testing import placelesssetup
+    >>> placelesssetup.tearDown()
+    >>> placelesssetup.setUp()
+
     >>> from zope.interface import Interface
     >>> from zope.interface.interfaces import IInterface
     >>> from zope.app.content.interfaces import IContentType
+
     >>> class I3(Interface):
     ...     pass
     >>> IInterface.providedBy(I3)
@@ -141,21 +142,21 @@
     >>> iface = queryInterface('zope.app.component.interface.I3')
     >>> iface.__name__
     'I3'
-    >>> tearDown()
-    
+    >>> placelesssetup.tearDown()
     """
-    
     return zapi.queryUtility(IInterface, id, default)
 
+
 def searchInterface(context, search_string=None, base=None):
     """Interfaces search
 
-    >>> from zope.app.tests.placelesssetup import setUp, tearDown
-    >>> setUp()
-    >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+    >>> from zope.app.testing import placelesssetup
+    >>> placelesssetup.setUp()
+
     >>> from zope.interface import Interface
     >>> from zope.interface.interfaces import IInterface
     >>> from zope.app.content.interfaces import IContentType
+
     >>> class I5(Interface):
     ...     pass
     >>> IInterface.providedBy(I5)
@@ -167,14 +168,11 @@
     >>> provideInterface('', I5, IContentType)
     >>> IContentType.providedBy(I5)
     True
-    >>> iface = searchInterface(None,
-    ...                        'zope.app.component.interface.I5')
+    >>> iface = searchInterface(None, 'zope.app.component.interface.I5')
     >>> iface[0].__name__
     'I5'
-    >>> tearDown()
-
+    >>> placelesssetup.tearDown()
     """
-
     return [iface_util[1]
             for iface_util in
             searchInterfaceUtilities(context, search_string, base)]
@@ -183,12 +181,13 @@
 def searchInterfaceIds(context, search_string=None, base=None):
     """Interfaces search
 
-    >>> from zope.app.tests.placelesssetup import setUp, tearDown
-    >>> setUp()
-    >>> utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
+    >>> from zope.app.testing import placelesssetup
+    >>> placelesssetup.setUp()
+
     >>> from zope.interface import Interface
     >>> from zope.interface.interfaces import IInterface
     >>> from zope.app.content.interfaces import IContentType
+
     >>> class I5(Interface):
     ...     pass
     >>> IInterface.providedBy(I5)
@@ -204,18 +203,16 @@
     ...                        'zope.app.component.interface.I5')
     >>> iface
     [u'zope.app.component.interface.I5']
-    >>> tearDown()
-
+    >>> placelesssetup.tearDown()
     """
-
     return [iface_util[0]
             for iface_util in
             searchInterfaceUtilities(context, search_string, base)]
 
 
 def searchInterfaceUtilities(context, search_string=None, base=None):
-    utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)   
-    iface_utilities = utilityService.getUtilitiesFor(IInterface)
+    gsm = zapi.getGlobalSiteManager()   
+    iface_utilities = gsm.getUtilitiesFor(IInterface)
 
     if search_string:
         search_string = search_string.lower()

Copied: Zope3/trunk/src/zope/app/component/interfaces (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces)

Deleted: Zope3/trunk/src/zope/app/component/localservice.py
===================================================================
--- Zope3/trunk/src/zope/app/component/localservice.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/localservice.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,183 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Support for delegation among service managers
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-from zope.interface import implements
-from zope.component.exceptions import ComponentLookupError
-from zope.component.service import serviceManager
-from zope.component.interfaces import IServiceService
-from zope.app.site.interfaces import ISite, ISiteManager
-from zope.testing.cleanup import addCleanUp
-from zope.app.component.hooks import setSite
-from zope.component.service import IGlobalServiceManager
-from zope.security.proxy import removeSecurityProxy
-
-# placeful service manager convenience tools
-
-# TODO: <SteveA> What we really want here is
-#
-# getLocalServices(context)
-# # if context is contained in a service manager, returns the service manager
-# # if context is a service manager, returns context
-# # otherwise, raises ComponentLookupError('Services')
-#
-# getLocalService(context, name):
-# # Returns the local service with that name
-# # This is the same as getService, so why bother? parity.
-# 
-# getNextServices(context, name):
-# # looks up the local service manager, then gets the next higher one
-# # and returns it
-#
-# getNextService(context, name):
-# # Returns the next service manager's service with that name.
-
-
-
-##def getLocalService(context, name):
-##    service = queryLocalService(context, name)
-##    if service is None:
-##        raise ComponentLookupError('service', name)
-##    return service
-##
-##def queryLocalService(context, name, default=None):
-##    try:
-##        sm = getLocalServices(context)
-##        return sm.getService(name)
-##    except ComponentLookupError:
-##        return default
-
-def queryNextService(context, name, default=None):
-    try:
-        return getNextService(context, name)
-    except ComponentLookupError:
-        return default
-
-def getNextService(context, name):
-    """Returns the service with the given name from the next service manager.
-    """
-    return getNextServices(context).getService(name)
-
-def getNextServices(context):
-    """Returns the next service manager to the one that contains `context`.
-    """
-    services = getLocalServices(context).next
-    if IGlobalServiceManager.providedBy(services):
-        services = removeSecurityProxy(services)
-    return services
-
-def queryNextServices(context, default=None):
-    try:
-        return getNextServices(context)
-    except ComponentLookupError:
-        return default
-
-def queryLocalServices(context, default=None):
-    try:
-        return getLocalServices(context)
-    except ComponentLookupError:
-        return default
-
-def getLocalServices(context):
-    """Returns the service manager that contains `context`.
-
-    If `context` is a local service, returns the service manager that
-    contains that service. If `context` is a service manager, returns `context`.
-
-    Otherwise, raises ``ComponentLookupError('Services')``
-    """
-
-    # IMPORTANT
-    #
-    # This is not allowed to use any services to get its job done!
-
-    while not (context is None or
-               ISiteManager.providedBy(context)):
-        context = getattr(context, '__parent__', None)
-    if context is None:
-        raise ComponentLookupError('Services')
-    else:
-        return context
-
-def serviceServiceAdapter(ob):
-    """An adapter ILocation -> IServiceService.
-
-    The ILocation is interpreted flexibly, we just check for
-    ``__parent__``.
-    """
-    current = ob
-    while True:
-        if ISite.providedBy(current):
-            return current.getSiteManager()
-        current = getattr(current, '__parent__', None)
-        if current is None:
-            raise ComponentLookupError("Could not adapt %r to"
-                                       " IServiceService" % (ob, ))
-
-
-def threadSiteSubscriber(event):
-    """A subscriber to BeforeTraverseEvent
-
-    Sets the 'site' thread global if the object traversed is a site.
-    """
-    if ISite.providedBy(event.object):
-        setSite(event.object)
-
-
-def clearThreadSiteSubscriber(event):
-    """A subscriber to EndRequestEvent
-
-    Cleans up the site thread global after the request is processed.
-    """
-    clearSite()
-
-# Clear the site thread global
-clearSite = setSite
-
-addCleanUp(clearSite)
-
-
-class FakeServices:
-    implements(ISiteManager)
-    
-    def __init__(self):
-        self.data = {}
-    
-    def getService(self, name):
-        return self.data[name]
-        
-
-def testingNextService(service, nextservice, servicename):
-    """A helper function that sets up next services for testing
-
-    >>> class MyService:
-    ...     __parent__ = None
-
-    >>> myfakeservice = object()
-    >>> service = MyService()
-    >>> testingNextService(service, myfakeservice, 'foo')
-    >>> getNextService(service, 'foo') is myfakeservice
-    True
-    """
-
-    if service.__parent__ is None:
-        service.__parent__ = FakeServices()
-        service.__parent__.next = FakeServices()
-
-    service.__parent__.next.data[servicename] = nextservice
-        

Modified: Zope3/trunk/src/zope/app/component/meta.zcml
===================================================================
--- Zope3/trunk/src/zope/app/component/meta.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/meta.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -54,27 +54,15 @@
         />
 
     <meta:directive
-        name="serviceType"
-        schema=".metadirectives.IServiceTypeDirective"
-        handler="zope.app.component.metaconfigure.serviceType"
-        />
-
-    <meta:directive
         name="defaultLayer"
         schema=".metadirectives.IDefaultLayerDirective"
         handler="zope.app.component.metaconfigure.defaultLayer"
         />
 
-    <meta:directive
-        name="service" 
-        schema=".metadirectives.IServiceDirective"
-        handler="zope.app.component.metaconfigure.service"
-        />
-
     <meta:complexDirective
         name="class"
         schema=".metadirectives.IClassDirective"
-        handler="zope.app.component.contentdirective.ContentDirective"
+        handler=".contentdirective.ContentDirective"
         >
 
       <meta:subdirective
@@ -102,7 +90,7 @@
     <meta:complexDirective
         name="content"
         schema=".metadirectives.IClassDirective"
-        handler="zope.app.component.contentdirective.ContentDirective"
+        handler=".contentdirective.ContentDirective"
         >
 
       <meta:subdirective
@@ -127,6 +115,34 @@
 
     </meta:complexDirective>
 
+    <meta:complexDirective
+        name="localUtility"
+        schema=".metadirectives.IClassDirective"
+        handler=".contentdirective.LocalUtilityDirective"
+        >
+
+      <meta:subdirective
+          name="implements"
+          schema=".metadirectives.IImplementsSubdirective"
+          />
+
+      <meta:subdirective
+          name="require"
+          schema=".metadirectives.IRequireSubdirective"
+          />
+
+      <meta:subdirective
+          name="allow"
+          schema=".metadirectives.IAllowSubdirective"
+          />
+
+      <meta:subdirective
+          name="factory"
+          schema=".metadirectives.IFactorySubdirective"
+          />
+
+    </meta:complexDirective>
+
   </meta:directives>
 
 </configure>

Modified: Zope3/trunk/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/component/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,6 @@
 __docformat__ = 'restructuredtext'
 
 from zope.component.interfaces import IDefaultViewName, IFactory
-from zope.component.service import UndefinedService
 from zope.configuration.exceptions import ConfigurationError
 import zope.interface
 from zope.interface import Interface
@@ -26,44 +25,26 @@
 
 from zope.security.checker import InterfaceChecker, CheckerPublic
 from zope.security.checker import Checker, NamesChecker
-from zope.security.proxy import Proxy, ProxyFactory
+from zope.security.proxy import Proxy
 
 from zope.app import zapi
-from zope.app.component.interface import queryInterface
 from zope.app.security.adapter import TrustedAdapterFactory
 
 PublicPermission = 'zope.Public'
 
-# I prefer the indirection (using getService and getServices vs.
-# directly importing the various services)  not only because it makes
-# unit tests easier, but also because it reinforces that the services
-# should always be obtained through the
-# IPlacefulComponentArchitecture interface methods.
-
-# But these services aren't placeful! And we need to get at things that
-# normal service clients don't need!   Jim
-
-
-def handler(serviceName, methodName, *args, **kwargs):
-    method=getattr(zapi.getGlobalService(serviceName), methodName)
+def handler(methodName, *args, **kwargs):
+    method=getattr(zapi.getGlobalSiteManager(), methodName)
     method(*args, **kwargs)
 
-# We can't use the handler for serviceType, because serviceType needs
-# the interface service.
 from zope.app.component.interface import provideInterface
-
-def managerHandler(methodName, *args, **kwargs):
-    method=getattr(zapi.getGlobalServices(), methodName)
-    method(*args, **kwargs)
-
 def interface(_context, interface, type=None):
     _context.action(
         discriminator = None,
         callable = provideInterface,
         args = ('', interface, type)
         )
+    
 
-
 def proxify(ob, checker):
     """Try to get the object proxied with the `checker`, but not too soon
 
@@ -128,7 +109,7 @@
     _context.action(
         discriminator = None,
         callable = _handler,
-        args = (zapi.servicenames.Adapters, 'subscribe',
+        args = ('subscribe',
                 for_, provides, factory),
         )
 
@@ -196,7 +177,7 @@
     _context.action(
         discriminator = ('adapter', for_, provides, name),
         callable = handler,
-        args = (zapi.servicenames.Adapters, 'register',
+        args = ('provideAdapter',
                 for_, provides, name, factory, _context.info),
         )
     _context.action(
@@ -263,7 +244,7 @@
     _context.action(
         discriminator = ('utility', provides, name),
         callable = handler,
-        args = ('Utilities', 'provideUtility',
+        args = ('provideUtility',
                 provides, component, name),
         )
     _context.action(
@@ -332,7 +313,7 @@
     _context.action(
         discriminator = ('resource', name, layer, provides),
         callable = handler,
-        args = (zapi.servicenames.Adapters, 'register',
+        args = ('provideAdapter',
                 (layer,), provides, name, factory, _context.info),
         )
     _context.action(
@@ -407,7 +388,7 @@
     _context.action(
         discriminator = ('view', for_, name, provides),
         callable = handler,
-        args = (zapi.servicenames.Adapters, 'register',
+        args = ('provideAdapter',
                 for_, provides, name, factory, _context.info),
         )
     if type is not None:
@@ -437,7 +418,7 @@
     _context.action(
         discriminator = ('defaultViewName', for_, type, name),
         callable = handler,
-        args = (zapi.servicenames.Adapters, 'register',
+        args = ('provideAdapter',
                 (for_, type), IDefaultViewName, '', name, _context.info)
         )
     
@@ -453,66 +434,11 @@
         args = ('', for_)
         )
 
-def serviceType(_context, id, interface):
-    _context.action(
-        discriminator = ('serviceType', id),
-        callable = managerHandler,
-        args = ('defineService', id, interface),
-        )
-
-    if interface.__name__ not in ['IUtilityService']:
-        _context.action(
-            discriminator = None,
-             callable = provideInterface,
-             args = (interface.__module__+'.'+interface.getName(),
-                     interface)
-             )
-
-def provideService(serviceType, component, permission):
-    # This is needed so we can add a security proxy.
-    # We have to wait till execution time so we can find out the interface.
-    # Waaaa.
-
-    service_manager = zapi.getGlobalServices()
-
-    if permission:
-        for stype, interface in service_manager.getServiceDefinitions():
-            if stype == serviceType:
-                break
-        else:
-            raise UndefinedService(serviceType)
-
-        if permission == PublicPermission:
-            permission = CheckerPublic
-
-        checker = InterfaceChecker(interface, permission)
-
-        try:
-            component.__Security_checker__ = checker
-        except: # too bad exceptions aren't more predictable
-            component = proxify(component, checker)
-
-    service_manager.provideService(serviceType, component)
-
-def service(_context, serviceType, component=None, permission=None,
-            factory=None):
-    if factory:
-        if component:
-            raise TypeError("Can't specify factory and component.")
-
-        component = factory()
-
-    _context.action(
-        discriminator = ('service', serviceType),
-        callable = provideService,
-        args = (serviceType, component, permission),
-        )
-
 def defaultLayer(_context, type, layer):
     _context.action(
         discriminator=('defaultLayer', type, layer),
         callable=handler,
-        args = (zapi.servicenames.Adapters, 'register',
+        args = ('provideAdapter',
                (type,), IInterface, 'defaultLayer',
                lambda request: layer, _context.info)
         )

Modified: Zope3/trunk/src/zope/app/component/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -26,7 +26,13 @@
 
 from zope.app.i18n import ZopeMessageIDFactory as _
 
+class IDefaultViewName(zope.interface.Interface):
+    """A string that contains the default view name
 
+    A default view name is used to select a view when a user hasn't
+    specified one.
+    """
+
 class IBasicComponentInformation(zope.interface.Interface):
 
     component = zope.configuration.fields.GlobalObject(
@@ -339,7 +345,6 @@
         )
 
 
-
 class IResourceDirective(IBasicComponentInformation,
                          IBasicResourceInformation):
     """Register a resource"""
@@ -363,26 +368,6 @@
         )
 
 
-class IServiceTypeDirective(zope.interface.Interface):
-
-    id = zope.schema.TextLine(
-        title=_("ID of the service type"),
-        required=True
-        )
-
-    interface = zope.configuration.fields.GlobalInterface(
-        title=_("Interface of the service type"),
-        required=True
-        )
-
-class IServiceDirective(IBasicComponentInformation):
-    """Register a service"""
-
-    serviceType = zope.schema.TextLine(
-        title=_("ID of service type"),
-        required=True
-        )
-
 class IClassDirective(zope.interface.Interface):
     """Make statements about a class"""
 

Copied: Zope3/trunk/src/zope/app/component/registration.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/registration.py)


Property changes on: Zope3/trunk/src/zope/app/component/registration.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.11
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/app/component/registration.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/registration.txt)

Copied: Zope3/trunk/src/zope/app/component/site.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/site.py)


Property changes on: Zope3/trunk/src/zope/app/component/site.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.6
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/app/component/site.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/site.txt)

Copied: Zope3/trunk/src/zope/app/component/statusproperty.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/statusproperty.txt)

Copied: Zope3/trunk/src/zope/app/component/testing.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/testing.py)


Property changes on: Zope3/trunk/src/zope/app/component/testing.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.1
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/component/tests/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,12 +13,11 @@
 ##############################################################################
 """Sample adapter class for testing
 
-$Id$
+$Id: adapter.py 29080 2005-02-08 00:07:11Z jim $
 """
-
 import zope.interface
 import zope.component
-import zope.component.tests.components
+import components
 
 class I1(zope.interface.Interface):
     pass
@@ -46,7 +45,7 @@
     zope.interface.implements(I2)
 
 class A3(Adapter):
-    zope.component.adapts(zope.component.tests.components.IContent, I1, I2)
+    zope.component.adapts(components.IContent, I1, I2)
     zope.interface.implements(I3)
 
 class A4:


Property changes on: Zope3/trunk/src/zope/app/component/tests/adapter.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Copied: Zope3/trunk/src/zope/app/component/tests/components.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/tests/components.py)


Property changes on: Zope3/trunk/src/zope/app/component/tests/exampleclass.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/component/tests/factory.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/factory.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/factory.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Factory tests.
 
-$Id$
+$Id: factory.py 26551 2004-07-15 07:06:37Z srichter $
 """
 from zope.component.interfaces import IFactory
 from zope.interface import Interface, implements, implementedBy


Property changes on: Zope3/trunk/src/zope/app/component/tests/factory.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native


Property changes on: Zope3/trunk/src/zope/app/component/tests/module.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.4
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/component/tests/service.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/service.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/service.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,38 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Service stub for testing
-
-$Id$
-"""
-from zope.interface import Interface, implements
-
-class IFooService(Interface):
-
-    def foo(): pass
-    def foobar(): pass
-
-class FooService(object):
-
-    implements(IFooService)
-
-    def foo(self): return "foo here"
-    def foobar(self): return "foobarred"
-
-    def bar(self): return "you shouldn't get this"
-
-fooService = FooService()
-
-class Foo2(FooService): pass
-
-foo2 = Foo2()

Copied: Zope3/trunk/src/zope/app/component/tests/test_adapter.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_adapter.py)

Copied: Zope3/trunk/src/zope/app/component/tests/test_api.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_api.py)

Modified: Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_contentdirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,24 +22,34 @@
 
 from zope.interface import Interface, implements
 from zope.testing.doctestunit import DocTestSuite
-from zope.app.component.metaconfigure import interface
-from zope.app.content.interfaces import IContentType
+from zope.component.tests.request import Request
+from zope.component import createObject
+from zope.component.interfaces import IDefaultViewName
 
 from zope.configuration.xmlconfig import xmlconfig, XMLConfig
 from zope.configuration.exceptions import ConfigurationError
+from zope.configuration.xmlconfig import ZopeXMLConfigurationError
 
 from zope.security.proxy import removeSecurityProxy
 from zope.security.proxy import getTestProxyItems
+from zope.security.checker import ProxyFactory
+from zope.security.checker import selectChecker
 
 import zope.app.component
 from zope.component.exceptions import ComponentLookupError
 
 from zope.app import zapi
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.component.tests.views import IV, IC, V1, VZMI, R1, RZMI, IR
-from zope.component.tests.request import Request
-from zope.security.checker import ProxyFactory
+from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.component.interface import queryInterface
+from zope.app.component.metaconfigure import interface
+from zope.app.component.tests.adapter import A1, A2, A3, I1, I3, IS, Handler
+from zope.app.component.tests.components import Content, IApp, Comp, comp
+from zope.app.component.tests.views import IV, IC, V1, R1, IR
+from zope.app.content.interfaces import IContentType
 
+from zope.app.component.tests import module, exampleclass
+from zope.app.component.interface import queryInterface
+
 # TODO: tests for other directives needed
 
 atre = re.compile(' at [0-9a-fA-Fx]+')
@@ -92,6 +102,7 @@
 def definePermissions():
     XMLConfig('meta.zcml', zope.app.component)()
 
+
 class Test(PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
@@ -100,19 +111,15 @@
         XMLConfig('meta.zcml', zope.app.security)()
 
     def testSubscriber(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.app.component.tests.adapter import IS
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <subscriber
               provides="zope.app.component.tests.adapter.IS"
               factory="zope.app.component.tests.adapter.A3"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1"
               />
-            """
+            '''
             )))
 
         content = Content()
@@ -125,20 +132,16 @@
         self.assertEqual(a3.context, (content, a1))
 
     def testTrustedSubscriber(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.app.component.tests.adapter import IS
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <subscriber
               provides="zope.app.component.tests.adapter.IS"
               factory="zope.app.component.tests.adapter.A3"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1"
               trusted="yes"
               />
-            """
+            '''
             )))
 
         # With an unproxied object, business as usual
@@ -166,17 +169,14 @@
         self.assert_(removeSecurityProxy(a3).context[0] is content)
 
     def testSubscriber_w_no_provides(self):
-        from zope.app.component.tests.adapter import A1, A2, Handler, I3
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <subscriber
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1"
               handler="zope.app.component.tests.adapter.Handler"
               />
-            """
+            '''
             )))
 
         content = Content()
@@ -186,25 +186,21 @@
         self.assertEqual(content.args, ((a1,),))
         
     def testMultiSubscriber(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.app.component.tests.adapter import IS
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <subscriber
               provides="zope.app.component.tests.adapter.IS"
               factory="zope.app.component.tests.adapter.A3"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1"
               />
             <subscriber
               provides="zope.app.component.tests.adapter.IS"
               factory="zope.app.component.tests.adapter.A2"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1"
               />
-            """
+            '''
             )))
 
         content = Content()
@@ -220,34 +216,30 @@
 
     def testAdapter(self):
         # Full import is critical!
-        from zope.component.tests.components import Content, IApp, Comp
-
         self.assertEqual(IV(Content(), None), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.component.tests.components.Comp"
-              provides="zope.component.tests.components.IApp"
-              for="zope.component.tests.components.IContent"
+              factory="zope.app.component.tests.components.Comp"
+              provides="zope.app.component.tests.components.IApp"
+              for="zope.app.component.tests.components.IContent"
               />
-            """
+            '''
             )))
 
         self.assertEqual(IApp(Content()).__class__, Comp)
 
     def testAdapter_wo_provides_or_for(self):
         # Full import is critical!
-        from zope.component.tests.components import Content, IApp, Comp
-
         self.assertEqual(IV(Content(), None), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.component.tests.components.Comp"
+              factory="zope.app.component.tests.components.Comp"
               />
-            """
+            '''
             )))
 
         self.assertEqual(IApp(Content()).__class__, Comp)        
@@ -255,12 +247,12 @@
     def testAdapter_wo_provides_and_no_implented_fails(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <adapter
                   factory="zope.app.component.tests.adapter.A4"
-                  for="zope.component.tests.components.IContent"
+                  for="zope.app.component.tests.components.IContent"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
@@ -268,30 +260,27 @@
     def testAdapter_wo_provides_and_too_many_implented_fails(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <adapter
                   factory="zope.app.component.tests.adapter.A4"
-                  for="zope.component.tests.components.IContent"
+                  for="zope.app.component.tests.components.IContent"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
 
     def testTrustedAdapter(self):
         # Full import is critical!
-        from zope.component.tests.components import Content
-        from zope.app.component.tests.adapter import A1, I1
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
               factory="zope.app.component.tests.adapter.A1"
               provides="zope.app.component.tests.adapter.I1"
-              for="zope.component.tests.components.IContent"
+              for="zope.app.component.tests.components.IContent"
               trusted="yes"
               />
-            """
+            '''
             )))
 
         # With an unproxied object, business as usual
@@ -315,20 +304,17 @@
         
 
     def testAdapter_w_multiple_factories(self):
-        from zope.app.component.tests.adapter import A1, A2, A3
-        from zope.component.tests.components import Content, IApp
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
               factory="zope.app.component.tests.adapter.A1
                        zope.app.component.tests.adapter.A2
                        zope.app.component.tests.adapter.A3
                       "
-              provides="zope.component.tests.components.IApp"
-              for="zope.component.tests.components.IContent"
+              provides="zope.app.component.tests.components.IApp"
+              for="zope.app.component.tests.components.IContent"
               />
-            """
+            '''
             )))
 
         # The resulting adapter should be an A3, around an A2, around
@@ -347,35 +333,30 @@
         self.assertRaises(ConfigurationError,
                           xmlconfig,
                           StringIO(template % (
-                             """
+                             '''
                              <adapter
                              factory="
                                      "
-                             provides="zope.component.tests.components.IApp"
-                             for="zope.component.tests.components.IContent"
+                             provides="zope.app.component.tests.components.IApp"
+                             for="zope.app.component.tests.components.IContent"
                              />
-                             """
+                             '''
                              )),
                           )
 
     def testMultiAdapter(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
               factory="zope.app.component.tests.adapter.A3
                       "
               provides="zope.app.component.tests.adapter.I3"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1
-                   zope.app.component.tests.adapter.I2
-                  "
+                   zope.app.component.tests.adapter.I2"
               />
-            """
+            '''
             )))
-
         content = Content()
         a1 = A1()
         a2 = A2()
@@ -384,24 +365,20 @@
         self.assertEqual(a3.context, (content, a1, a2))
 
     def testProtectedMultiAdapter(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
               factory="zope.app.component.tests.adapter.A3
                       "
               provides="zope.app.component.tests.adapter.I3"
-              for="zope.component.tests.components.IContent
+              for="zope.app.component.tests.components.IContent
                    zope.app.component.tests.adapter.I1
                    zope.app.component.tests.adapter.I2
                   "
               permission="zope.Public"
               />
-            """
+            '''
             )))
-
         content = Content()
         a1 = A1()
         a2 = A2()
@@ -411,16 +388,12 @@
         self.assertEqual(items, ['f1', 'f2', 'f3'])
 
     def testMultiAdapter_wo_for_or_provides(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
-        from zope.component.tests.components import Content
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.app.component.tests.adapter.A3
-                      "
+              factory="zope.app.component.tests.adapter.A3"
               />
-            """
+            '''
             )))
 
         content = Content()
@@ -431,17 +404,14 @@
         self.assertEqual(a3.context, (content, a1, a2))
 
     def testNullAdapter(self):
-        from zope.app.component.tests.adapter import A3, I3
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.app.component.tests.adapter.A3
-                      "
+              factory="zope.app.component.tests.adapter.A3"
               provides="zope.app.component.tests.adapter.I3"
               for=""
               />
-            """
+            '''
             )))
 
         a3 = zapi.queryMultiAdapter((), I3)
@@ -452,77 +422,68 @@
         self.assertRaises(ConfigurationError,
                           xmlconfig,
                           StringIO(template % (
-                             """
+                             '''
                              <adapter
                              factory="zope.app.component.tests.adapter.A1
                                       zope.app.component.tests.adapter.A2
                                      "
-                             for="zope.component.tests.components.IContent
+                             for="zope.app.component.tests.components.IContent
                                   zope.app.component.tests.adapter.I1
                                   zope.app.component.tests.adapter.I2
                                   "
-                             provides="zope.component.tests.components.IApp"
+                             provides="zope.app.component.tests.components.IApp"
                              />
-                             """
+                             '''
                              )),
                           )
         
         self.assertRaises(ConfigurationError,
                           xmlconfig,
                           StringIO(template % (
-                             """
+                             '''
                              <adapter
                              factory="zope.app.component.tests.adapter.A1
                                       zope.app.component.tests.adapter.A2
                                      "
                              for=""
-                             provides="zope.component.tests.components.IApp"
+                             provides="zope.app.component.tests.components.IApp"
                              />
-                             """
+                             '''
                              )),
                           )
         
 
     def testNamedAdapter(self):
-
-
-        # Full import is critical!
-        from zope.component.tests.components import Content, IApp, Comp
-
         self.testAdapter()
         self.assertEqual(IApp(Content()).__class__, Comp)
         self.assertEqual(zapi.queryAdapter(Content(), IV, 'test'), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.component.tests.components.Comp"
-              provides="zope.component.tests.components.IApp"
-              for="zope.component.tests.components.IContent"
+              factory="zope.app.component.tests.components.Comp"
+              provides="zope.app.component.tests.components.IApp"
+              for="zope.app.component.tests.components.IContent"
               name="test"
               />
-            """
+            '''
             )))
 
         self.assertEqual(
             zapi.getAdapter(Content(), IApp, "test").__class__, Comp)
 
     def testProtectedAdapter(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import Content, IApp, Comp
-
         self.assertEqual(IV(Content(), None), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.component.tests.components.Comp"
-              provides="zope.component.tests.components.IApp"
-              for="zope.component.tests.components.IContent"
+              factory="zope.app.component.tests.components.Comp"
+              provides="zope.app.component.tests.components.IApp"
+              for="zope.app.component.tests.components.IContent"
               permission="zope.Public"
               />
-            """
+            '''
             )))
 
         adapter = ProxyFactory(IApp(Content()))
@@ -531,19 +492,14 @@
         self.assertEqual(removeSecurityProxy(adapter).__class__, Comp)
 
     def testProtectedAdapter_wo_for_or_provides(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import Content, IApp, Comp
-
         self.assertEqual(IV(Content(), None), None)
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <adapter
-              factory="zope.component.tests.components.Comp"
+              factory="zope.app.component.tests.components.Comp"
               permission="zope.Public"
               />
-            """
+            '''
             )))
 
         adapter = ProxyFactory(IApp(Content()))
@@ -553,48 +509,40 @@
 
     def testAdapterUndefinedPermission(self):
         config = StringIO(template % (
-             """
+             '''
              <adapter
-              factory="zope.component.tests.components.Comp"
-              provides="zope.component.tests.components.IApp"
-              for="zope.component.tests.components.IContent"
+              factory="zope.app.component.tests.components.Comp"
+              provides="zope.app.component.tests.components.IApp"
+              for="zope.app.component.tests.components.IContent"
               permission="zope.UndefinedPermission"
               />
-            """
+            '''
             ))
         self.assertRaises(ValueError, xmlconfig, config, testing=1)
 
     def testUtility(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import IApp, comp
-
         self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <utility
-              component="zope.component.tests.components.comp"
-              provides="zope.component.tests.components.IApp"
+              component="zope.app.component.tests.components.comp"
+              provides="zope.app.component.tests.components.IApp"
               />
-            """
+            '''
             )))
 
         self.assertEqual(zapi.getUtility(IApp), comp)
 
     def testUtility_wo_provides(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import IApp, comp
-
         self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <utility
-              component="zope.component.tests.components.comp"
+              component="zope.app.component.tests.components.comp"
               />
-            """
+            '''
             )))
 
         self.assertEqual(zapi.getUtility(IApp), comp)
@@ -602,11 +550,11 @@
     def testUtility_wo_provides_fails_if_no_provides(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <utility
                   component="zope.app.component.tests.adapter.a4"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
@@ -614,11 +562,11 @@
     def testUtility_wo_provides_fails_if_too_many_provided(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <utility
                   component="zope.app.component.tests.adapter.a5"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
@@ -626,11 +574,11 @@
     def testUtility_wo_provides_fails_if_no_implemented(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <utility
                   factory="zope.app.component.tests.adapter.A4"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
@@ -638,69 +586,54 @@
     def testUtility_wo_provides_fails_if_too_many_implemented(self):
         try:
             xmlconfig(StringIO(template % (
-                """
+                '''
                 <utility
                   factory="zope.app.component.tests.adapter.A5"
                   />
-                """
+                '''
                 )))
         except ConfigurationError, v:
             self.assert_("Missing 'provides' attribute" in str(v))
 
     def testNamedUtility(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import IApp, comp
-
         self.testUtility()
-
         self.assertEqual(zapi.queryUtility(IV, 'test'), None)
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <utility
-              component="zope.component.tests.components.comp"
-              provides="zope.component.tests.components.IApp"
+              component="zope.app.component.tests.components.comp"
+              provides="zope.app.component.tests.components.IApp"
               name="test"
               />
-            """
+            '''
             )))
 
         self.assertEqual(zapi.getUtility(IApp, "test"), comp)
 
     def testUtilityFactory(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import IApp, Comp
-
         self.assertEqual(zapi.queryUtility(IV), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <utility
-              factory="zope.component.tests.components.Comp"
-              provides="zope.component.tests.components.IApp"
+              factory="zope.app.component.tests.components.Comp"
+              provides="zope.app.component.tests.components.IApp"
               />
-            """
+            '''
             )))
 
         self.assertEqual(zapi.getUtility(IApp).__class__, Comp)
 
     def testProtectedUtility(self):
-
-        # Full import is critical!
-        from zope.component.tests.components import IApp, comp
-
         self.assertEqual(zapi.queryUtility(IV), None)
-
         xmlconfig(StringIO(template % (
-            """
+            '''
             <utility
-              component="zope.component.tests.components.comp"
-              provides="zope.component.tests.components.IApp"
+              component="zope.app.component.tests.components.comp"
+              provides="zope.app.component.tests.components.IApp"
               permission="zope.Public"
               />
-            """
+            '''
             )))
 
         utility = ProxyFactory(zapi.getUtility(IApp))
@@ -710,13 +643,13 @@
 
     def testUtilityUndefinedPermission(self):
         config = StringIO(template % (
-             """
+             '''
              <utility
-              component="zope.component.tests.components.comp"
-              provides="zope.component.tests.components.IApp"
+              component="zope.app.component.tests.components.comp"
+              provides="zope.app.component.tests.components.IApp"
               permission="zope.UndefinedPermission"
               />
-            """
+            '''
             ))
         self.assertRaises(ValueError, xmlconfig, config,
                           testing=1)
@@ -724,34 +657,34 @@
 
     def testView(self):
         ob = Ob()
-        self.assertEqual(zapi.queryView(ob, 'test', Request(IV), None), None)
+        request = Request(IV)
+        self.assertEqual(
+            zapi.queryMultiAdapter((ob, request), name=u'test'), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IV"/>
-            """
+            '''
             ))
 
         self.assertEqual(
-            zapi.queryView(ob, 'test', Request(IV), None).__class__,
+            zapi.queryMultiAdapter((ob, request), name=u'test').__class__,
             V1)
 
 
     def testMultiView(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.adapter.A3"
                   for="zope.app.component.tests.views.IC
                        zope.app.component.tests.adapter.I1
-                       zope.app.component.tests.adapter.I2
-                       "
+                       zope.app.component.tests.adapter.I2"
                   type="zope.app.component.tests.views.IV"/>
-            """
+            '''
             ))
 
 
@@ -759,34 +692,31 @@
         a1 = A1()
         a2 = A2()
         request = Request(IV)
-        view = zapi.queryMultiView((ob, a1, a2), request, name='test')
+        view = zapi.queryMultiAdapter((ob, a1, a2, request), name=u'test')
         self.assertEqual(view.__class__, A3)
         self.assertEqual(view.context, (ob, a1, a2, request))
 
+
     def testMultiView_fails_w_multiple_factories(self):
-        from zope.app.component.tests.adapter import A1, A2, A3, I3
         self.assertRaises(
             ConfigurationError,
             xmlconfig,
             StringIO(template %
-              """
+              '''
               <view name="test"
                     factory="zope.app.component.tests.adapter.A3
                              zope.app.component.tests.adapter.A2"
                     for="zope.app.component.tests.views.IC
                          zope.app.component.tests.adapter.I1
-                         zope.app.component.tests.adapter.I2
-                         "
+                         zope.app.component.tests.adapter.I2"
                     type="zope.app.component.tests.views.IV"/>
-              """
+              '''
               )
             )
 
     def testView_w_multiple_factories(self):
-        from zope.app.component.tests.adapter import A1, A2, A3
-
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.adapter.A1
                            zope.app.component.tests.adapter.A2
@@ -794,14 +724,14 @@
                            zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IV"/>
-            """
+            '''
             ))
 
         ob = Ob()
 
         # The view should be a V1 around an A3, around an A2, around
         # an A1, anround ob:
-        view = zapi.queryView(ob, 'test', Request(IV))
+        view = zapi.queryMultiAdapter((ob, Request(IV)), name=u'test')
         self.assertEqual(view.__class__, V1)
         a3 = view.context
         self.assertEqual(a3.__class__, A3)
@@ -812,89 +742,85 @@
         self.assertEqual(a1.context[0], ob)
 
     def testView_fails_w_no_factories(self):
-        from zope.app.component.tests.adapter import A1, A2, A3
-
         self.assertRaises(ConfigurationError,
                           xmlconfig,
                           StringIO(template %
-                                   """
+                                   '''
                                    <view name="test"
                                    factory=""
                                    for="zope.app.component.tests.views.IC"
                                    type="zope.app.component.tests.views.IV"/>
-                                   """
+                                   '''
                                    ),
                           )
 
         
     def testViewThatProvidesAnInterface(self):
-
         ob = Ob()
-        self.assertEqual(zapi.queryView(ob, 'test', Request(IV), None), None)
+        self.assertEqual(
+            zapi.queryMultiAdapter((ob, Request(IR)), IV, u'test'), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IR"
                   />
-            """
+            '''
             ))
 
-        v = zapi.queryView(ob, 'test', Request(IR), None, providing=IV)
-        self.assertEqual(v, None)
+        self.assertEqual(
+            zapi.queryMultiAdapter((ob, Request(IR)), IV, u'test'), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IR"
                   provides="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
 
-        v = zapi.queryView(ob, 'test', Request(IR), None, providing=IV)
+        v = zapi.queryMultiAdapter((ob, Request(IR)), IV, u'test')
+        self.assertEqual(v.__class__, V1)
 
-        self.assertEqual(v.__class__,
-                         V1)
 
     def testUnnamedViewThatProvidesAnInterface(self):
-
         ob = Ob()
-        self.assertEqual(zapi.queryView(ob, '', Request(IV), None), None)
+        self.assertEqual(
+            zapi.queryMultiAdapter((ob, Request(IR)), IV), None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <view factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IR"
                   />
-            """
+            '''
             ))
 
-        v = zapi.queryView(ob, '', Request(IR), None, providing=IV)
+        v = zapi.queryMultiAdapter((ob, Request(IR)), IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
-            """
+            '''
             <view factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IR"
                   provides="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
 
-        v = zapi.queryView(ob, '', Request(IR), None, providing=IV)
-
+        v = zapi.queryMultiAdapter((ob, Request(IR)), IV)
         self.assertEqual(v.__class__, V1)
 
     def testInterfaceProtectedView(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
@@ -902,16 +828,16 @@
                   permission="zope.Public"
               allowed_interface="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
 
-        v = ProxyFactory(zapi.getView(Ob(), 'test', Request(IV)))
+        v = ProxyFactory(zapi.getMultiAdapter((Ob(), Request(IV)), name='test'))
         self.assertEqual(v.index(), 'V1 here')
         self.assertRaises(Exception, getattr, v, 'action')
 
     def testAttributeProtectedView(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
@@ -919,16 +845,16 @@
                   permission="zope.Public"
                   allowed_attributes="action"
                   />
-            """
+            '''
             ))
 
-        v = ProxyFactory(zapi.getView(Ob(), 'test', Request(IV)))
+        v = ProxyFactory(zapi.getMultiAdapter((Ob(), Request(IV)), name='test'))
         self.assertEqual(v.action(), 'done')
         self.assertRaises(Exception, getattr, v, 'index')
 
     def testInterfaceAndAttributeProtectedView(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
@@ -937,16 +863,16 @@
                   allowed_attributes="action"
               allowed_interface="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
 
-        v = zapi.getView(Ob(), 'test', Request(IV))
+        v = zapi.getMultiAdapter((Ob(), Request(IV)), name='test')
         self.assertEqual(v.index(), 'V1 here')
         self.assertEqual(v.action(), 'done')
 
     def testDuplicatedInterfaceAndAttributeProtectedView(self):
         xmlconfig(StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
@@ -955,10 +881,10 @@
                   allowed_attributes="action index"
               allowed_interface="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
 
-        v = zapi.getView(Ob(), 'test', Request(IV))
+        v = zapi.getMultiAdapter((Ob(), Request(IV)), name='test')
         self.assertEqual(v.index(), 'V1 here')
         self.assertEqual(v.action(), 'done')
 
@@ -967,19 +893,19 @@
             ConfigurationError,
             xmlconfig,
             StringIO(template %
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IV"
                   allowed_attributes="action index"
                   />
-            """
+            '''
             ))
 
     def testViewUndefinedPermission(self):
         config = StringIO(template % (
-            """
+            '''
             <view name="test"
                   factory="zope.app.component.tests.views.V1"
                   for="zope.app.component.tests.views.IC"
@@ -988,48 +914,50 @@
                   allowed_attributes="action index"
               allowed_interface="zope.app.component.tests.views.IV"
                   />
-            """
+            '''
             ))
         self.assertRaises(ValueError, xmlconfig, config, testing=1)
 
 
     def testDefaultView(self):
-
         ob = Ob()
-        self.assertEqual(zapi.queryView(ob, 'test', Request(IV), None), None)
+        self.assertEqual(
+            zapi.queryMultiAdapter((Ob(), Request(IV)), name='test'), None)
 
         xmlconfig(StringIO(template % (
-            """
+            '''
             <defaultView name="test"
                   for="zope.app.component.tests.views.IC"
                   type="zope.app.component.tests.views.IV"/>
-            """
+            '''
             )))
 
-        self.assertEqual(zapi.queryView(ob, 'test', Request(IV), None), None)
-        self.assertEqual(zapi.getDefaultViewName(ob, Request(IV)), 'test')
+        self.assertEqual(
+            zapi.queryMultiAdapter((Ob(), Request(IV)), name='test'), None)
+        self.assertEqual(
+            zapi.getGlobalSiteManager().adapters.lookup((IC, IV),
+                                                        IDefaultViewName),
+            'test')
 
     def testResource(self):
-
         ob = Ob()
         self.assertEqual(
-            zapi.queryResource('test', Request(IV), None), None)
+            zapi.queryAdapter(Request(IV), name=u'test'), None)
         xmlconfig(StringIO(template % (
-            """
+            '''
             <resource name="test"
                   factory="zope.app.component.tests.views.R1"
                   type="zope.app.component.tests.views.IV"/>
-            """
+            '''
             )))
 
         self.assertEqual(
-            zapi.queryResource('test', Request(IV), None).__class__,
+            zapi.queryAdapter(Request(IV), name=u'test').__class__,
             R1)
 
     def testResourceThatProvidesAnInterface(self):
-
         ob = Ob()
-        self.assertEqual(zapi.queryResource('test', Request(IV), None), None)
+        self.assertEqual(zapi.queryAdapter(Request(IR), IV, u'test'), None)
 
         xmlconfig(StringIO(template %
             '''
@@ -1041,7 +969,7 @@
             '''
             ))
 
-        v = zapi.queryResource('test', Request(IR), None, providing=IV)
+        v = zapi.queryAdapter(Request(IR), IV, name=u'test')
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -1055,14 +983,12 @@
             '''
             ))
 
-        v = zapi.queryResource('test', Request(IR), None, providing=IV)
-
+        v = zapi.queryAdapter(Request(IR), IV, name=u'test')
         self.assertEqual(v.__class__, R1)
 
     def testUnnamedResourceThatProvidesAnInterface(self):
-
         ob = Ob()
-        self.assertEqual(zapi.queryResource('', Request(IV), None), None)
+        self.assertEqual(zapi.queryAdapter(Request(IR), IV), None)
 
         xmlconfig(StringIO(template %
             '''
@@ -1073,7 +999,7 @@
             '''
             ))
 
-        v = zapi.queryResource('', Request(IR), None, providing=IV)
+        v = zapi.queryAdapter(Request(IR), IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -1086,8 +1012,7 @@
             '''
             ))
 
-        v = zapi.queryResource('', Request(IR), None, providing=IV)
-
+        v = zapi.queryAdapter(Request(IR), IV)
         self.assertEqual(v.__class__, R1)
 
     def testResourceUndefinedPermission(self):
@@ -1118,9 +1043,319 @@
         from factory import X
         self.assertEqual(zapi.createObject(None, 'foo.bar').__class__, X)
 
+
+class ParticipationStub(object):
+
+    def __init__(self, principal):
+        self.principal = principal
+        self.interaction = None
+
+
+def configfile(s):
+    return StringIO("""<configure
+      xmlns='http://namespaces.zope.org/zope'
+      i18n_domain='zope'>
+      %s
+      </configure>
+      """ % s)
+
+class TestFactoryDirective(PlacelessSetup, unittest.TestCase):
+    def setUp(self):
+        super(TestFactoryDirective, self).setUp()
+        XMLConfig('meta.zcml', zope.app.component)()
+        XMLConfig('meta.zcml', zope.app.security)()
+
+    def testFactory(self):
+        f = configfile('''
+<permission id="zope.Foo" title="Zope Foo Permission" />
+<content class="zope.app.component.tests.exampleclass.ExampleClass">
+    <factory
+      id="test.Example"
+      title="Example content"
+      description="Example description"
+       />
+</content>''')
+        xmlconfig(f)
+        obj = createObject(None, 'test.Example')
+        self.failUnless(zapi.isinstance(obj, exampleclass.ExampleClass))
+
+
+
+PREFIX = module.__name__ + '.'
+
+def defineDirectives():
+    XMLConfig('meta.zcml', zope.app.component)()
+    XMLConfig('meta.zcml', zope.app.security)()
+    xmlconfig(StringIO("""<configure
+        xmlns='http://namespaces.zope.org/zope'
+        i18n_domain='zope'>
+       <permission id="zope.Extravagant" title="extravagant" />
+       <permission id="zope.Paltry" title="paltry" />
+    </configure>"""))
+
+NOTSET = []
+
+P1 = "zope.Extravagant"
+P2 = "zope.Paltry"
+
+class TestRequireDirective(PlacelessSetup, unittest.TestCase):
+
+    def setUp(self):
+        super(TestRequireDirective, self).setUp()
+        defineDirectives()
+
+        class B(object):
+            def m1(self):
+                return "m1"
+            def m2(self):
+                return "m2"
+        class C(B):
+            implements(module.I)
+            def m3(self):
+                return "m3"
+            def m4(self):
+                return "m4"
+        module.test_base = B
+        module.test_class = C
+        module.test_instance = C()
+        self.assertState()
+
+    def tearDown(self):
+        PlacelessSetup.tearDown(self)
+        module.test_class = None
+
+    def assertState(self, m1P=NOTSET, m2P=NOTSET, m3P=NOTSET):
+        "Verify that class, instance, and methods have expected permissions."
+
+        from zope.security.checker import selectChecker
+
+        checker = selectChecker(module.test_instance)
+        self.assertEqual(checker.permission_id('m1'), (m1P or None))
+        self.assertEqual(checker.permission_id('m2'), (m2P or None))
+        self.assertEqual(checker.permission_id('m3'), (m3P or None))
+
+    def assertDeclaration(self, declaration, **state):
+        apply_declaration(module.template_bracket % declaration)
+        self.assertState(**state)
+
+    # "testSimple*" exercises tags that do NOT have children.  This mode
+    # inherently sets the instances as well as the class attributes.
+
+    def testSimpleMethodsPlural(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                attributes="m1 m3"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1))
+        self.assertDeclaration(declaration, m1P=P1, m3P=P1)
+
+    def assertSetattrState(self, m1P=NOTSET, m2P=NOTSET, m3P=NOTSET):
+        "Verify that class, instance, and methods have expected permissions."
+
+        from zope.security.checker import selectChecker
+
+        checker = selectChecker(module.test_instance)
+        self.assertEqual(checker.setattr_permission_id('m1'), (m1P or None))
+        self.assertEqual(checker.setattr_permission_id('m2'), (m2P or None))
+        self.assertEqual(checker.setattr_permission_id('m3'), (m3P or None))
+
+    def assertSetattrDeclaration(self, declaration, **state):
+        self.assertSetattrState(**state)
+
+    def test_set_attributes(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                set_attributes="m1 m3"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1))
+        apply_declaration(module.template_bracket % declaration)
+        checker = selectChecker(module.test_instance)
+        self.assertEqual(checker.setattr_permission_id('m1'), P1)
+        self.assertEqual(checker.setattr_permission_id('m2'), None)
+        self.assertEqual(checker.setattr_permission_id('m3'), P1)
+
+    def test_set_schema(self):
+
+        self.assertEqual(queryInterface(PREFIX+"S"), None)
+
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                set_schema="%s"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"S"))
+        apply_declaration(module.template_bracket % declaration)
+
+        self.assertEqual(queryInterface(PREFIX+"S"), module.S)
+
+
+        checker = selectChecker(module.test_instance)
+        self.assertEqual(checker.setattr_permission_id('m1'), None)
+        self.assertEqual(checker.setattr_permission_id('m2'), None)
+        self.assertEqual(checker.setattr_permission_id('m3'), None)
+        self.assertEqual(checker.setattr_permission_id('foo'), P1)
+        self.assertEqual(checker.setattr_permission_id('bar'), P1)
+        self.assertEqual(checker.setattr_permission_id('baro'), None)
+
+    def test_multiple_set_schema(self):
+
+        self.assertEqual(queryInterface(PREFIX+"S"), None)
+        self.assertEqual(queryInterface(PREFIX+"S2"), None)
+
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                set_schema="%s %s"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"S", PREFIX+"S2"))
+        apply_declaration(module.template_bracket % declaration)
+
+        self.assertEqual(queryInterface(PREFIX+"S"), module.S)
+        self.assertEqual(queryInterface(PREFIX+"S2"), module.S2)
+
+
+        checker = selectChecker(module.test_instance)
+        self.assertEqual(checker.setattr_permission_id('m1'), None)
+        self.assertEqual(checker.setattr_permission_id('m2'), None)
+        self.assertEqual(checker.setattr_permission_id('m3'), None)
+        self.assertEqual(checker.setattr_permission_id('foo'), P1)
+        self.assertEqual(checker.setattr_permission_id('bar'), P1)
+        self.assertEqual(checker.setattr_permission_id('foo2'), P1)
+        self.assertEqual(checker.setattr_permission_id('bar2'), P1)
+        self.assertEqual(checker.setattr_permission_id('baro'), None)
+
+    def testSimpleInterface(self):
+
+        self.assertEqual(queryInterface(PREFIX+"I"), None)
+
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                interface="%s"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"I"))
+        # m1 and m2 are in the interface, so should be set, and m3 should not:
+        self.assertDeclaration(declaration, m1P=P1, m2P=P1)
+
+        # Make sure we know about the interfaces
+        self.assertEqual(queryInterface(PREFIX+"I"), module.I)
+        
+
+    def testMultipleInterface(self):
+
+        self.assertEqual(queryInterface(PREFIX+"I3"), None)
+        self.assertEqual(queryInterface(PREFIX+"I4"), None)
+
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                interface="  %s
+                                             %s  "/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"I3", PREFIX+"I4"))
+        self.assertDeclaration(declaration, m3P=P1, m2P=P1)
+
+        # Make sure we know about the interfaces
+        self.assertEqual(queryInterface(PREFIX+"I3"), module.I3)
+        self.assertEqual(queryInterface(PREFIX+"I4"), module.I4)
+
+    # "testComposite*" exercises tags that DO have children.
+    # "testComposite*TopPerm" exercises tags with permission in containing tag.
+    # "testComposite*ElementPerm" exercises tags w/permission in children.
+
+    def testCompositeNoPerm(self):
+        # Establish rejection of declarations lacking a permission spec.
+        declaration = ('''<content class="%s">
+                            <require
+                                attributes="m1"/>
+                          </content>'''
+                       % (PREFIX+"test_class"))
+        self.assertRaises(ZopeXMLConfigurationError,
+                          self.assertDeclaration,
+                          declaration)
+
+
+
+    def testCompositeMethodsPluralElementPerm(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                attributes="m1 m3"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1))
+        self.assertDeclaration(declaration,
+                               m1P=P1, m3P=P1)
+
+    def testCompositeInterfaceTopPerm(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                interface="%s"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"I"))
+        self.assertDeclaration(declaration,
+                               m1P=P1, m2P=P1)
+
+
+    def testSubInterfaces(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                interface="%s"/>
+                          </content>'''
+                       % (PREFIX+"test_class", P1, PREFIX+"I2"))
+        # m1 and m2 are in the interface, so should be set, and m3 should not:
+        self.assertDeclaration(declaration, m1P=P1, m2P=P1)
+
+
+    def testMimicOnly(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                attributes="m1 m2"/>
+                          </content>
+                          <content class="%s">
+                            <require like_class="%s" />
+                          </content>
+                          ''' % (PREFIX+"test_base", P1,
+                PREFIX+"test_class", PREFIX+"test_base"))
+        # m1 and m2 are in the interface, so should be set, and m3 should not:
+        self.assertDeclaration(declaration,
+                               m1P=P1, m2P=P1)
+
+
+    def testMimicAsDefault(self):
+        declaration = ('''<content class="%s">
+                            <require
+                                permission="%s"
+                                attributes="m1 m2"/>
+                          </content>
+                          <content class="%s">
+                            <require like_class="%s" />
+                            <require
+                                permission="%s"
+                                attributes="m2 m3"/>
+                          </content>
+                          ''' % (PREFIX+"test_base", P1,
+                PREFIX+"test_class", PREFIX+"test_base", P2))
+
+        # m1 and m2 are in the interface, so should be set, and m3 should not:
+        self.assertDeclaration(declaration,
+                               m1P=P1, m2P=P2, m3P=P2)
+
+
+def apply_declaration(declaration):
+    '''Apply the xmlconfig machinery.'''
+    return xmlconfig(StringIO(declaration))
+
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(Test),
+        unittest.makeSuite(TestFactoryDirective),
+        unittest.makeSuite(TestRequireDirective),
         DocTestSuite(),
         ))
 

Deleted: Zope3/trunk/src/zope/app/component/tests/test_factory.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_factory.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_factory.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,73 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Test handler for 'factory' subdirective of 'content' directive
-
-$Id$
-"""
-import unittest
-from cStringIO import StringIO
-
-from zope.configuration.xmlconfig import xmlconfig
-from zope.configuration.xmlconfig import XMLConfig
-from zope.component import createObject
-from zope.app.tests.placelesssetup import PlacelessSetup
-
-from zope.app import zapi
-import zope.app.security
-import zope.app.component
-
-from zope.app.component.tests.exampleclass import ExampleClass
-
-
-class ParticipationStub(object):
-
-    def __init__(self, principal):
-        self.principal = principal
-        self.interaction = None
-
-
-def configfile(s):
-    return StringIO("""<configure
-      xmlns='http://namespaces.zope.org/zope'
-      i18n_domain='zope'>
-      %s
-      </configure>
-      """ % s)
-
-class Test(PlacelessSetup, unittest.TestCase):
-    def setUp(self):
-        super(Test, self).setUp()
-        XMLConfig('meta.zcml', zope.app.component)()
-        XMLConfig('meta.zcml', zope.app.security)()
-
-    def testFactory(self):
-        f = configfile('''
-<permission id="zope.Foo" title="Zope Foo Permission" />
-<content class="zope.app.component.tests.exampleclass.ExampleClass">
-    <factory
-      id="test.Example"
-      title="Example content"
-      description="Example description"
-       />
-</content>''')
-        xmlconfig(f)
-        obj = createObject(None, 'test.Example')
-        self.failUnless(zapi.isinstance(obj, ExampleClass))
-
-def test_suite():
-    loader=unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())

Modified: Zope3/trunk/src/zope/app/component/tests/test_fields.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_fields.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_fields.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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((

Deleted: Zope3/trunk/src/zope/app/component/tests/test_localservice.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_localservice.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_localservice.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,274 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test local service code
-
-$Id$
-"""
-import unittest
-from zope.component import getGlobalServices
-from zope.app.component.hooks import getServices_hook
-from zope.app.component.localservice import serviceServiceAdapter
-from zope.app.site.interfaces import IPossibleSite, ISite, ISiteManager
-from zope.app.traversing.interfaces import IContainmentRoot
-from zope.component.exceptions import ComponentLookupError
-from zope.component.interfaces import IServiceService
-from zope.component.service import serviceManager
-from zope.interface import implements, directlyProvides, directlyProvidedBy
-from zope.interface.verify import verifyObject
-from zope.testing import doctest
-
-from zope.app.tests.setup import placelessSetUp, placelessTearDown
-from zope.app.tests import ztapi
-from zope.app.component.hooks import setSite, getSite
-
-class ServiceManager(object):
-    implements(ISiteManager)
-
-    def __init__(self):
-        self.dummy_service = object()
-
-    def getService(self, name):
-        if name == 'dummy':
-            return self.dummy_service
-        raise ComponentLookupError(name)
-
-class Folder(object):
-    implements(IPossibleSite)
-
-    sm = None
-
-    def getSiteManager(self, default=None):
-        return self.sm
-
-    def setSiteManager(self, sm):
-        self.sm = sm
-        sm.__parent__ = self
-        directlyProvides(self, ISite, directlyProvidedBy(self))
-
-class Package(object):
-    pass
-
-class Root(Folder):
-    implements(IContainmentRoot, ISite)
-    def getSiteManager(self):
-        return getGlobalServices()
-
-class ServiceServiceStub(object):
-    implements(IServiceService)
-
-
-def Wrapper(ob, container):
-    ob.__parent__ = container
-    return ob
-
-class Test(unittest.TestCase):
-
-    def setUp(self):
-        unittest.TestCase.setUp(self)
-        placelessSetUp()
-        root = Root()
-
-        f1 = Wrapper(Folder(), root)
-        sm1 = ServiceManager()
-        f1.setSiteManager(sm1)
-        p1 = Wrapper(Package(), sm1)
-
-        f2 = Wrapper(Folder(), f1)
-        sm2 = ServiceManager()
-        f2.setSiteManager(sm2)
-        p2 = Wrapper(Package(), sm2)
-
-        sm1.next = serviceManager
-        sm2.next = sm1
-
-        self.root = root
-        self.f1 = f1
-        self.f2 = f2
-        self.sm1 = sm1
-        self.sm2 = sm2
-        self.p1 = p1
-        self.p2 = p2
-        self.unparented_folder = Folder()
-        self.unrooted_subfolder = Wrapper(Folder(), self.unparented_folder)
-
-        ztapi.provideAdapter(None, IServiceService, serviceServiceAdapter)
-
-    def tearDown(self):
-        setSite()
-        placelessTearDown()
-
-    def test_getServices(self):
-        self.assertEqual(getServices_hook(None), serviceManager)
-        self.assertEqual(getServices_hook(self.root), serviceManager)
-        self.assertEqual(getServices_hook(self.f1), self.sm1)
-        self.assertEqual(getServices_hook(self.f2), self.sm2)
-        setSite(self.f2)
-        self.assertEqual(getServices_hook(None), self.sm2)
-
-    def test_queryNextService(self):
-        from zope.app.component.localservice import queryNextService
-        self.assert_(queryNextService(self.sm2, 'dummy') is
-                     self.sm1.dummy_service)
-        self.assert_(queryNextService(self.p2, 'dummy') is
-                     self.sm1.dummy_service)
-        marker = object()
-        self.assert_(queryNextService(self.p1, 'dummy', marker) is marker)
-
-    def test_getNextService(self):
-        from zope.app.component.localservice import getNextService
-        self.assert_(getNextService(self.sm2, 'dummy') is
-                     self.sm1.dummy_service)
-        self.assert_(getNextService(self.p2, 'dummy') is
-                     self.sm1.dummy_service)
-        self.assertRaises(ComponentLookupError,
-                          getNextService, self.p1, 'dummy')
-
-
-    def test_queryNextServices(self):
-        from zope.app.component.localservice import queryNextServices
-        marker = object()
-        self.assert_(queryNextServices(self.root, marker) is marker)
-        self.assert_(queryNextServices(self.f1, marker) is marker)
-        self.assert_(queryNextServices(self.f2, marker) is marker)
-        self.assertEqual(queryNextServices(self.sm1), serviceManager)
-        self.assertEqual(queryNextServices(self.sm2), self.sm1)
-        self.assertEqual(queryNextServices(self.p1), serviceManager)
-        self.assertEqual(queryNextServices(self.p2), self.sm1)
-
-        self.assert_(queryNextServices(self.unparented_folder, marker)
-                     is marker)
-        self.assert_(queryNextServices(self.unrooted_subfolder, marker)
-                     is marker)
-
-    def test_getNextServices(self):
-        from zope.app.component.localservice import getNextServices
-        self.assertRaises(ComponentLookupError,
-                          getNextServices, self.root)
-        self.assertRaises(ComponentLookupError,
-                          getNextServices, self.f1)
-        self.assertRaises(ComponentLookupError,
-                          getNextServices, self.f2)
-        self.assertEqual(getNextServices(self.sm1), serviceManager)
-        self.assertEqual(getNextServices(self.sm2), self.sm1)
-        self.assertEqual(getNextServices(self.p1), serviceManager)
-        self.assertEqual(getNextServices(self.p2), self.sm1)
-
-        self.assertRaises(ComponentLookupError,
-                          getNextServices, self.unparented_folder)
-        self.assertRaises(ComponentLookupError,
-                          getNextServices, self.unrooted_subfolder)
-
-    def test_getNextServices_security(self):
-        from zope.app.component.localservice import getNextServices
-        from zope.security.checker import ProxyFactory, NamesChecker
-        sm = ProxyFactory(self.sm1, NamesChecker(('next',)))
-        # Check that serviceManager is not proxied
-        self.assert_(getNextServices(sm) is serviceManager)
-
-    def test_queryLocalServices(self):
-        from zope.app.component.localservice import queryLocalServices
-        marker = object()
-        self.assert_(queryLocalServices(self.root, marker) is marker)
-        self.assert_(queryLocalServices(self.f1, marker) is marker)
-        self.assert_(queryLocalServices(self.f2, marker) is marker)
-        self.assertEqual(queryLocalServices(self.sm1), self.sm1)
-        self.assertEqual(queryLocalServices(self.sm2), self.sm2)
-        self.assertEqual(queryLocalServices(self.p1), self.sm1)
-        self.assertEqual(queryLocalServices(self.p2), self.sm2)
-
-        self.assert_(queryLocalServices(self.unparented_folder, marker)
-                     is marker)
-        self.assert_(queryLocalServices(self.unrooted_subfolder, marker)
-                     is marker)
-
-    def test_getLocalServices(self):
-        from zope.app.component.localservice import getLocalServices
-        self.assertRaises(ComponentLookupError,
-                          getLocalServices, self.root)
-        self.assertRaises(ComponentLookupError,
-                          getLocalServices, self.f1)
-        self.assertRaises(ComponentLookupError,
-                          getLocalServices, self.f2)
-        self.assertEqual(getLocalServices(self.sm1), self.sm1)
-        self.assertEqual(getLocalServices(self.sm2), self.sm2)
-        self.assertEqual(getLocalServices(self.p1), self.sm1)
-        self.assertEqual(getLocalServices(self.p2), self.sm2)
-
-        unparented_folder = Folder()
-        self.assertRaises(ComponentLookupError,
-                          getLocalServices, unparented_folder)
-        unrooted_subfolder = Wrapper(Folder(), unparented_folder)
-        self.assertRaises(ComponentLookupError,
-                          getLocalServices, unrooted_subfolder)
-
-    def test_serviceServiceAdapter(self):
-        from zope.app.component.localservice import serviceServiceAdapter
-
-        # If it is a site, return the service service.
-        ss = ServiceServiceStub()
-        site = Folder()
-        site.setSiteManager(ss)
-        self.assertEqual(serviceServiceAdapter(site), ss)
-
-        # If it is locatable (has __parent__), "acquire" the site
-        # and return the service service
-        ob = Folder()
-        ob.__parent__ = site
-        self.assertEqual(serviceServiceAdapter(ob), ss)
-        ob2 = Folder()
-        ob2.__parent__ = ob
-        self.assertEqual(serviceServiceAdapter(ob2), ss)
-
-        # If it does we are unable to find a service service, raise
-        # ComponentLookupError
-        orphan = Folder()
-        self.assertRaises(ComponentLookupError, serviceServiceAdapter, orphan)
-
-    def test_setThreadSite_clearThreadSite(self):
-        from zope.app.component.localservice import threadSiteSubscriber
-        from zope.app.component.localservice import clearSite
-        from zope.app.publication.zopepublication import BeforeTraverseEvent
-
-        self.assertEqual(getSite(), None)
-
-        # A non-site is traversed
-        ob = object()
-        request = object()
-        ev = BeforeTraverseEvent(ob, request)
-        threadSiteSubscriber(ev)
-
-        self.assertEqual(getSite(), None)
-
-        # A site is traversed
-        ss = ServiceServiceStub()
-        site = Folder()
-        site.setSiteManager(ss)
-
-        ev = BeforeTraverseEvent(site, request)
-        threadSiteSubscriber(ev)
-
-        self.assertEqual(getSite(), site)
-
-        clearSite()
-
-        self.assertEqual(getSite(), None)
-
-
-def test_suite():
-    suite = unittest.makeSuite(Test)
-    suite.addTest(doctest.DocTestSuite('zope.app.component.localservice'))
-    return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Copied: Zope3/trunk/src/zope/app/component/tests/test_registration.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_registration.py)

Deleted: Zope3/trunk/src/zope/app/component/tests/test_requirepermissions.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_requirepermissions.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_requirepermissions.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,308 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test handler for 'require' subdirective of 'content' directive
-
-$Id$
-"""
-from cStringIO import StringIO
-import unittest
-
-import zope.app.component
-import zope.app.security
-
-from zope.app.component.interface import queryInterface
-from zope.app.component.tests import module
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.security.checker import selectChecker
-from zope.interface import implements
-
-# So we can use config parser to exercise protectClass stuff.
-from zope.configuration.xmlconfig import XMLConfig
-from zope.configuration.xmlconfig import xmlconfig, ZopeXMLConfigurationError
-
-PREFIX = module.__name__ + '.'
-
-def defineDirectives():
-    XMLConfig('meta.zcml', zope.app.component)()
-    XMLConfig('meta.zcml', zope.app.security)()
-    xmlconfig(StringIO("""<configure
-        xmlns='http://namespaces.zope.org/zope'
-        i18n_domain='zope'>
-       <permission id="zope.Extravagant" title="extravagant" />
-       <permission id="zope.Paltry" title="paltry" />
-    </configure>"""))
-
-NOTSET = []
-
-P1 = "zope.Extravagant"
-P2 = "zope.Paltry"
-
-class Test(PlacelessSetup, unittest.TestCase):
-
-    def setUp(self):
-        super(Test, self).setUp()
-        defineDirectives()
-
-        class B(object):
-            def m1(self):
-                return "m1"
-            def m2(self):
-                return "m2"
-        class C(B):
-            implements(module.I)
-            def m3(self):
-                return "m3"
-            def m4(self):
-                return "m4"
-        module.test_base = B
-        module.test_class = C
-        module.test_instance = C()
-        self.assertState()
-
-    def tearDown(self):
-        PlacelessSetup.tearDown(self)
-        module.test_class = None
-
-    def assertState(self, m1P=NOTSET, m2P=NOTSET, m3P=NOTSET):
-        "Verify that class, instance, and methods have expected permissions."
-
-        from zope.security.checker import selectChecker
-
-        checker = selectChecker(module.test_instance)
-        self.assertEqual(checker.permission_id('m1'), (m1P or None))
-        self.assertEqual(checker.permission_id('m2'), (m2P or None))
-        self.assertEqual(checker.permission_id('m3'), (m3P or None))
-
-    def assertDeclaration(self, declaration, **state):
-        apply_declaration(module.template_bracket % declaration)
-        self.assertState(**state)
-
-    # "testSimple*" exercises tags that do NOT have children.  This mode
-    # inherently sets the instances as well as the class attributes.
-
-    def testSimpleMethodsPlural(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                attributes="m1 m3"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1))
-        self.assertDeclaration(declaration, m1P=P1, m3P=P1)
-
-    def assertSetattrState(self, m1P=NOTSET, m2P=NOTSET, m3P=NOTSET):
-        "Verify that class, instance, and methods have expected permissions."
-
-        from zope.security.checker import selectChecker
-
-        checker = selectChecker(module.test_instance)
-        self.assertEqual(checker.setattr_permission_id('m1'), (m1P or None))
-        self.assertEqual(checker.setattr_permission_id('m2'), (m2P or None))
-        self.assertEqual(checker.setattr_permission_id('m3'), (m3P or None))
-
-    def assertSetattrDeclaration(self, declaration, **state):
-        self.assertSetattrState(**state)
-
-    def test_set_attributes(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                set_attributes="m1 m3"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1))
-        apply_declaration(module.template_bracket % declaration)
-        checker = selectChecker(module.test_instance)
-        self.assertEqual(checker.setattr_permission_id('m1'), P1)
-        self.assertEqual(checker.setattr_permission_id('m2'), None)
-        self.assertEqual(checker.setattr_permission_id('m3'), P1)
-
-    def test_set_schema(self):
-
-        self.assertEqual(queryInterface(PREFIX+"S"), None)
-
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                set_schema="%s"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"S"))
-        apply_declaration(module.template_bracket % declaration)
-
-        self.assertEqual(queryInterface(PREFIX+"S"), module.S)
-
-
-        checker = selectChecker(module.test_instance)
-        self.assertEqual(checker.setattr_permission_id('m1'), None)
-        self.assertEqual(checker.setattr_permission_id('m2'), None)
-        self.assertEqual(checker.setattr_permission_id('m3'), None)
-        self.assertEqual(checker.setattr_permission_id('foo'), P1)
-        self.assertEqual(checker.setattr_permission_id('bar'), P1)
-        self.assertEqual(checker.setattr_permission_id('baro'), None)
-
-    def test_multiple_set_schema(self):
-
-        self.assertEqual(queryInterface(PREFIX+"S"), None)
-        self.assertEqual(queryInterface(PREFIX+"S2"), None)
-
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                set_schema="%s %s"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"S", PREFIX+"S2"))
-        apply_declaration(module.template_bracket % declaration)
-
-        self.assertEqual(queryInterface(PREFIX+"S"), module.S)
-        self.assertEqual(queryInterface(PREFIX+"S2"), module.S2)
-
-
-        checker = selectChecker(module.test_instance)
-        self.assertEqual(checker.setattr_permission_id('m1'), None)
-        self.assertEqual(checker.setattr_permission_id('m2'), None)
-        self.assertEqual(checker.setattr_permission_id('m3'), None)
-        self.assertEqual(checker.setattr_permission_id('foo'), P1)
-        self.assertEqual(checker.setattr_permission_id('bar'), P1)
-        self.assertEqual(checker.setattr_permission_id('foo2'), P1)
-        self.assertEqual(checker.setattr_permission_id('bar2'), P1)
-        self.assertEqual(checker.setattr_permission_id('baro'), None)
-
-    def testSimpleInterface(self):
-
-        self.assertEqual(queryInterface(PREFIX+"I"), None)
-
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                interface="%s"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"I"))
-        # m1 and m2 are in the interface, so should be set, and m3 should not:
-        self.assertDeclaration(declaration, m1P=P1, m2P=P1)
-
-        # Make sure we know about the interfaces
-        self.assertEqual(queryInterface(PREFIX+"I"), module.I)
-        
-
-    def testMultipleInterface(self):
-
-        self.assertEqual(queryInterface(PREFIX+"I3"), None)
-        self.assertEqual(queryInterface(PREFIX+"I4"), None)
-
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                interface="  %s
-                                             %s  "/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"I3", PREFIX+"I4"))
-        self.assertDeclaration(declaration, m3P=P1, m2P=P1)
-
-        # Make sure we know about the interfaces
-        self.assertEqual(queryInterface(PREFIX+"I3"), module.I3)
-        self.assertEqual(queryInterface(PREFIX+"I4"), module.I4)
-
-    # "testComposite*" exercises tags that DO have children.
-    # "testComposite*TopPerm" exercises tags with permission in containing tag.
-    # "testComposite*ElementPerm" exercises tags w/permission in children.
-
-    def testCompositeNoPerm(self):
-        # Establish rejection of declarations lacking a permission spec.
-        declaration = ("""<content class="%s">
-                            <require
-                                attributes="m1"/>
-                          </content>"""
-                       % (PREFIX+"test_class"))
-        self.assertRaises(ZopeXMLConfigurationError,
-                          self.assertDeclaration,
-                          declaration)
-
-
-
-    def testCompositeMethodsPluralElementPerm(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                attributes="m1 m3"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1))
-        self.assertDeclaration(declaration,
-                               m1P=P1, m3P=P1)
-
-    def testCompositeInterfaceTopPerm(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                interface="%s"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"I"))
-        self.assertDeclaration(declaration,
-                               m1P=P1, m2P=P1)
-
-
-    def testSubInterfaces(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                interface="%s"/>
-                          </content>"""
-                       % (PREFIX+"test_class", P1, PREFIX+"I2"))
-        # m1 and m2 are in the interface, so should be set, and m3 should not:
-        self.assertDeclaration(declaration, m1P=P1, m2P=P1)
-
-
-    def testMimicOnly(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                attributes="m1 m2"/>
-                          </content>
-                          <content class="%s">
-                            <require like_class="%s" />
-                          </content>
-                          """ % (PREFIX+"test_base", P1,
-                PREFIX+"test_class", PREFIX+"test_base"))
-        # m1 and m2 are in the interface, so should be set, and m3 should not:
-        self.assertDeclaration(declaration,
-                               m1P=P1, m2P=P1)
-
-
-    def testMimicAsDefault(self):
-        declaration = ("""<content class="%s">
-                            <require
-                                permission="%s"
-                                attributes="m1 m2"/>
-                          </content>
-                          <content class="%s">
-                            <require like_class="%s" />
-                            <require
-                                permission="%s"
-                                attributes="m2 m3"/>
-                          </content>
-                          """ % (PREFIX+"test_base", P1,
-                PREFIX+"test_class", PREFIX+"test_base", P2))
-
-        # m1 and m2 are in the interface, so should be set, and m3 should not:
-        self.assertDeclaration(declaration,
-                               m1P=P1, m2P=P2, m3P=P2)
-
-
-def apply_declaration(declaration):
-    """Apply the xmlconfig machinery."""
-    return xmlconfig(StringIO(declaration))
-
-def test_suite():
-    loader=unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())

Deleted: Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_servicedirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,196 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Service Directive Tests
-
-$Id$
-"""
-import unittest
-from cStringIO import StringIO
-
-from zope.security.interfaces import Forbidden, Unauthorized
-
-from zope.configuration.xmlconfig import testxmlconfig as xmlconfig, XMLConfig
-from zope.configuration.config import ConfigurationConflictError
-from zope.security.proxy import ProxyFactory
-from zope.component.exceptions import ComponentLookupError
-
-import zope.app.component
-from zope.component import getService
-from zope.app.tests.placelesssetup import PlacelessSetup
-
-
-class ParticipationStub(object):
-
-    def __init__(self, principal):
-        self.principal = principal
-        self.interaction = None
-
-
-# TODO: tests for other directives needed
-
-template = """<configure
-   xmlns='http://namespaces.zope.org/zope'
-   xmlns:test='http://www.zope.org/NS/Zope3/test'
-   i18n_domain='zope'>
-   %s
-   </configure>"""
-
-class Test(PlacelessSetup, unittest.TestCase):
-
-
-    def setUp(self):
-        super(Test, self).setUp()
-        XMLConfig('meta.zcml', zope.app.component)()
-
-    def testServiceConfigNoType(self):
-        from zope.component.service \
-             import UndefinedService
-        self.assertRaises(
-            UndefinedService,
-            xmlconfig,
-            StringIO(template % (
-            '''
-            <service
-                serviceType="Foo"
-                component="zope.app.component.tests.service.fooService"
-                />
-            '''
-            )))
-
-    def testDuplicateServiceConfig(self):
-        self.assertRaises(
-            ConfigurationConflictError,
-            xmlconfig,
-            StringIO(template % (
-            '''
-            <serviceType
-                id="Foo"
-                interface="zope.app.component.tests.service.IFooService"
-                />
-            <service
-              serviceType="Foo"
-              component="zope.app.component.tests.service.fooService"
-              />
-            <service
-              serviceType="Foo"
-              component="zope.app.component.tests.service.foo2"
-              />
-            '''
-            )))
-
-    def testServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, "Foo")
-
-        xmlconfig(StringIO(template % (
-            '''
-            <serviceType
-                id="Foo"
-                interface="zope.app.component.tests.service.IFooService"
-                />
-            <service
-                serviceType="Foo"
-                component="zope.app.component.tests.service.fooService"
-                />
-            '''
-            )))
-
-        service = getService("Foo")
-        self.assertEqual(service.foo(), "foo here")
-        self.assertEqual(service.foobar(), "foobarred")
-        self.assertEqual(service.bar(), "you shouldn't get this")
-
-    def testServiceFactoryConfig(self):
-        self.assertRaises(ComponentLookupError, getService, "Foo")
-
-        xmlconfig(StringIO(template % (
-            '''
-            <serviceType
-                id="Foo"
-                interface="zope.app.component.tests.service.IFooService"
-                />
-            <service
-                serviceType="Foo"
-                factory="zope.app.component.tests.service.FooService"
-                />
-            '''
-            )))
-
-        service = getService("Foo")
-        self.assertEqual(service.foo(), "foo here")
-        self.assertEqual(service.foobar(), "foobarred")
-        self.assertEqual(service.bar(), "you shouldn't get this")
-
-    def testPublicProtectedServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, "Foo")
-
-        xmlconfig(StringIO(template % (
-            '''
-            <serviceType
-                id="Foo"
-                interface="zope.app.component.tests.service.IFooService"
-                />
-            <service
-                serviceType="Foo"
-                component="zope.app.component.tests.service.fooService"
-                permission="zope.Public"
-                />
-            '''
-            )))
-
-        service = getService("Foo")
-        service = ProxyFactory(service) # simulate untrusted code!
-        self.assertEqual(service.foo(), "foo here")
-        self.assertEqual(service.foobar(), "foobarred")
-        self.assertRaises(Forbidden, getattr, service, 'bar')
-
-    def testProtectedServiceConfig(self):
-        self.assertRaises(ComponentLookupError, getService, "Foo")
-
-        xmlconfig(StringIO(template % (
-            '''
-            <include package="zope.app.security" file="meta.zcml" />
-
-            <permission id="zope.TestPermission" title="Test permission" />
-
-            <serviceType
-                id="Foo"
-                interface="zope.app.component.tests.service.IFooService"
-                />
-            <service
-                serviceType="Foo"
-                component="zope.app.component.tests.service.fooService"
-                permission="zope.TestPermission"
-                />
-            '''
-            )))
-
-        # Need to "log someone in" to turn on checks
-        from zope.security.management import newInteraction, endInteraction
-        endInteraction()
-        newInteraction(ParticipationStub('someuser'))
-
-        service = getService("Foo")
-        service = ProxyFactory(service) # simulate untrusted code!
-
-        self.assertRaises(Unauthorized, getattr, service, 'foo')
-        self.assertRaises(Unauthorized, getattr, service, 'foobar')
-        self.assertRaises(Forbidden, getattr, service, 'bar')
-
-
-def test_suite():
-    loader=unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())

Deleted: Zope3/trunk/src/zope/app/component/tests/test_servicemanagercontainer.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_servicemanagercontainer.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/test_servicemanagercontainer.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,83 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Service Manager Container Tests
-
-$Id$
-"""
-from unittest import TestCase, main, makeSuite
-from zope.component.interfaces import IServiceService
-from zope.app.site.interfaces import IPossibleSite, ISite
-from zope.component.exceptions import ComponentLookupError
-from zope.interface.verify import verifyObject
-from zope.interface import implements
-
-class ServiceManager(object):
-
-    implements(IServiceService)
-
-    ############################################################
-    # Implementation methods for interface
-    # IServiceService.
-
-    def getService(self, object, name):
-        '''See interface IServiceService'''
-        raise ComponentLookupError(name)
-
-    def getServiceDefinitions(self):
-        '''See interface IServiceService'''
-        return ()
-
-    #
-    ############################################################
-
-class BaseTestServiceManagerContainer(object):
-
-    """This test is for objects that don't have service managers by
-    default and that always give back the service manager they were
-    given.
-
-
-    Subclasses need to define a method, 'makeTestObject', that takes no
-    arguments and that returns a new service manager
-    container that has no service manager."""
-
-    def test_IPossibleSite_verify(self):
-        verifyObject(IPossibleSite, self.makeTestObject())
-
-    def test_get_and_set(self):
-        smc = self.makeTestObject()
-        self.failIf(ISite.providedBy(smc))
-        sm = ServiceManager()
-        smc.setSiteManager(sm)
-        self.failUnless(ISite.providedBy(smc))
-        self.failUnless(smc.getSiteManager() is sm)
-        verifyObject(ISite, smc)
-
-    def test_set_w_bogus_value(self):
-        smc=self.makeTestObject()
-        self.assertRaises(Exception, smc.setSiteManager, self)
-
-
-
-class Test(BaseTestServiceManagerContainer, TestCase):
-    def makeTestObject(self):
-        from zope.app.site.servicecontainer import ServiceManagerContainer
-        return ServiceManagerContainer()
-
-
-def test_suite():
-    return makeSuite(Test)
-
-if __name__=='__main__':
-    main(defaultTest='test_suite')

Copied: Zope3/trunk/src/zope/app/component/tests/test_site.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/tests/test_site.py)

Modified: Zope3/trunk/src/zope/app/component/tests/views.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/views.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/component/tests/views.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Views test.
 
-$Id$
+$Id: views.py 26551 2004-07-15 07:06:37Z srichter $
 """
 from zope.interface import Interface, implements
 


Property changes on: Zope3/trunk/src/zope/app/component/tests/views.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Copied: Zope3/trunk/src/zope/app/component/vocabulary.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/component/vocabulary.py)


Property changes on: Zope3/trunk/src/zope/app/component/vocabulary.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.5
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -43,20 +43,12 @@
 
   <include package="zope.app.i18n" />
 
-
-  <!-- Local Component Registration -->
-  <include package="zope.app.registration" />
-
-
   <!-- Database boostrapping and maintanance -->
   <include package=".appsetup" />
   <include package=".zopeappgenerations" />
 
   <!-- Services -->
   <include package="zope.app.pluggableauth" />
-  <include package="zope.app.site" />
-  <include package="zope.app.adapter" />
-  <include package="zope.app.utility" />
   <include package="zope.app.principalannotation" />
 
   <!-- Utilities -->

Modified: Zope3/trunk/src/zope/app/container/browser/adding.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/adding.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/adding.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -24,7 +24,6 @@
 import zope.security.checker
 from zope.component.interfaces import IFactory
 from zope.event import notify
-from zope.i18n import translate
 from zope.interface import implements
 from zope.publisher.interfaces import IPublishTraverse
 from zope.security.proxy import removeSecurityProxy
@@ -78,8 +77,7 @@
 
     def nextURL(self):
         """See zope.app.container.interfaces.IAdding"""
-        return (str(zapi.getView(self.context, "absolute_url", self.request))
-                + '/@@contents.html')
+        return zapi.absoluteURL(self.context, self.request) + '/@@contents.html'
 
     # set in BrowserView.__init__
     request = None
@@ -98,14 +96,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,10 +125,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),
-                type_name, id)
+                zapi.absoluteURL(self, self.request), type_name, id)
             self.request.response.redirect(url)
             return
 

Modified: Zope3/trunk/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/contents.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/contents.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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:
@@ -222,7 +222,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):
@@ -232,7 +232,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/trunk/src/zope/app/container/browser/find.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/find.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/find.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,10 +17,10 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.app import zapi
 from zope.app.container.find import SimpleIdFindFilter
 from zope.app.container.interfaces import IFind
 from zope.app.traversing.api import getName
-from zope.component import getView
 from zope.app.publisher.browser import BrowserView
 
 # Very simple implementation right now
@@ -36,6 +36,6 @@
         request = self.request
         result = []
         for object in finder.find([SimpleIdFindFilter(ids)]):
-            url = str(getView(object, 'absolute_url', request))
+            url = zapi.absoluteURL(object, request)
             result.append({ 'id': getName(object), 'url': url})
         return result

Modified: Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/ftests/test_contents.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,15 +20,14 @@
 
 from persistent import Persistent
 from transaction import get_transaction
-from zope.app.tests.functional import BrowserTestCase
 from zope.interface import implements
 
-from zope.app import zapi
 from zope.app.annotation.interfaces import IAttributeAnnotatable
 from zope.app.container.interfaces import IReadContainer, IContained
 from zope.app.dublincore.interfaces import IZopeDublinCore
+from zope.app.testing.functional import BrowserTestCase
+from zope.app.testing.functional import FunctionalDocFileSuite
 
-from zope.app.tests.functional import FunctionalDocFileSuite
 
 class File(Persistent):
     implements(IAttributeAnnotatable)

Modified: Zope3/trunk/src/zope/app/container/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -61,8 +61,8 @@
         required=False
         )
 
-
-def containerViews(_context, for_, contents=None, add=None, index=None, layer=IDefaultBrowserLayer):
+def containerViews(_context, for_, contents=None, add=None, index=None,
+                   layer=IDefaultBrowserLayer):
     """Set up container views for a given content type."""
 
     if for_ is None:

Modified: Zope3/trunk/src/zope/app/container/browser/tests/test_adding.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/tests/test_adding.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/tests/test_adding.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -28,9 +28,10 @@
 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.browser.interfaces import IAbsoluteURL
 from zope.app.traversing.interfaces import IContainmentRoot
 from zope.app.exception.interfaces import UserError
 from zope.app.publisher.browser import BrowserView
@@ -80,11 +81,12 @@
         if IContainmentRoot.providedBy(self.context):
             return ''
         name = self.context.__name__
-        url = str(zapi.getView(
-            zapi.getParent(self.context), 'absolute_url', self.request))
+        url = zapi.absoluteURL(zapi.getParent(self.context), self.request)
         url += '/' + name
         return url
 
+    __call__ = __str__
+
 def defineMenuItem(menuItemType, for_, action, title=u'', extra=None):
     newclass = type(title, (BrowserMenuItem,),
                     {'title':title, 'action':action,
@@ -183,6 +185,7 @@
         adding.__name__ = '+'
         ztapi.browserView(IAdding, "Thing", CreationView)
         ztapi.browserView(Interface, "absolute_url", AbsoluteURL)
+        ztapi.browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
         self.assertRaises(UserError, adding.action, '', 'foo')
         adding.action('Thing', 'foo')
         self.assertEqual(adding.request.response._headers['location'],

Modified: Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/tests/test_contents.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,30 +16,25 @@
 $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.interfaces import IContainerItemRenamer
-
-from zope.app.copypastemove import ObjectMover, ObjectCopier
-from zope.app.copypastemove import ContainerItemRenamer
-
-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.copypastemove import ContainerItemRenamer
+from zope.app.copypastemove import ObjectMover, ObjectCopier
 from zope.app.copypastemove import PrincipalClipboard
-from zope.component import getGlobalServices
+from zope.app.copypastemove.interfaces import IContainerItemRenamer
+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
 from zope.app.container.interfaces import IContainer, IContained
 
+
 class BaseTestContentsBrowserView(PlacefulSetup):
     """Base class for testing browser contents.
 

Modified: Zope3/trunk/src/zope/app/container/browser/tests/test_directive.py
===================================================================
--- Zope3/trunk/src/zope/app/container/browser/tests/test_directive.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/browser/tests/test_directive.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -69,8 +69,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>,
@@ -98,8 +97,7 @@
        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
        <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -116,8 +114,7 @@
        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
        <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -130,8 +127,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>,
@@ -162,8 +158,7 @@
        '+',
        <InterfaceClass zope.interface.Interface>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -191,8 +186,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>,
@@ -220,8 +214,7 @@
        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -238,8 +231,7 @@
        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -252,8 +244,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>,
@@ -284,8 +275,7 @@
        '+',
        <InterfaceClass zope.interface.Interface>),
       <function handler>,
-      ('Adapters',
-       'register',
+      ('provideAdapter',
        (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
         <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
        <InterfaceClass zope.interface.Interface>,
@@ -294,6 +284,123 @@
        'info')))
     """
 
+def test_containerViews_layer():
+    """
+    >>> from zope.app.publisher.browser.menu import menus
+    >>> from zope.interface.interface import InterfaceClass
+    >>> zmi_views = InterfaceClass('zmi_views', __module__='zope.app.menus')
+    >>> menus.zmi_views = zmi_views
+    >>> zmi_actions = InterfaceClass('zmi_actions', __module__='zope.app.menus')
+    >>> menus.zmi_actions = zmi_actions
+
+    >>> context = Context()
+    >>> containerViews(context, for_=I, contents='zope.ManageContent',
+    ...                add='zope.ManageContent', index='zope.View', layer=ITestLayer)
+    >>> context
+    ((('adapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
+       <InterfaceClass zope.app.menus.zmi_views>,
+       u'Contents'),
+      <function handler>,
+      ('provideAdapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
+       <InterfaceClass zope.app.menus.zmi_views>,
+       u'Contents',
+       <zope.app.publisher.browser.menu.MenuItemFactory object>,
+       '')),
+     (None,
+      <function provideInterface>,
+      ('', <InterfaceClass zope.app.menus.zmi_views>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>)),
+     (('view',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+       'contents.html',
+       <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
+       <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+      <function handler>,
+      ('provideAdapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+       <InterfaceClass zope.interface.Interface>,
+       'contents.html',
+       <class 'zope.app.publisher.browser.viewmeta.Contents'>,
+       'info')),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>)),
+     (('view',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+       'index.html',
+       <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>,
+       <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+      <function handler>,
+      ('provideAdapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+       <InterfaceClass zope.interface.Interface>,
+       'index.html',
+       <class 'zope.app.publisher.browser.viewmeta.Contents'>,
+       'info')),
+     (('adapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
+       <InterfaceClass zope.app.menus.zmi_actions>,
+       u'Add'),
+      <function handler>,
+      ('provideAdapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>),
+       <InterfaceClass zope.app.menus.zmi_actions>,
+       u'Add',
+       <zope.app.publisher.browser.menu.MenuItemFactory object>,
+       'info')),
+     (None,
+      <function provideInterface>,
+      ('', <InterfaceClass zope.app.menus.zmi_actions>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest>)),
+     (None,
+      <function provideInterface>,
+      ('',
+       <InterfaceClass zope.app.container.browser.tests.test_directive.I>)),
+     (None,
+      <function provideInterface>,
+      ('', <InterfaceClass zope.interface.Interface>)),
+     (('view',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+       '+',
+       <InterfaceClass zope.interface.Interface>),
+      <function handler>,
+      ('provideAdapter',
+       (<InterfaceClass zope.app.container.browser.tests.test_directive.I>,
+        <InterfaceClass zope.app.container.browser.tests.test_directive.ITestLayer>),
+       <InterfaceClass zope.interface.Interface>,
+       '+',
+       <class 'zope.app.publisher.browser.viewmeta.+'>,
+       'info')))
+    """
+
 def test_suite():
     return unittest.TestSuite((
         DocTestSuite(),

Modified: Zope3/trunk/src/zope/app/container/constraints.py
===================================================================
--- Zope3/trunk/src/zope/app/container/constraints.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/constraints.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -153,7 +153,6 @@
 
 import sys
 
-import zope.interface.advice
 import zope.schema
 
 from zope.interface import providedBy

Modified: Zope3/trunk/src/zope/app/container/contained.py
===================================================================
--- Zope3/trunk/src/zope/app/container/contained.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/contained.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -30,7 +30,7 @@
 from zope.app.event.objectevent import ObjectEvent, modified
 from zope.event import notify
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.container.interfaces import IContained, IReadContainer
+from zope.app.container.interfaces import IContained
 from zope.app.container.interfaces import INameChooser
 from zope.app.container.interfaces import IObjectAddedEvent
 from zope.app.container.interfaces import IObjectMovedEvent
@@ -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/trunk/src/zope/app/container/ftests/test_view_permissions.py
===================================================================
--- Zope3/trunk/src/zope/app/container/ftests/test_view_permissions.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/ftests/test_view_permissions.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,7 @@
 
 from zope.security.interfaces import Unauthorized
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.file import File
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.securitypolicy.interfaces import IRolePermissionManager

Modified: Zope3/trunk/src/zope/app/container/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/container/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.interface import Interface, Attribute, implements, Invalid
+from zope.interface import Interface, Attribute, Invalid
 from zope.component.interfaces import IView
 from zope.interface.common.mapping import IItemMapping
 from zope.interface.common.mapping import IReadMapping, IEnumerableMapping

Modified: Zope3/trunk/src/zope/app/container/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/placelesssetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/placelesssetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,7 @@
 
 $Id$
 """
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.app.container.interfaces import IWriteContainer, INameChooser
 from zope.app.container.contained import NameChooser
 

Modified: Zope3/trunk/src/zope/app/container/tests/test_btree.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_btree.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_btree.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/container/tests/test_contained.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_contained.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_contained.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/container/tests/test_containertraverser.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_containertraverser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_containertraverser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,12 +18,10 @@
 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
-from zope.publisher.interfaces.browser import IBrowserRequest 
 
 class TestContainer(object):
     implements(IReadContainer)
@@ -42,7 +40,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/trunk/src/zope/app/container/tests/test_icontainer.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_icontainer.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_icontainer.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/container/tests/test_objectcopier.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_objectcopier.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_objectcopier.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/container/tests/test_objectmover.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_objectmover.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_objectmover.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/container/tests/test_ordered.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_ordered.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/tests/test_ordered.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,20 +13,18 @@
 ##############################################################################
 """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/trunk/src/zope/app/container/traversal.py
===================================================================
--- Zope3/trunk/src/zope/app/container/traversal.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/container/traversal.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -27,7 +27,6 @@
 from zope.app.container.interfaces import ISimpleReadContainer, IItemContainer
 from zope.app.container.interfaces import IReadContainer
 from zope.app.traversing.interfaces import ITraversable
-from zope.app.traversing.namespace import UnexpectedParameters
 
 # Note that the next two classes are included here because they
 # can be used for multiple view types.
@@ -46,7 +45,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 +71,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/trunk/src/zope/app/content/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/content/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/content/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -6,7 +6,7 @@
 
   <vocabulary
       name="Content Types"
-      factory="zope.app.utility.vocabulary.UtilityVocabulary"
+      factory="zope.app.component.vocabulary.UtilityVocabulary"
       interface="zope.app.content.interfaces.IContentType" />
 
 </configure>

Modified: Zope3/trunk/src/zope/app/copypastemove/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/copypastemove/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,8 @@
 from zope.component import adapts
 from zope.event import notify
 
-from zope.app import zapi
 from zope.app.annotation.interfaces import IAnnotations
+from zope.app.annotation.interfaces import IAnnotations
 from zope.app.container.sample import SampleContainer
 from zope.app.event.objectevent import ObjectCopiedEvent
 from zope.app.location.pickling import locationCopy
@@ -436,7 +436,7 @@
     This adapter uses IObjectMover to move an item within the same container
     to a different name. We need to first setup an adapter for IObjectMover:
 
-      >>> from zope.app.tests import ztapi
+      >>> from zope.app.testing import ztapi
       >>> from zope.app.container.interfaces import IContained
       >>> ztapi.provideAdapter(IContained, IObjectMover, ObjectMover)
 
@@ -504,7 +504,7 @@
     To illustrate, we need to setup an IObjectMover, which is used in the
     renaming:
 
-      >>> from zope.app.tests import ztapi
+      >>> from zope.app.testing import ztapi
       >>> from zope.app.container.interfaces import IContained
       >>> ztapi.provideAdapter(IContained, IObjectMover, ObjectMover)
 

Modified: Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/copypastemove/tests/test_clipboard.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,23 +15,28 @@
 
 $Id$
 """
-from unittest import TestCase, TestSuite, main, makeSuite
+import unittest 
 
 from zope.app import zapi
-from zope.app.tests import ztapi
+from zope.app.annotation.interfaces import IAnnotations
+from zope.app.component.testing import PlacefulSetup
 from zope.app.principalannotation import PrincipalAnnotationUtility
 from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-from zope.app.annotation.interfaces import IAnnotations
+from zope.app.testing import ztapi
 
 from zope.app.copypastemove.interfaces import IPrincipalClipboard
 from zope.app.copypastemove import PrincipalClipboard
-from zope.app.pluggableauth.tests.authsetup import AuthSetup
 
 
-class PrincipalClipboardTest(AuthSetup, TestCase):
+class PrincipalStub(object):
 
+    def __init__(self, id):
+        self.id = id
+
+
+class PrincipalClipboardTest(PlacefulSetup, unittest.TestCase):
+
     def setUp(self):
-        AuthSetup.setUp(self)
         self.buildFolders()
 
         ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
@@ -40,7 +45,7 @@
                              PrincipalAnnotationUtility())
 
     def testAddItems(self):
-        user = self._auth['one']['srichter']
+        user = PrincipalStub('srichter')
 
         annotationutil = zapi.getUtility(IPrincipalAnnotationUtility)
         annotations = annotationutil.getAnnotations(user)
@@ -56,7 +61,7 @@
         self.failUnless(clipboard.getContents() == expected)
 
     def testSetContents(self):
-        user = self._auth['one']['srichter']
+        user = PrincipalStub('srichter')
 
         annotationutil = zapi.getUtility(IPrincipalAnnotationUtility)
         annotations = annotationutil.getAnnotations(user)
@@ -72,7 +77,7 @@
         self.failUnless(clipboard.getContents() == expected)
 
     def testClearContents(self):
-        user = self._auth['one']['srichter']
+        user = PrincipalStub('srichter')
 
         annotationutil = zapi.getUtility(IPrincipalAnnotationUtility)
         annotations = annotationutil.getAnnotations(user)
@@ -81,9 +86,10 @@
         self.failUnless(clipboard.getContents() == ())
 
 def test_suite():
-    t1 = makeSuite(PrincipalClipboardTest)
-    return TestSuite((t1,))
+    return unittest.TestSuite((
+        unittest.makeSuite(PrincipalClipboardTest),
+        ))
 
 if __name__=='__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')
 

Modified: Zope3/trunk/src/zope/app/copypastemove/tests/test_rename.py
===================================================================
--- Zope3/trunk/src/zope/app/copypastemove/tests/test_rename.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/copypastemove/tests/test_rename.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,11 +18,12 @@
 import unittest
 
 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 unittest.TestSuite((
-        DocTestSuite('zope.app.copypastemove',setUp=setUp, tearDown=tearDown),
+        DocTestSuite('zope.app.copypastemove',
+                     setUp=setUp, tearDown=tearDown),
         ))
 
 if __name__=='__main__':

Modified: Zope3/trunk/src/zope/app/dav/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/dav/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -108,7 +108,7 @@
       permission="zope.Public"
       factory=".adapter.DAVSchemaAdapter" />
 
-  <!-- XXX: This interface needs to be split up so we can apply seperate 
+  <!-- TODO: This interface needs to be split up so we can apply seperate 
        permissions for reading and writing -->
   <adapter
       factory=".opaquenamespaces.DAVOpaqueNamespacesAdapter"

Modified: Zope3/trunk/src/zope/app/dav/ftests/dav.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/ftests/dav.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/ftests/dav.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 from persistent import Persistent
 from transaction import get_transaction
 from zope.interface import implements
-from zope.app.tests.functional import HTTPTestCase
+from zope.app.testing.functional import HTTPTestCase
 
 from zope.app.folder import Folder
 from zope.app.annotation.interfaces import IAttributeAnnotatable

Modified: Zope3/trunk/src/zope/app/dav/ftests/test_propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/ftests/test_propfind.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/ftests/test_propfind.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,6 @@
 import transaction
 from zope.pagetemplate.tests.util import normalize_xml
 
-from zope.app import zapi
 from zope.app.dav.ftests.dav import DAVTestCase
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.dav.opaquenamespaces import IDAVOpaqueNamespaces

Modified: Zope3/trunk/src/zope/app/dav/ftests/test_proppatch.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/ftests/test_proppatch.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/ftests/test_proppatch.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,6 @@
 from zope.pagetemplate.tests.util import normalize_xml
 from zope.publisher.http import status_reasons
 
-from zope.app import zapi
 from zope.app.dav.ftests.dav import DAVTestCase
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.dav.opaquenamespaces import IDAVOpaqueNamespaces

Modified: Zope3/trunk/src/zope/app/dav/mkcol.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/mkcol.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/mkcol.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,6 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.app import zapi
 from zope.app.filerepresentation.interfaces import IWriteDirectory
 from zope.app.filerepresentation.interfaces import IDirectoryFactory
 from zope.event import notify

Modified: Zope3/trunk/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/propfind.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/propfind.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -66,8 +66,7 @@
             self.request.response.setStatus(400)
             return ''
 
-        resource_url = str(zapi.getView(self.context, 'absolute_url', 
-                                        self.request))
+        resource_url = zapi.absoluteURL(self.context, self.request)
         if IReadContainer.providedBy(self.context):
             resource_url += '/'
 
@@ -101,7 +100,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/trunk/src/zope/app/dav/proppatch.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/proppatch.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/proppatch.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -59,8 +59,7 @@
             self.request.response.setStatus(400)
             return ''
 
-        resource_url = str(zapi.getView(self.context, 'absolute_url', 
-                                        self.request))
+        resource_url = zapi.absoluteURL(self.context, self.request)
         if IReadContainer.providedBy(self.context):
             resource_url += '/'
 

Modified: Zope3/trunk/src/zope/app/dav/tests/test_adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/tests/test_adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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 _
@@ -65,8 +65,7 @@
 
 def test_DAVSchemaAdapter():
     """Before we can start off, we need to provide a few basic components.
-    Let's setup the necessary services and a minimum of the location
-    machinery:
+    Let's setup a minimum of the location machinery:
 
     >>> setUp()
     >>> ztapi.provideAdapter(ILocation, IPhysicallyLocatable,

Modified: Zope3/trunk/src/zope/app/dav/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/dav/tests/test_mkcol.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_mkcol.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/tests/test_mkcol.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/dav/tests/test_propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_propfind.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/tests/test_propfind.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,21 +20,20 @@
 from unittest import TestCase, TestSuite, main, makeSuite
 from datetime import datetime
 
-from zope.interface import Interface, implements, directlyProvides
+from zope.interface import Interface,  directlyProvides
 from zope.publisher.interfaces.http import IHTTPRequest
-from zope.publisher.http import status_reasons
 
 from zope.pagetemplate.tests.util import normalize_xml
 from zope.schema import getFieldNamesInOrder
 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
@@ -51,9 +50,7 @@
 
 from unitfixtures import File, Folder, FooZPT
 
-import zope.app.location
 
-
 def _createRequest(body=None, headers=None, skip_headers=None):
     if body is None:
         body = '''<?xml version="1.0" encoding="utf-8"?>
@@ -111,12 +108,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 +223,7 @@
         ''' % req
         request = _createRequest(body=body, headers={
             'Content-type': 'text/xml', 'Depth': depth})
-        resource_url = str(zapi.getView(obj, 'absolute_url', request))
+        resource_url = zapi.absoluteURL(obj, request)
         if IReadContainer.providedBy(obj):
             resource_url += '/'
         if resp is None:

Modified: Zope3/trunk/src/zope/app/dav/tests/test_proppatch.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_proppatch.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dav/tests/test_proppatch.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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,7 @@
     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 = zapi.absoluteURL(obj, request)
         expect = '''<?xml version="1.0" encoding="utf-8"?>
             <multistatus xmlns="DAV:"><response>
             <href>%%(resource_url)s</href>

Modified: Zope3/trunk/src/zope/app/demo/insensitivefolder/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/insensitivefolder/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/insensitivefolder/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/demo/insensitivefolder/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/insensitivefolder/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/insensitivefolder/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +16,8 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
 from zope.publisher.interfaces import NotFound
+from zope.app.testing.functional import BrowserTestCase
 
 class TestCaseInsensitiveFolder(BrowserTestCase):
 

Modified: Zope3/trunk/src/zope/app/demo/jobboard/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/jobboard/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/jobboard/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,7 @@
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.publisher.browser import BrowserView
 from zope.event import notify
-from zope.app.event.objectevent import ObjectCreatedEvent, ObjectModifiedEvent
+from zope.app.event.objectevent import ObjectModifiedEvent
 
 
 from job import Job
@@ -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/trunk/src/zope/app/demo/jobboard/job.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/jobboard/job.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/jobboard/job.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -61,8 +61,6 @@
 
 
 from persistent.dict import PersistentDict
-from zope.event import notify
-from zope.app.event.objectevent import ObjectCreatedEvent
 
 class JobList(Persistent):
     """ the Joblist class manages the creation, deletion of job list and

Modified: Zope3/trunk/src/zope/app/demo/pagelet/app.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/app.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pagelet/app.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Pagelet Demo
 
-$Id:$
+$Id$
 """
 __docformat__ = 'restructuredtext'
 

Modified: Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pagelet/browser/views.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,18 +13,14 @@
 ##############################################################################
 """Pagelet Demo
 
-$Id:$
+$Id$
 """
 __docformat__ = 'restructuredtext'
 
-from persistent import Persistent
 
-import zope.interface
-
 from zope.interface import implements
 
 from zope.app.publisher.browser import BrowserView
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 
 from zope.app.pagelet.interfaces import IPageData
 from zope.app.demo.pagelet.interfaces import IPageletContent

Modified: Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pagelet/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,12 +13,10 @@
 ##############################################################################
 """Functional tests for testing pagelet content.
 
-$Id:$
+$Id$
 """
-
 import unittest
-from zope.app.tests.functional import BrowserTestCase
-from zope.publisher.interfaces import NotFound
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestPageletContent(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/demo/pageletchooser/adapters.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pageletchooser/adapters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pageletchooser/adapters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,19 +13,14 @@
 ##############################################################################
 """PageletChooser Demo
 
-$Id:$
+$Id$
 """
 __docformat__ = 'restructuredtext'
 
-from persistent.dict import PersistentDict
 
 from zope.interface import implements
 from zope.interface import directlyProvides
 
-from zope.app import zapi
-
-from zope.app.annotation.interfaces import IAnnotations
-
 from zope.app.pageletchooser.interfaces import IAnnotatableMappingAdapter
 from zope.app.pageletchooser.interfaces import IPageletNameManager
 
@@ -44,7 +39,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/trunk/src/zope/app/demo/pageletchooser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/pageletchooser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pageletchooser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -66,7 +66,7 @@
       name="firstlevelmacronames"
       factory="zope.app.pageletchooser.vocabulary.PageletNamesVocabulary"
       layer="zope.publisher.interfaces.browser.IBrowserRequest"
-      view="zope.component.interfaces.IView"
+      view="zope.component.bbb.interfaces.IView"
       slot="zope.app.demo.pageletchooser.interfaces.IFirstLevelPagelets"
       />
 

Modified: Zope3/trunk/src/zope/app/demo/pageletchooser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pageletchooser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/demo/pageletchooser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,12 +13,10 @@
 ##############################################################################
 """Functional tests for testing pagelet chooser content.
 
-$Id:$
+$Id$
 """
-
 import unittest
-from zope.app.tests.functional import BrowserTestCase
-from zope.publisher.interfaces import NotFound
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestPageletChooserContent(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/dependable/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/dependable/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dependable/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/dtmlpage/dtmlpage.py
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,7 +19,6 @@
 
 from persistent import Persistent
 
-from zope.security.proxy import ProxyFactory
 from zope.documenttemplate.untrusted import UntrustedHTML
 from zope.interface import implements
 

Modified: Zope3/trunk/src/zope/app/dtmlpage/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dtmlpage/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.dtmlpage.dtmlpage import DTMLPage
 from xml.sax.saxutils import escape
 

Modified: Zope3/trunk/src/zope/app/dtmlpage/tests/test_dtmlpage.py
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/tests/test_dtmlpage.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dtmlpage/tests/test_dtmlpage.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/dublincore/tests/test_creatorannotator.py
===================================================================
--- Zope3/trunk/src/zope/app/dublincore/tests/test_creatorannotator.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dublincore/tests/test_creatorannotator.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/dublincore/tests/test_dcsv.py
===================================================================
--- Zope3/trunk/src/zope/app/dublincore/tests/test_dcsv.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dublincore/tests/test_dcsv.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 import unittest
 
 from zope.testing.doctestunit import DocTestSuite
-from zope.app.dublincore.dcsv import encode, decode, createMapping
+from zope.app.dublincore.dcsv import encode, decode
 
 
 # XXX still need tests for errors, and createMapping()

Modified: Zope3/trunk/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py
===================================================================
--- Zope3/trunk/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/dublincore/tests/test_zdcannotatableadapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/error/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/error/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/error/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -43,7 +43,7 @@
         # to handle redirection to the site error logger instead
         try:
             err = zapi.getUtility(IErrorReportingUtility)
-            url = str(zapi.getView(err, 'absolute_url', self.request))
+            url = zapi.absoluteURL(err, self.request)
             url = url + "/@@SelectedManagementView.html"
         except TypeError:
             # siterooturl = self.request.getApplicationURL()

Modified: Zope3/trunk/src/zope/app/error/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/error/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/error/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -38,6 +38,13 @@
      description="Error Reporting Utility for Logging Errors"
      permission="zope.ManageServices" />
 
+  <tool
+      interface="..interfaces.IErrorReportingUtility"
+      title="Error Reporting"
+      description="Component to record all uncaught errors and exceptions."
+      unique="true"
+      />
+
   <icon name="zmi_icon"
       for="zope.app.error.interfaces.IErrorReportingUtility"
       file="error.gif" />

Modified: Zope3/trunk/src/zope/app/error/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/error/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/error/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/event/dispatching.py
===================================================================
--- Zope3/trunk/src/zope/app/event/dispatching.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/event/dispatching.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/event/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/event/tests/placelesssetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,11 +15,10 @@
 
 $Id$
 """
+
 from zope.app.event.interfaces import IObjectEvent
 from zope.app.event.objectevent import objectEventNotify
-from zope.interface import implements
-from zope.component import getGlobalServices
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 
 events = []
 

Modified: Zope3/trunk/src/zope/app/event/tests/test_objectevent.py
===================================================================
--- Zope3/trunk/src/zope/app/event/tests/test_objectevent.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/event/tests/test_objectevent.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,9 +16,7 @@
 $Id$
 """
 import unittest
-import doctest
 
-from zope.interface import implements
 from zope.app.event.objectevent import ObjectModifiedEvent
 from zope.app.event.objectevent import ObjectAnnotationsModifiedEvent
 from zope.app.event.objectevent import ObjectContentModifiedEvent
@@ -27,8 +25,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/trunk/src/zope/app/exception/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/exception/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +16,7 @@
 $Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
 """
 import unittest
-from zope.publisher.interfaces import NotFound
-from zope.app.tests import functional
+from zope.app.testing import functional
 
 class TestNotFound(functional.BrowserTestCase):
 

Modified: Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,12 +18,10 @@
 from unittest import TestCase, main, makeSuite
 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 IAuthentication, 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."""
@@ -77,7 +75,7 @@
         # Make sure the response status was set
         self.assertEqual(request.response.getStatus(), 403)
 
-        # Make sure the auth service was called
+        # Make sure the auth utility was called
         self.failUnless(self.auth.request is request)
         self.assertEqual(self.auth.principal_id, 23)
 
@@ -96,7 +94,7 @@
         # Make sure the response status was set
         self.assertEqual(request.response.getStatus(), 403)
 
-        # Make sure the auth service was called
+        # Make sure the auth utility was called
         self.failUnless(self.auth.request is request)
         self.assertEqual(self.auth.principal_id, 23)
 

Modified: Zope3/trunk/src/zope/app/externaleditor/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/externaleditor/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/externaleditor/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 
 from zope.app import zapi
 from zope.app.publisher.browser import BrowserView
-from zope.app.filerepresentation.interfaces import IReadFile, IWriteFile
+from zope.app.filerepresentation.interfaces import IReadFile
 from zope.app.interface import queryType
 from zope.app.content.interfaces import IContentType
 from zope.security.proxy import removeSecurityProxy
@@ -30,7 +30,7 @@
         response = request.response
 
         r = []
-        url = zapi.getView(context, 'absolute_url', request)()
+        url = zapi.absoluteURL(context, request)
         r.append('url:%s' % url)
         adapted = IReadFile(context)
 

Modified: Zope3/trunk/src/zope/app/externaleditor/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/externaleditor/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/externaleditor/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,16 +25,15 @@
     For an object to be externally editable there
     are three requirements:
 
-    1. It needs to declare that it implements this interface
-       to signal the presentation service that a External Edit
-       action should be available.
+    1. It needs to declare that it implements this interface to signal the
+       site manager that a External Edit action should be available.
 
     2. It needs to have an adapter for the interface
        ``zope.app.filerepresentation.interfaces.IReadFile``.
 
-    3. It needs to have a ``PUT`` view which receive the content
-       back from the External Editor client and update the
-       object, optimally using an adapter to the interface
+    3. It needs to have a ``PUT`` view which receive the content back from the
+       External Editor client and update the object, optimally using an
+       adapter to the interface
        ``zope.app.filerepresentation.interfaces.IWriteFile`` (but not
        necessarily).
     """

Modified: Zope3/trunk/src/zope/app/externaleditor/tests/test_external_edit.py
===================================================================
--- Zope3/trunk/src/zope/app/externaleditor/tests/test_external_edit.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/externaleditor/tests/test_external_edit.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/file/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/file/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,7 +19,7 @@
 from xml.sax.saxutils import escape
 from StringIO import StringIO
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.file.file import File
 from zope.app.file.image import Image
 from zope.app.file.tests.test_image import zptlogo

Modified: Zope3/trunk/src/zope/app/file/browser/image.py
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/image.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/file/browser/image.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,6 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.app.size import byteDisplay
 from zope.app.size.interfaces import ISized
 
 class ImageData(object):

Modified: Zope3/trunk/src/zope/app/file/file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/file.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/file/file.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,7 +21,6 @@
 from transaction import get_transaction
 from zope.interface import implements
 
-from zope.publisher.browser import FileUpload
 from interfaces import IFile, IFileContent
 
 # set the size of the chunks

Modified: Zope3/trunk/src/zope/app/file/ftests/test_file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/ftests/test_file.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/file/ftests/test_file.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 import unittest
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestFile(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/file/ftests/test_image.py
===================================================================
--- Zope3/trunk/src/zope/app/file/ftests/test_image.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/file/ftests/test_image.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,12 +18,9 @@
 import unittest
 import cgi
 from cStringIO import StringIO
-from transaction import get_transaction
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.publisher.browser import FileUpload
 
-from zope.app.file.image import Image
-
 zptlogo = (
     'GIF89a\x10\x00\x10\x00\xd5\x00\x00\xff\xff\xff\xff\xff\xfe\xfc\xfd\xfd'
     '\xfa\xfb\xfc\xf7\xf9\xfa\xf5\xf8\xf9\xf3\xf6\xf8\xf2\xf5\xf7\xf0\xf4\xf6'

Modified: Zope3/trunk/src/zope/app/folder/filerepresentation.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/filerepresentation.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/folder/filerepresentation.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
 
 
 class RootDirectoryFactory(object):

Modified: Zope3/trunk/src/zope/app/folder/folder.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/folder.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/folder/folder.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,14 +21,13 @@
 from interfaces import IFolder, IRootFolder
 from persistent import Persistent
 from zope.app.container.contained import Contained, setitem, uncontained
-from zope.app.site.interfaces import ISite
-from zope.app.site.servicecontainer import ServiceManagerContainer
+from zope.app.component.interfaces import ISite
+from zope.app.component.site import SiteManagerContainer
 from zope.exceptions import DuplicationError
 from zope.interface import implements, directlyProvides
 
-class Folder(Persistent, ServiceManagerContainer, Contained):
-    """The standard Zope Folder implementation.
-    """
+class Folder(Persistent, SiteManagerContainer, Contained):
+    """The standard Zope Folder implementation."""
 
     implements(IFolder)
 
@@ -112,8 +111,8 @@
 class FolderSublocations(object):
     """Get the sublocations of a folder
 
-    The subobjects of a folder include it's contents and it's service
-    manager if it is a site.
+    The subobjects of a folder include it's contents and it's site manager if
+    it is a site.
 
       >>> folder = Folder()
       >>> folder['ob1'] = Contained()
@@ -127,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/trunk/src/zope/app/folder/fssync/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/fssync/adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/folder/fssync/adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/folder/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/folder/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/folder/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/folder/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/add.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/add.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/add.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -141,9 +141,7 @@
                    menu=u''):
 
     class_  = SimpleViewClass(
-        template,
-        used_for = schema, bases = bases
-        )
+        template, used_for=schema, bases=bases, name=name)
 
     class_.schema = schema
     class_.label = label
@@ -166,5 +164,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/trunk/src/zope/app/form/browser/addwizard.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/addwizard.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/addwizard.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -108,13 +108,14 @@
         self.request.response.redirect(self.context.nextURL())
         return False
 
-
+# XXX: Needs unittest
 def AddWizardViewFactory(
     name, schema, permission, layer, panes, fields,
     template, default_template, bases, for_, content_factory, arguments,
     keyword_arguments, set_before_add, set_after_add, use_session=True):
 
-    class_  = SimpleViewClass(template, used_for = schema, bases = bases)
+    class_  = SimpleViewClass(template, used_for=schema, bases=bases,
+                              name=name)
 
     class_.schema = schema
     class_.panes = panes
@@ -137,5 +138,5 @@
     if layer is None:
         layer = IDefaultBrowserLayer
 
-    s = zapi.getGlobalService(zapi.servicenames.Adapter)
-    s.register((for_, layer), Interface, name, class_)
+    sm = zapi.getGlobalSiteManager()
+    sm.provideAdapter((for_, layer), Interface, name, class_)

Modified: Zope3/trunk/src/zope/app/form/browser/editview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/editview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -129,7 +129,8 @@
 def EditViewFactory(name, schema, label, permission, layer,
                     template, default_template, bases, for_, fields,
                     fulledit_path=None, fulledit_label=None, menu=u''):
-    class_ = SimpleViewClass(template, used_for=schema, bases=bases)
+
+    class_ = SimpleViewClass(template, used_for=schema, bases=bases, name=name)
     class_.schema = schema
     class_.label = label
     class_.fieldNames = fields
@@ -149,5 +150,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/trunk/src/zope/app/form/browser/editwizard.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editwizard.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/editwizard.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -217,7 +217,7 @@
                     panes, fields, template, default_template, bases, for_,
                     menu=u'', use_session=False):
     # XXX What about the __implements__ of the bases?
-    class_ = SimpleViewClass(template, used_for=schema, bases=bases)
+    class_ = SimpleViewClass(template, used_for=schema, bases=bases, name=name)
     class_.schema = schema
     class_.panes = panes
     class_.fieldNames = fields
@@ -233,7 +233,8 @@
     if layer is None:
         layer = IDefaultBrowserLayer
 
-    s = zapi.getGlobalService(zapi.servicenames.Adapter)
-    s.register((for_, layer), Interface, name, class_)
+    # XXX: untested
+    sm = zapi.getGlobalSiteManager()
+    sm.provideAdapter((for_, layer), Interface, name, class_)
 
 

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -28,7 +28,7 @@
 
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IFoo(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_checkboxwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -28,7 +28,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IBoolTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_datetimewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_datetimewidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_datetimewidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -30,7 +30,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IDatetimeTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_editview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_editview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_editview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -27,7 +27,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IFoo(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_filewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_filewidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_filewidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -31,7 +31,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.form.interfaces import IInputWidget
 
 class IFileField(IField):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_floatwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_floatwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_floatwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -28,7 +28,7 @@
 
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IFloatTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -28,7 +28,7 @@
 
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class IIntTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_objectwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_objectwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_objectwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,7 +21,7 @@
 from zope.publisher.browser import TestRequest
 from zope.schema import Object, TextLine
 from zope.app.form.browser import ObjectWidget
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.form.browser.tests import support
 
 

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_textareawidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -27,7 +27,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class ITextTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_textwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_textwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_textwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,7 +25,7 @@
 from support import *
 from zope.app.traversing.api import traverse
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class ITextLineTest(Interface):

Modified: Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/schemadisplay.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/schemadisplay.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/schemadisplay.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -73,7 +73,8 @@
                        fulledit_path=None, fulledit_label=None, menu=u'',
                        usage=u''):
     # XXX What about the __implements__ of the bases?
-    class_ = SimpleViewClass(template, used_for=schema, bases=bases)
+    class_ = SimpleViewClass(template, used_for=schema, bases=bases,
+                             name=name)
     class_.schema = schema
     class_.label = label
     class_.fieldNames = fields
@@ -82,6 +83,7 @@
         fulledit_label = "Full display"
     class_.fulledit_label = fulledit_label
     class_.generated_form = ViewPageTemplateFile(default_template)
+    # XXX: Cannot work!
     class_.usage = usage or (
         menu and globalBrowserMenuService.getMenuUsage(menu)
         )
@@ -92,5 +94,5 @@
     if layer is None:
         layer = IDefaultBrowserLayer
 
-    s = zapi.getGlobalService(zapi.servicenames.Adapters)
-    s.register((for_, layer), Interface, name, class_)
+    sm = zapi.getGlobalSiteManager()
+    sm.provideAdapter((for_, layer), Interface, name, class_)

Modified: Zope3/trunk/src/zope/app/form/browser/sequencewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/sequencewidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/sequencewidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/source.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -167,8 +167,8 @@
     def error(self):
         if self._error:
             # XXX This code path is untested.
-            return zapi.getViewProviding(self._error, IWidgetInputErrorView,
-                                         self.request).snippet()
+            return zapi.getMultiAdapter((self._error, self.request),
+                                        IWidgetInputErrorView).snippet()
         return ""
     
     def __call__(self):

Modified: Zope3/trunk/src/zope/app/form/browser/source.txt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/source.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_add.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_add.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_add.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,14 +17,14 @@
 """
 import unittest
 
-from zope.security.checker import CheckerPublic
-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.security.checker import CheckerPublic
 
 from zope.app.event.tests.placelesssetup import getEvents
 from zope.app.event.interfaces import IObjectCreatedEvent, IObjectModifiedEvent
@@ -34,7 +34,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
@@ -216,7 +216,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))
@@ -249,7 +249,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__)
 
@@ -287,7 +287,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'})
 
@@ -307,7 +307,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/trunk/src/zope/app/form/browser/tests/test_browserwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_browserwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_choicecollections.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_choicecollections.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_choicecollections.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_choicewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_choicewidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_choicewidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_editview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_editview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_editview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_editwizardview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_objectwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_objectwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_objectwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_registrations.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_registrations.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_registrations.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_sequencewidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_sequencewidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_sequencewidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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, ObjectWidget
 from zope.app.form.browser import TupleSequenceWidget, ListSequenceWidget
 from zope.app.form.browser import SequenceWidget

Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_source.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_source.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_textwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_textwidget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/tests/test_widgetdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_widgetdirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_widgetdirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/browser/widget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/widget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/browser/widget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -103,8 +103,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):
@@ -486,14 +486,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/trunk/src/zope/app/form/tests/test_utility.py
===================================================================
--- Zope3/trunk/src/zope/app/form/tests/test_utility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/tests/test_utility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -26,7 +26,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
@@ -37,8 +37,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/trunk/src/zope/app/form/tests/test_widget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/tests/test_widget.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/tests/test_widget.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/form/utility.py
===================================================================
--- Zope3/trunk/src/zope/app/form/utility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/form/utility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -56,13 +56,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/trunk/src/zope/app/fssync/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/fssync/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,15 +1,10 @@
 <configure
     xmlns="http://namespaces.zope.org/zope"
-    xmlns:fssync='http://namespaces.zope.org/fssync'
+    xmlns:fssync="http://namespaces.zope.org/fssync"
     >
 
-  <serviceType
-      id="FSRegistryService"
-      interface="zope.app.fssync.interfaces.IGlobalFSSyncService"
-      />
-  
-  <service
-      serviceType="FSRegistryService"
+  <utility
+      provides="zope.app.fssync.interfaces.IGlobalFSSyncUtility"
       component="zope.app.fssync.fsregistry.fsRegistry"
       />
 

Modified: Zope3/trunk/src/zope/app/fssync/fsbundle.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/fsbundle.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/fsbundle.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,7 +25,7 @@
 from zope.fssync.metadata import Metadata
 
 BUNDLE_TYPE = "zope.app.services.bundle.Bundle"
-FOLDER_TYPE = "zope.app.services.folder.SiteManagementFolder"
+FOLDER_TYPE = "zope.app.component.site.SiteManagementFolder"
 
 
 class FSBundle(object):

Modified: Zope3/trunk/src/zope/app/fssync/fsregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/fsregistry.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/fsregistry.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/fssync/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/fssync/syncer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/syncer.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/syncer.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/fssync/tests/sampleclass.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/sampleclass.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/tests/sampleclass.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Test SampleClass for testing File-system synchronization services
+"""Test SampleClass for testing File-system synchronization utilities
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/fssync/tests/test_committer.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/test_committer.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/tests/test_committer.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/fssync/tests/test_fsbundle.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/test_fsbundle.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/tests/test_fsbundle.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -66,13 +66,13 @@
         self.add_metadata(
             self.etcdir,
             path="/++etc++site",
-            type="zope.app.services.service.ServiceManager",
-            factory="zope.app.services.service.ServiceManager")
+            type="zope.app.component.site.LocalSiteManager",
+            factory="zope.app.component.site.LocalSiteManager")
         self.add_metadata(
             os.path.join(self.etcdir, "site-folder"),
             path="/++etc++site/site-folder",
-            type="zope.app.services.folder.SiteManagementFolder",
-            factory="zope.app.services.folder.SiteManagementFolder")
+            type="zope.app.component.site.SiteManagementFolder",
+            factory="zope.app.component.site.SiteManagementFolder")
         self.metadata.flush()
 
     def add_metadata(self, name, **kw):
@@ -125,8 +125,8 @@
                         "++etc++site", "site-folder", "dummy.py")
         self.add_metadata(os.path.join(self.etcdir, "site-folder", "dummy.py"),
                           path="/++etc++site/default/sample",
-                          type="zope.app.services.module.Manager",
-                          factory="zope.app.services.module.Manager")
+                          type="zope.app.module.manager.ModuleManager",
+                          factory="zope.app.module.manager.ModuleManager")
         self.metadata.flush()
         self.assertRaises(Error, self.fsbundle.create,
                           target, "foo", "bar", source)

Modified: Zope3/trunk/src/zope/app/fssync/tests/test_fsdirective.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/test_fsdirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/tests/test_fsdirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Test FSRegistry File-system synchronization services
+"""Test FSRegistry File-system synchronization utilities
 
 $Id$
 """
@@ -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/trunk/src/zope/app/fssync/tests/test_fsregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/tests/test_fsregistry.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/fssync/tests/test_fsregistry.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/ftests/doctest.txt
===================================================================
--- Zope3/trunk/src/zope/app/ftests/doctest.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/ftests/doctest.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -8,7 +8,7 @@
 ---------------------------------
 
 You can create Functional tests as doctests.  Typically, this is done
-by using a script such as src/zope/app/tests/dochttp.py to convert
+by using a script such as src/zope/app/testing/dochttp.py to convert
 tcpwatch recorded output to a doctest, which is then edited to provide
 explanation and to remove uninyeresting details.  That is how this
 file was created.
@@ -63,7 +63,7 @@
   HTTP/1.1 303 See Other
   Content-Length: 0
   Content-Type: text/plain;charset=utf-8
-  Location: @@tasks.html
+  Location: @@contents.html
   <BLANKLINE>
 
 Note that, in this case, we got a 303 response.  A 303 response is the
@@ -78,13 +78,13 @@
   HTTP/1.0 302 Moved Temporarily
   Content-Length: 0
   Content-Type: text/plain;charset=utf-8
-  Location: @@tasks.html
+  Location: @@contents.html
   <BLANKLINE>
 
-Lets visit the page we were rediected to:
+Lets visit the page we were redirected to:
 
   >>> print http(r"""
-  ... GET /++etc++site/@@tasks.html HTTP/1.1
+  ... GET /++etc++site/@@contents.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
   ... Referer: http://localhost:8081/
   ... """)

Modified: Zope3/trunk/src/zope/app/ftests/test_functional.py
===================================================================
--- Zope3/trunk/src/zope/app/ftests/test_functional.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/ftests/test_functional.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,9 +19,9 @@
 
 import unittest
 import transaction
-from zope.app.tests.functional import SampleFunctionalTest, BrowserTestCase
-from zope.app.tests.functional import FunctionalDocFileSuite
-from zope.app.tests.functional import FunctionalTestCase
+from zope.app.testing.functional import SampleFunctionalTest, BrowserTestCase
+from zope.app.testing.functional import FunctionalDocFileSuite
+from zope.app.testing.functional import FunctionalTestCase
 
 class CookieFunctionalTest(BrowserTestCase):
 
@@ -126,7 +126,7 @@
 
     def test_skins(self):
         # Regression test for http://zope.org/Collectors/Zope3-dev/353
-        from zope.app.tests.functional import HTTPCaller
+        from zope.app.testing.functional import HTTPCaller
         http = HTTPCaller()
         response = http("GET /++skin++Basic HTTP/1.1\n\n")
         self.assert_("zopetopBasic.css" in str(response))

Modified: Zope3/trunk/src/zope/app/ftests/test_introspector.py
===================================================================
--- Zope3/trunk/src/zope/app/ftests/test_introspector.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/ftests/test_introspector.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 __docformat__ = 'restructuredtext'
 
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestIntrospector(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/ftp/tests/test_ftpview.py
===================================================================
--- Zope3/trunk/src/zope/app/ftp/tests/test_ftpview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/ftp/tests/test_ftpview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 import datetime
 from StringIO import StringIO
 from unittest import TestCase, TestSuite, main, makeSuite
@@ -24,7 +23,7 @@
 
 import zope.server.ftp.tests.demofs as demofs
 
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.app.filerepresentation.interfaces import IReadFile, IWriteFile
 from zope.app.filerepresentation.interfaces import IReadDirectory
 from zope.app.filerepresentation.interfaces import IWriteDirectory
@@ -32,7 +31,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.app.copypastemove.interfaces import IObjectMover
 from zope.app.copypastemove.interfaces import IContainerItemRenamer
 from zope.app.copypastemove import ContainerItemRenamer

Modified: Zope3/trunk/src/zope/app/generations/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/generations/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/generations/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -10,7 +10,7 @@
 you change the semantic meaning of an existing field in a class, you will
 have a problem with databases that were created before your change.  For a
 more thorough discussion and possible solutions, see
-http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/DatabaseGenerations
+http://dev.zope.org/Zope3/DatabaseGenerations
 
 We will be using the component architecture, and we will need a database and a
 connection:
@@ -18,7 +18,7 @@
     >>> import cgi
     >>> from pprint import pprint
     >>> from zope.interface import implements
-    >>> from zope.app.tests import placelesssetup, ztapi
+    >>> from zope.app.testing import placelesssetup, ztapi
     >>> placelesssetup.setUp()
 
     >>> from ZODB.tests.util import DB

Modified: Zope3/trunk/src/zope/app/generations/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/generations/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,15 +17,14 @@
 """
 import unittest
 
-from zope.app.tests import ztapi
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing import ztapi, functional
 from zope.app.generations.generations import SchemaManager, generations_key
 from zope.app.generations.interfaces import ISchemaManager
 
-class TestDatabaseSchema(BrowserTestCase):
+class TestDatabaseSchema(functional.BrowserTestCase):
 
     def test(self):
-        BrowserTestCase.setUp(self)
+        functional.BrowserTestCase.setUp(self)
         
         root = self.getRootFolder()._p_jar.root()
         appkey = 'zope.app.generations.demo'

Modified: Zope3/trunk/src/zope/app/generations/browser/managerdetails.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/browser/managerdetails.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/generations/browser/managerdetails.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/generations/browser/managers.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/browser/managers.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/generations/browser/managers.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/generations/generations.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/generations.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/generations/generations.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/homefolder/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/homefolder/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/homefolder/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/homefolder/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/homefolder/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/homefolder/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/http/options.py
===================================================================
--- Zope3/trunk/src/zope/app/http/options.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/http/options.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,7 @@
            'COPY', 'MOVE', 'LOCK', 'UNLOCK', 'TRACE']
            # 'GET', 'HEAD', 'POST' are always available. See OPTIONS() method.
 
-from zope.component import queryView
+from zope.app import zapi
 
 class OPTIONS(object):
     """`OPTIONS` handler for all objects
@@ -36,7 +36,7 @@
         # interfaces for HTTP methods. This way we can even list verbs that
         # are not in the lists above.
         for m in _allowed_methods:
-            view = queryView(self.context, m, self.request, None)
+            view = zapi.queryMultiAdapter((self.context, self.request), name=m)
             if view is not None:
                 allowed.append(m)
 

Modified: Zope3/trunk/src/zope/app/http/tests/test_delete.py
===================================================================
--- Zope3/trunk/src/zope/app/http/tests/test_delete.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/http/tests/test_delete.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/http/tests/test_put.py
===================================================================
--- Zope3/trunk/src/zope/app/http/tests/test_put.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/http/tests/test_put.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/i18n/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Translation Service Views
+"""Translation Domain Views
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/i18n/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -65,19 +65,6 @@
       permission="zope.ManageServices"
       />
 
-  <!-- Custom Domain registration screen -->
-  <addform
-      label="New Translation Domain Registration"
-      for="zope.app.i18n.interfaces.ILocalTranslationDomain"
-      name="addRegistration.html"
-      schema="zope.app.utility.interfaces.IUtilityRegistration"
-      class="zope.app.utility.browser.AddRegistration"
-      permission="zope.ManageServices"
-      content_factory="zope.app.i18n.translationdomain.DomainRegistration"
-      arguments="name interface componentPath"
-      set_after_add="status"
-      fields="name interface componentPath permission status" />
-
   <icon 
       name="zmi_icon" 
       for="zope.i18n.interfaces.ITranslationDomain"

Modified: Zope3/trunk/src/zope/app/i18n/browser/synchronize.pt
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/synchronize.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/synchronize.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,7 +1,7 @@
 <html metal:use-macro="context/@@standard_macros/view">
 <head>
   <title metal:fill-slot="title" i18n:translate="">
-    Translation Service - Synchronize
+    Translation Domain - Synchronize
   </title>
 
   <style metal:fill-slot="style_slot" type="text/css">

Modified: Zope3/trunk/src/zope/app/i18n/browser/synchronize.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/synchronize.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/synchronize.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Synchronize with Foreign Translation Services
+"""Synchronize with Foreign Translation Domains
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/tests/test_translate.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/i18n/browser/translatemessage.pt
===================================================================
--- Zope3/trunk/src/zope/app/i18n/browser/translatemessage.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/browser/translatemessage.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,7 +1,7 @@
 <html metal:use-macro="context/@@standard_macros/page">
 <head>
   <title metal:fill-slot="title" i18n:translate="">
-    Translation Service - Translate
+    Translation Domain - Translate
   </title>
 </head>
 

Modified: Zope3/trunk/src/zope/app/i18n/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/i18n/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,32 +21,32 @@
   <!-- Register the Translation Domain as a content object -->
   <localUtility class=".translationdomain.TranslationDomain">
     <factory 
-         id="zope.app.TranslationService" 
+         id="zope.app.i18n.TranslationDomain" 
          />
     <allow interface="zope.i18n.interfaces.ITranslationDomain" 
         />
-    <require permission="zope.ManageServices"
+    <require permission="zope.ManageSite"
         interface="zope.app.container.interfaces.IContainer" 
         />
-    <require permission="zope.ManageServices"
+    <require permission="zope.ManageSite"
         interface=".interfaces.IWriteTranslationDomain" 
         />
-    <require permission="zope.ManageServices"
+    <require permission="zope.ManageSite"
         interface=".interfaces.ISyncTranslationDomain" 
         />
   </localUtility>
   
   <subscriber
-     for=".interfaces.ILocalTranslationDomain
-          ..registration.interfaces.IRegistrationActivatedEvent"
-     handler=".translationdomain.setDomainOnActivation"
-     />
+       for=".interfaces.ILocalTranslationDomain
+            ..component.interfaces.registration.IRegistrationActivatedEvent"
+       handler=".translationdomain.setDomainOnActivation"
+       />
 
   <subscriber
-     for=".interfaces.ILocalTranslationDomain
-          ..registration.interfaces.IRegistrationDeactivatedEvent"
-     handler=".translationdomain.unsetDomainOnDeactivation"
-     />  
+       for=".interfaces.ILocalTranslationDomain
+            ..component.interfaces.registration.IRegistrationDeactivatedEvent"
+       handler=".translationdomain.unsetDomainOnDeactivation"
+       />  
 
   <!-- Setup Message Catalogs -->
   <content class=".messagecatalog.MessageCatalog">
@@ -56,7 +56,7 @@
   
     <require permission="zope.View" 
         interface="zope.i18n.interfaces.IMessageCatalog" />
-    <require permission="zope.ManageServices"
+    <require permission="zope.ManageSite"
         attributes="setMessage getMessageIds" />
   </content>
   

Modified: Zope3/trunk/src/zope/app/i18n/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,7 @@
 from zope.configuration.fields import Path
 
 class IRegisterTranslationsDirective(Interface):
-    """Register translations with the global Translation Service."""
+    """Register translations with the global site manager."""
 
     directory = Path(
         title=u"Directory",

Modified: Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/tests/placelesssetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,7 @@
 
 $Id$
 """
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.i18n.interfaces import IUserPreferredLanguages
 from zope.publisher.browser import BrowserLanguages

Modified: Zope3/trunk/src/zope/app/i18n/tests/test_filters.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/test_filters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/tests/test_filters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/tests/test_translationdomain.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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),
@@ -234,23 +231,21 @@
     def setUp(self):
         setup.placefulSetUp()
         self.rootFolder = setup.buildSampleFolderTree()
-        sm = zapi.getGlobalServices()
+        sm = zapi.getGlobalSiteManager()
         de_catalog = MessageCatalog('de', 'default')
         de_catalog.setMessage('short_greeting', 'Hallo!', 10)
 
         # Create global translation domain and add the catalog.
         domain = GlobalTranslationDomain('default')
         domain.addCatalog(de_catalog)
-        utils = sm.getService(Utilities)
-        utils.provideUtility(ITranslationDomain, domain, 'default')
+        sm.provideUtility(ITranslationDomain, domain, 'default')
 
         # Create Domain in root folder
-        mgr = setup.createServiceManager(self.rootFolder)
+        mgr = setup.createSiteManager(self.rootFolder)
         self.trans = setup.addDomain(mgr, Translation, TranslationDomain())
 
         # Create Domain in folder1
-        mgr = setup.createServiceManager(
-            zapi.traverse(self.rootFolder, 'folder1'))
+        mgr = setup.createSiteManager(zapi.traverse(self.rootFolder, 'folder1'))
         td = TranslationDomain()
         td.domain = 'default'
         de_catalog = MessageCatalog('de', 'default')

Modified: Zope3/trunk/src/zope/app/i18n/translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/app/i18n/translationdomain.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/i18n/translationdomain.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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)
@@ -66,7 +64,7 @@
 
     def translate(self, msgid, mapping=None, context=None,
                   target_language=None, default=None):
-        """See interface `ITranslationService`"""
+        """See interface `ITranslationDomain`"""
         if target_language is None and context is not None:
             avail_langs = self.getAvailableLanguages()
             # Let's negotiate the language to translate to. :)
@@ -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)
@@ -120,7 +117,7 @@
 
 
     def getMessage(self, msgid, language):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         for name in self._catalogs.get(language, []):
             try:
                 return self[name].getFullMessage(msgid)
@@ -129,7 +126,7 @@
         return None
 
     def getAllLanguages(self):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         languages = {}
         for key in self._catalogs.keys():
             languages[key] = None
@@ -137,12 +134,12 @@
 
 
     def getAvailableLanguages(self):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         return list(self._catalogs.keys())
 
 
     def addMessage(self, msgid, msg, language, mod_time=None):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         if not self._catalogs.has_key(language):
             if language not in self.getAllLanguages():
                 self.addLanguage(language)
@@ -153,28 +150,28 @@
 
 
     def updateMessage(self, msgid, msg, language, mod_time=None):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         catalog_name = self._catalogs[language][0]
         catalog = self[catalog_name]
         catalog.setMessage(msgid, msg, mod_time)
 
 
     def deleteMessage(self, msgid, language):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         catalog_name = self._catalogs[language][0]
         catalog = self[catalog_name]
         catalog.deleteMessage(msgid)
 
 
     def addLanguage(self, language):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         catalog = zapi.createObject(None, u'zope.app.MessageCatalog',
                                     language)
         self[language] = catalog
 
 
     def deleteLanguage(self, language):
-        'See `IWriteTranslationService`'
+        'See `IWriteTranslationDomain`'
         # Delete all catalogs from the data storage
         for name in self._catalogs[language]:
             if self.has_key(name):
@@ -184,7 +181,7 @@
 
 
     def getMessagesMapping(self, languages, foreign_messages):
-        'See `ISyncTranslationService`'
+        'See `ISyncTranslationDomain`'
         mapping = {}
         # Get all relevant local messages
         local_messages = []
@@ -206,7 +203,7 @@
 
 
     def synchronize(self, messages_mapping):
-        'See `ISyncTranslationService`'
+        'See `ISyncTranslationDomain`'
 
         for value in messages_mapping.values():
             fmsg = value[0]
@@ -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'))
 
@@ -269,7 +266,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/trunk/src/zope/app/interface/tests/test_interface.py
===================================================================
--- Zope3/trunk/src/zope/app/interface/tests/test_interface.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/interface/tests/test_interface.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Interface Service Tests
+"""Interfaces as Utilities Tests
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/interface/tests/test_vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/interface/tests/test_vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/interface/tests/test_vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/interpreter/python.py
===================================================================
--- Zope3/trunk/src/zope/app/interpreter/python.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/interpreter/python.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -37,7 +37,7 @@
                      {}, # we don't want to get local assignments saved.
                      )
         else:
-            # XXX There atr no tests for this branch
+            # TODO: There are no tests for this branch
             code.exec_(globals,
                        {}, # we don't want to get local assignments saved.
                        )

Modified: Zope3/trunk/src/zope/app/intid/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/intid/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/intid/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,7 +13,7 @@
       title="Unique Id Utility"
       description="A utility that provides unique ids to objects"
       class="zope.app.intid.IntIds"
-      permission="zope.ManageServices"
+      permission="zope.ManageSite"
     />
 
   <page

Modified: Zope3/trunk/src/zope/app/intid/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/intid/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,14 +11,14 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""XXX short summary goes here.
+"""Int Id Utility Functional Tests
 
 $Id$
 """
 import unittest
+from zope.app.testing import functional
 
 def test_suite():
-    from zope.app.tests import functional
     return unittest.TestSuite((
         functional.FunctionalDocFileSuite('tracking.txt'),
         ))

Modified: Zope3/trunk/src/zope/app/intid/browser/tracking.txt
===================================================================
--- Zope3/trunk/src/zope/app/intid/browser/tracking.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/intid/browser/tracking.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -4,29 +4,60 @@
 Unique ID utilities track object add moves.  Let's look at an
 example. First, we'll create a unique Id utility:
 
-  (The first request is a bit weird.  It is part of the current
-   tools UI.  It arranges for a tools site-management folder to be
-   created.  We really need to rethink how we manage TTW utilities.)
-
   >>> print http(r"""
-  ... GET /++etc++site/AddIIntIdsTool HTTP/1.1
+  ... POST /++etc++site/default/@@contents.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/@@manageIIntIdsTool.html
-  ... """)
-  HTTP/1.1 200 Ok
+  ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
   ...
+  ... type_name=BrowserAdd__zope.app.intid.IntIds&new_value=""")
+  HTTP/1.1 303 See Other
+  ...
+  Location: http://localhost/++etc++site/default/IntIds/@@registration.html
+  ...
 
   >>> print http(r"""
-  ... POST /++etc++site/AddIIntIdsTool/action.html HTTP/1.1
+  ... POST /++etc++site/default/IntIds/addRegistration.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Content-Length: 69
-  ... Content-Type: application/x-www-form-urlencoded
-  ... Referer: http://localhost:8081/++etc++site/AddIIntIdsTool
+  ... Referer: http://localhost:8081/++etc++site/default/IntIds/
+  ... Content-Type: multipart/form-data; boundary=----------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
   ... 
-  ... type_name=BrowserAdd__zope.app.intid.IntIds&id=&add=+Add+""")
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.name"
+  ... 
+  ... IntIds
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.provided"
+  ... 
+  ... zope.app.intid.interfaces.IIntIds
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.provided-empty-marker"
+  ... 
+  ... 1
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.status"
+  ... 
+  ... Active
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.status-empty-marker"
+  ... 
+  ... 1
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.permission"
+  ... 
+  ... 
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="field.permission-empty-marker"
+  ... 
+  ... 1
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ--
+  ... """)
   HTTP/1.1 303 See Other
   ...
-  Location: ../@@manageIIntIdsTool.html
+  Location: @@SelectedManagementView.html
   ...
 
 Now, we'll add a few folders:
@@ -75,9 +106,9 @@
 the objects we added:
 
   >>> print http(r"""
-  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
+  ... GET /++etc++site/default/IntIds/@@index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
+  ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
   ... """)
   HTTP/1.1 200 Ok
   ...4 objects...
@@ -102,9 +133,9 @@
 We'll see that reflected in the utility:
 
   >>> print http(r"""
-  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
+  ... GET /++etc++site/default/IntIds/@@index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
+  ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
   ... """)
   HTTP/1.1 200 Ok
   ...4 objects...
@@ -129,9 +160,9 @@
 all of the objects will go away:
 
   >>> print http(r"""
-  ... GET /++etc++site/tools/IntIds/@@index.html HTTP/1.1
+  ... GET /++etc++site/default/IntIds/@@index.html HTTP/1.1
   ... Authorization: Basic mgr:mgrpw
-  ... Referer: http://localhost:8081/++etc++site/tools/@@contents.html
+  ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
   ... """)
   HTTP/1.1 200 Ok
   ...0 objects...

Modified: Zope3/trunk/src/zope/app/intid/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/intid/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,15 +15,13 @@
 
 $Id$
 """
-
 import unittest
 import re
 from transaction import commit
 
 from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.app.tests.setup import addUtility
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing import ztapi, setup
+from zope.app.testing.functional import BrowserTestCase
 
 
 class TestIntIds(BrowserTestCase):
@@ -38,7 +36,7 @@
         root = self.getRootFolder()
 
         sm = zapi.traverse(root, '/++etc++site')
-        addUtility(sm, 'intid', IIntIds, IntIds())
+        setup.addUtility(sm, 'intid', IIntIds, IntIds())
         commit()
 
         type_name = 'BrowserAdd__zope.app.intid.IntIds'

Modified: Zope3/trunk/src/zope/app/intid/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/intid/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/intid/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/introspector/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,15 +18,16 @@
 __docformat__ = 'restructuredtext'
 
 from zope.interface import Interface
-from zope.app.introspector.interfaces import IIntrospector
-from zope.app.module.interfaces import IModuleService
-from zope.component import getService, getServiceDefinitions, getServices
 from zope.interface import implements, implementedBy
 from zope.interface import directlyProvides, directlyProvidedBy, providedBy
 from zope.interface.interfaces import IInterface
 from zope.interface.interface import InterfaceClass
 from zope.security.proxy import removeSecurityProxy
+
+from zope.app import zapi
 from zope.app.component.interface import searchInterface, getInterface
+from zope.app.introspector.interfaces import IIntrospector
+from zope.app.module import resolve
 
 class Introspector(object):
     """Introspects an object"""
@@ -54,9 +55,7 @@
         if path.find('++module++') != -1:
             if (self.context == Interface and
                 name != 'Interface._Interface.Interface'):
-                servicemanager = getServices()
-                adapter = IModuleService(servicemanager)
-                self.currentclass = adapter.resolve(name)
+                self.currentclass = resolve(name)
                 self.context = self.currentclass
             else:
                 self.currentclass = self.context
@@ -135,14 +134,6 @@
             removeSecurityProxy(self.currentclass).__bases__)
         return bases
 
-    def getInterfaceRegistration(self):
-        """Returns details for a interface configuration"""
-        service = []
-        for name, interface in getServiceDefinitions(self.context):
-            if self.context.extends(interface):
-                service.append(str(name))
-        return service
-
     def getDirectlyProvided(self):
         """See `IIntrospector`"""
         return directlyProvidedBy(removeSecurityProxy(self.context))
@@ -184,8 +175,8 @@
         results = []
         interfaces = searchInterface(self.context, base=base)
         for interface in interfaces:
-            # There are things registered with the interface service
-            # that are not interfaces. Yay!
+            # There are things registered with the site manager
+            # that are not interfaces. Duh!
             if not IInterface.providedBy(interface):
                 continue
             if base in interface.__bases__ and not interface.names():

Modified: Zope3/trunk/src/zope/app/introspector/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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.absoluteURL(sm, self.request)
         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/trunk/src/zope/app/introspector/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -59,11 +59,9 @@
     def getExtends():
         """Returns all the class extended up to the top most level"""
 
-    def getInterfaceRegistration():
-        """Returns details for a interface configuration"""
-
     def getMarkerInterfaces():
         """Returns a list of marker interfaces available for this object"""
 
     def getMarkerInterfaceNames():
-        """Returns a list of names of marker interfaces available for this object"""
+        """Returns a list of names of marker interfaces available for this
+        object"""

Modified: Zope3/trunk/src/zope/app/introspector/introspector.pt
===================================================================
--- Zope3/trunk/src/zope/app/introspector/introspector.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/introspector.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +16,7 @@
 <body>
 <div metal:fill-slot="body">
   <tal:block
-      tal:define="global introspector view/getIntrospector;
-                  global services view/getServicesFor">
+      tal:define="global introspector view/getIntrospector">
 
     <div tal:condition="python:introspector.isInterface()">
 
@@ -97,20 +96,6 @@
           </td>
         </tr>
 
-        <!-- this section is currently not available
-        <tr>
-          <th class="introspector">
-            <tal:span i18n:translate="">Services</tal:span>:
-          </th>
-          <td>
-            <div tal:repeat="servicedic services">
-              <span tal:define="dic repeat/servicedic/item">
-                <a tal:content="python:dic.keys()[0]"/>
-              </span>
-            </div>
-          </td>
-        </tr>
-        -->
       </table>
     </div>
 

Modified: Zope3/trunk/src/zope/app/introspector/marker.pt
===================================================================
--- Zope3/trunk/src/zope/app/introspector/marker.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/marker.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,6 @@
 <div metal:fill-slot="body">
   <tal:block
       tal:define ="global introspector view/getIntrospector;
-                   global services view/getServicesFor;
                    global status view/update">
 
   <form action="" tal:attributes="action request/URL" method="post">

Modified: Zope3/trunk/src/zope/app/introspector/tests/test_introspector.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/tests/test_introspector.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/tests/test_introspector.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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():
@@ -87,6 +87,12 @@
 
         verifyObject(IIntrospector, ints)
 
+    def test_setRequest(self):
+        ints = Introspector(Interface)
+        request = {'PATH_INFO': '++module++zope.app.introspector.Introspector'}
+        ints.setRequest(request)
+        self.assertEqual(ints.currentclass, Introspector)
+
     def test_getClass(self):
         ints = Introspector(TestClass())
         request = {}

Modified: Zope3/trunk/src/zope/app/introspector/tests/test_introspectorview.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/tests/test_introspectorview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/introspector/tests/test_introspectorview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/location/traversing.py
===================================================================
--- Zope3/trunk/src/zope/app/location/traversing.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/location/traversing.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/locking/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/locking/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/locking/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -63,7 +63,7 @@
     dict['__name__'] = name    
     sys.modules[name] = FakeModule(dict)
 
-    from zope.app.tests import ztapi
+    from zope.app.testing import ztapi
     from zope.interface import Interface
     from zope.app.locking.interfaces import ILockable, ILockTracker
     from zope.app.locking.adapter import LockingAdapterFactory
@@ -95,4 +95,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/trunk/src/zope/app/mail/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Mail service interfaces
+"""Mailer interfaces
 
 Email sending from Zope 3 applications works as follows:
 

Modified: Zope3/trunk/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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:
@@ -72,8 +71,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),
@@ -86,7 +84,7 @@
     _context.action(
         discriminator = ('utility', IMailer, name),
         callable = handler,
-        args = ('Utilities', 'provideUtility',
+        args = ('provideUtility',
                 IMailer, SendmailMailer(command), name)
         )
 
@@ -95,6 +93,6 @@
     _context.action(
         discriminator = ('utility', IMailer, name),
         callable = handler,
-        args = ('Utilities', 'provideUtility',
+        args = ('provideUtility',
                 IMailer, SMTPMailer(hostname, port, username, password), name)
         )

Modified: Zope3/trunk/src/zope/app/mail/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,12 +23,12 @@
 from zope.app.security.fields import Permission
 
 class IDeliveryDirective(Interface):
-    """This abstract directive describes a generic mail service
+    """This abstract directive describes a generic mail delivery utility
     registration."""
     
     name = TextLine(
         title=u"Name",
-        description=u'Specifies the Delivery name of the mail service. '\
+        description=u'Specifies the Delivery name of the mail utility. '\
                     u'The default is "Mail".',
         default=u"Mail",
         required=False)
@@ -45,7 +45,7 @@
 
 
 class IQueuedDeliveryDirective(IDeliveryDirective):
-    """This directive creates and registers a global queued mail service. It
+    """This directive creates and registers a global queued mail utility. It
     should be only called once during startup."""
 
     queuePath = Path(
@@ -55,12 +55,12 @@
 
 
 class IDirectDeliveryDirective(IDeliveryDirective):
-    """This directive creates and registers a global direct mail service. It
+    """This directive creates and registers a global direct mail utility. It
     should be only called once during startup."""
 
 
 class IMailerDirective(Interface):
-    """A generic directive registering a mailer for the mail service."""
+    """A generic directive registering a mailer for the mail utility."""
 
     name = TextLine(
         title=u"Name",

Modified: Zope3/trunk/src/zope/app/mail/tests/test_delivery.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_delivery.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/tests/test_delivery.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""MailService Implementation
+"""Mail Delivery Tests
 
 Simple implementation of the MailDelivery, Mailers and MailEvents.
 

Modified: Zope3/trunk/src/zope/app/mail/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/mail/tests/test_event.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_event.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/mail/tests/test_event.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,10 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""MailService Implementation
+"""Mailer Events Tests
 
-Simple implementation of the MailService, Mailers and MailEvents.
-
 $Id$
 """
 from unittest import TestCase, TestSuite, makeSuite

Modified: Zope3/trunk/src/zope/app/meta.zcml
===================================================================
--- Zope3/trunk/src/zope/app/meta.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/meta.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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,9 @@
 <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" />
+
+<!-- BBB: Goes away in 3.3 -->
 <include package="zope.app.site" file="meta.zcml" />
-<include package="zope.app.site.browser" file="meta.zcml" />
 
+
 </configure>

Copied: Zope3/trunk/src/zope/app/module/README.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/module/README.txt)

Modified: Zope3/trunk/src/zope/app/module/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/module/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,101 +11,57 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Manager for persistent modules associated with a service manager.
+"""Manager for persistent modules associated with a site manager.
 
 $Id$
 """
 __docformat__ = 'restructuredtext'
+import sys
+import zodbcode.interfaces
+import zodbcode.module
 
-from persistent import Persistent
-from zodbcode.module import PersistentModule, compileModule
 from zope.interface import implements
-from zope.security.proxy import removeSecurityProxy
-
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.filerepresentation.interfaces import IFileFactory
+from zope.app import zapi
 from zope.app.module.interfaces import IModuleManager
-from zope.app.container.contained import Contained
 
-class Manager(Persistent, Contained):
 
-    implements(IModuleManager, IAttributeAnnotatable)
+class ZopeModuleRegistry(object):
+    """ """
+    implements(zodbcode.interfaces.IPersistentModuleImportRegistry)
 
-    def __init__(self, name, source):
-        self.name = name
-        self._source = None
-        self.source = source
+    def findModule(self, name):
+        """See zodbcode.interfaces.IPersistentModuleImportRegistry"""
+        manager = zapi.queryUtility(IModuleManager, name)
+        return manager and manager.getModule() or manager
 
-    def __setstate__(self, state):
-        manager = state.get('_manager')
-        if manager is None:
-            return Persistent.__setstate__(self, state)
+    def modules(self):
+        """See zodbcode.interfaces.IPersistentModuleImportRegistry"""
+        return [name
+                for name, modulemgr in zapi.getUtilitiesFor(IModuleManager)]
 
-        # We need to convert an old-style manager
-        self._module = manager._module
-        self.name = manager.name
-        self._source = manager.source
-        self._recompile = False
+# Make Zope Module Registry a singelton
+ZopeModuleRegistry = ZopeModuleRegistry()
 
-    def execute(self):
-        try:
-            mod = self._module
-        except AttributeError:
-            mod = self._module = PersistentModule(self.name)
 
+def findModule(name, context=None):
+    """Find the module matching the provided name."""
+    module = ZopeModuleRegistry.findModule(name)
+    return module or sys.modules.get(name)
 
-        folder = self.__parent__
+def resolve(name, context=None):
+    """Resolve a dotted name to a Python object."""
+    pos = name.rfind('.')
+    mod = findModule(name[:pos], context)
+    return getattr(mod, name[pos+1:])
 
-        # TODO:
-        # We are currently only supporting trusted code.
-        # We don't want the folder to be proxied because, if it is, then
-        # the modules will be proxied.
-        # When we do support untrusted code, we're going to have to do
-        # something different.
-        folder = removeSecurityProxy(folder)
 
-        compileModule(mod, folder, self.source)
-        self._recompile = False
-
-    def getModule(self):
-        if self._recompile:
-            self.execute()
-        return self._module
-
-    
-    def _get_source(self):
-        return self._source
-    def _set_source(self, source):
-        if self._source != source:
-            self._source = source
-            self._recompile = True
-    source = property(_get_source, _set_source)
-
-
-# Hack to allow unpickling of old Managers to get far enough for __setstate__
-# to do it's magic:
-Registry = Manager
-
-
-class ModuleFactory(object):
-
-    implements(IFileFactory)
-
-    def __init__(self, context):
-        self.context = context
-
-    def __call__(self, name, content_type, data):
-        assert name.endswith(".py")
-        name = name[:-3]
-        m = Manager(name, data)
-        m.__parent__ = self.context
-        m.execute()
-        return m
-
-
 # Installer function that can be called from ZCML.
 # This installs an import hook necessary to support persistent modules.
+importer = zodbcode.module.PersistentModuleImporter()
 
 def installPersistentModuleImporter(event):
-    from zodbcode.module import PersistentModuleImporter
-    PersistentModuleImporter().install()
+    importer.install()
+
+def uninstallPersistentModuleImporter(event):
+    importer.uninstall()
+

Modified: Zope3/trunk/src/zope/app/module/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/module/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,41 +17,11 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.app.module import Manager
-from zope.event import notify
-from zope.app.event.objectevent import ObjectCreatedEvent
-from zope.app.publisher.browser import BrowserView
 from zope.proxy import removeAllProxies
-from zope.app.exception.interfaces import UserError
 
-from zope.app.i18n import ZopeMessageIDFactory as _
+class ViewModule(object):
 
-
-class AddModule(BrowserView):
-
-    def action(self, source):
-        name = self.context.contentName
-        if not name:
-            raise UserError(_(u"module name must be provided"))
-        mgr = Manager(name, source)
-        mgr = self.context.add(mgr)  # local registration
-        mgr.execute()
-        self.request.response.redirect(self.context.nextURL())
-        notify(ObjectCreatedEvent(mgr))
-
-class EditModule(BrowserView):
-
-    def update(self):
-        if "source" in self.request:
-            self.context.source = self.request["source"]
-            self.context.execute()
-            return _(u"The source was updated.")
-        else:
-            return u""
-
-class ViewModule(BrowserView):
-
-    def getModuleName(self):
+    def getModuleObjects(self):
         module = removeAllProxies(self.context.getModule())
         remove_keys = ['__name__', '__builtins__', '_p_serial']
 
@@ -63,9 +33,12 @@
              if id not in remove_keys]
         L.sort()
 
-        l_dict = [{"name": name, "doc": doc, "objtype": objtype} for name, doc, objtype in L]
+        l_dict = [{"name": name, "doc": doc, "objtype": objtype}
+                  for name, doc, objtype in L]
 
         for dic in l_dict:
-                if dic['objtype'].find('Class') != -1: dic['objtype'] = 'Class'
-                if dic['objtype'].find('Function') != -1: dic['objtype'] = 'Function'
+                if dic['objtype'].find('Class') != -1:
+                    dic['objtype'] = 'Class'
+                if dic['objtype'].find('Function') != -1:
+                    dic['objtype'] = 'Function'
         return l_dict

Deleted: Zope3/trunk/src/zope/app/module/browser/add_module.pt
===================================================================
--- Zope3/trunk/src/zope/app/module/browser/add_module.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/browser/add_module.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,18 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page">
-<head>
-  <title metal:fill-slot="title" i18n:translate="">Add a Module</title>
-</head>
-<body>
-  <div metal:fill-slot="body">
-
-  <p i18n:translate="">Enter the module source code.</p>
-
-  <form action="action.html">
-    <textarea name="source:text" cols="65" rows="25"></textarea>
-    <input type="submit" value="Add module" 
-           i18n:attributes="value add-module-button"/>
-  </form>
-
-</div>
-</body>
-</html>

Modified: Zope3/trunk/src/zope/app/module/browser/browse_module.pt
===================================================================
--- Zope3/trunk/src/zope/app/module/browser/browse_module.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/browser/browse_module.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -3,25 +3,26 @@
   <title metal:fill-slot="title" i18n:translate="">View Module Names</title>
 </head>
 <body>
-  <div metal:fill-slot="body">
- <table class="listingdescription" summary="Module Listing"
-      cellspacing="0" >
-    <thead>
-      <th>Name</th>
-      <th>Type</th>
-      <th>Description</th>
-    </thead>
-	<tal:repeat tal:repeat="dict view/getModuleName">
-    <tr tal:define="oddrow repeat/dict/odd;"
-        tal:attributes="class python:oddrow and 'even' or 'odd'">
-      <td tal:content="dict/name">An name</td>  
-      <td tal:content="dict/objtype">Type</td>  
-      <td tal:content="dict/doc">DocString</td>
-    </tr>
+<div metal:fill-slot="body">
+
+   <table class="listingdescription" summary="Module Listing"
+       cellspacing="0" >
+     <thead>
+       <th>Name</th>
+       <th>Type</th>
+       <th>Description</th>
+      </thead>
+      <tal:repeat tal:repeat="object view/getModuleObjects">
+      <tr tal:define="oddrow repeat/object/odd;"
+          tal:attributes="class python:oddrow and 'even' or 'odd'">
+        <td tal:content="object/name">An name</td>  
+        <td tal:content="object/objtype">Type</td>  
+        <td tal:content="object/doc">DocString</td>
+      </tr>
     </tal:repeat>
-	
 
- </table>
+   </table>
+
 </div>
 </body>
 </html>

Modified: Zope3/trunk/src/zope/app/module/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/module/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -3,38 +3,43 @@
     xmlns="http://namespaces.zope.org/browser"
     >
 
-  <page 
-      name="edit.html" 
-      for="zope.app.module.interfaces.IModuleManager"
-      menu="zmi_views" title="Edit"
-      class=".EditModule"
-      template="edit_module.pt" 
-      permission="zope.ManageServices"
+  <tool
+      interface="..interfaces.IModuleManager"
+      title="Persistent Python Modules"
+      description="Persistent Python Modules allow you to develop new Python
+                   through-the-Web and store them in the ZODB."
       />
 
-  <view for="zope.app.container.interfaces.IAdding"
-      name="Module"
-      class=".AddModule"
-      permission="zope.ManageServices"
-      >
-    <page name="index.html" template="add_module.pt" />
-    <page name="action.html" attribute="action" />
-  </view>
+  <addform
+      name="AddModule.html"
+      schema="..interfaces.IModuleManager"
+      label="Add Permission"
+      content_factory="..manager.ModuleManager"
+      fields="source"
+      permission="zope.ManageSite"
+      />
+
+  <addMenuItem
+      title="Module"
+      description="A Persistent Python Module"
+      class="..manager.ModuleManager"
+      view="AddModule.html"
+      permission="zope.ManageSite"
+      />
+
+  <editform
+      name="edit.html"
+      schema="..interfaces.IModuleManager"
+      label="Edit Module"
+      permission="zope.ManageSite"
+      menu="zmi_views" title="Edit" />
   
   <page
       name="browse.html"
       for="zope.app.module.interfaces.IModuleManager"
-      menu="zmi_views" title="Browse"
-      permission="zope.ManageServices"
       class=".ViewModule"
       template="browse_module.pt"
+      permission="zope.ManageSite"
+      menu="zmi_views" title="Browse"
       /> 
-
-  <menuItem 
-      menu="add_component" 
-      for="zope.app.container.interfaces.IAdding"
-      action="Module"  
-      title="Module" 
-      />
-
 </zope:configure>

Deleted: Zope3/trunk/src/zope/app/module/browser/edit_module.pt
===================================================================
--- Zope3/trunk/src/zope/app/module/browser/edit_module.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/browser/edit_module.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,21 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/view">
-<head>
-  <title metal:fill-slot="title" i18n:translate="">Edit a Module</title>
-</head>
-<body>
-<div metal:fill-slot="body">
-
-  <p i18n:translate="">Enter the module source code.</p>
-
-  <form action="edit.html">
-    <span tal:replace="view/update"></span>
-    <textarea name="source:text" cols="65" rows="25"
-              tal:content="context/source"></textarea>
-    <br />
-    <input type="submit" value="Save Changes"
-           i18n:attributes="value edit-button"/>
-  </form>
-
-</div>
-</body>
-</html>

Modified: Zope3/trunk/src/zope/app/module/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/module/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,18 +1,28 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
-  <content class=".Manager">
+  <localUtility class=".manager.ModuleManager">
     <require
         permission="zope.ManageCode"
         interface=".interfaces.IModuleManager"
         set_schema=".interfaces.IModuleManager"
         />
-  </content>
+  </localUtility>
 
+  <subscriber
+     for="..component.interfaces.registration.IRegistrationActivatedEvent"
+     handler=".manager.setNameOnActivation"
+     />
+
+  <subscriber
+     for="..component.interfaces.registration.IRegistrationDeactivatedEvent"
+     handler=".manager.unsetNameOnDeactivation"
+     />
+
   <adapter
-      for="zope.app.site.interfaces.ISiteManagementFolder"
+      for="zope.app.component.interfaces.ISiteManagementFolder"
       provides="zope.app.filerepresentation.interfaces.IFileFactory"
       name=".py"
-      factory=".ModuleFactory"
+      factory=".manager.ModuleFactory"
       permission="zope.ManageContent"
       />
 

Modified: Zope3/trunk/src/zope/app/module/fssync/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/module/fssync/adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/fssync/adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,3 +1,4 @@
+
 ##############################################################################
 #
 # Copyright (c) 2002 Zope Corporation and Contributors.

Modified: Zope3/trunk/src/zope/app/module/fssync/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/module/fssync/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/fssync/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -4,7 +4,7 @@
     >
 
   <fssync:adapter
-      class="zope.app.module.Manager"
+      class="zope.app.module.manager.ModuleManager"
       factory=".adapter.ModuleAdapter"
       />
 

Modified: Zope3/trunk/src/zope/app/module/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/module/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/module/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,11 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Interfaces needed by the module service.
+"""Interfaces needed for the persistent module framework.
 
-TODO: There is no module service yet; instead, the service manager
-currently implements it.  This should change.
-
 $Id$
 """
 __docformat__ = 'restructuredtext'
@@ -43,16 +40,3 @@
 
     source = ASCII(title=u"The module's source code.")
 
-
-class IModuleService(Interface):
-    """Objects that can resolve dotted names to objects
-    """
-
-    def resolve(dotted_name):
-        """Resolve the given dotted name to a module global variable.
-
-        If the name ends with a trailing dot, the last name segment
-        may be repeated.
-
-        If the dotted name cannot be resolved, an ``ImportError`` is raised.
-        """

Copied: Zope3/trunk/src/zope/app/module/manager.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/module/manager.py)

Copied: Zope3/trunk/src/zope/app/module/tests.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/module/tests.py)

Modified: Zope3/trunk/src/zope/app/observable/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/observable/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/observable/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,3 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Observable tests
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
 import unittest
 from persistent import Persistent
 from zope.interface import implements
@@ -2,3 +21,3 @@
 from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.tests.functional import FunctionalDocFileSuite
+from zope.app.testing.functional import FunctionalDocFileSuite
 

Modified: Zope3/trunk/src/zope/app/onlinehelp/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/onlinehelp/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -76,7 +76,7 @@
         source = zapi.createObject(None,
                                    self.context.type,
                                    self.context.source)
-        view = zapi.getView(source, '', self.request)
+        view = zapi.getMultiAdapter((source, self.request))
         html = view.render()
         return html
 
@@ -94,7 +94,7 @@
         source = zapi.createObject(None,
                                    topic.type,
                                    topic.source)
-        view = zapi.getView(source, '', self.request)
+        view = zapi.getMultiAdapter((source, self.request))
         html = view.render()
         return html
 

Modified: Zope3/trunk/src/zope/app/onlinehelp/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/onlinehelp/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,7 +21,7 @@
 
 from zope.app.folder.interfaces import IRootFolder
 from zope.app.file import File
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.onlinehelp.tests.test_onlinehelp import testdir
 from zope.app.onlinehelp import help
 

Modified: Zope3/trunk/src/zope/app/onlinehelp/onlinehelp.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/onlinehelp.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/onlinehelp/onlinehelp.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/onlinehelp/tests/test_helpdirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/tests/test_helpdirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/onlinehelp/tests/test_helpdirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/onlinehelp/tests/test_onlinehelp.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/tests/test_onlinehelp.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/onlinehelp/tests/test_onlinehelp.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagelet/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagelet/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -160,7 +160,7 @@
   
 Setup:
   
-  >>> adaptersrv = zope.component.getService('Adapters')
+  >>> gsm = zapi.getGlobalSiteManager()
   
 Register slot interface:
 
@@ -189,14 +189,14 @@
   >>> name = 'testpagelet'
   >>> 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)
 
@@ -210,7 +210,7 @@
 
   >>> from zope.app.pagelet.tests import testfiles
   >>> import os.path
-  >>> path = os.path.join(os.path.dirname(__file__), 'tests', 'testfiles')
+  >>> path = os.path.dirname(testfiles.__file__)
   >>> index = ViewPageTemplateFile('index_pagelets.pt', path)
 
 Call the 'index' (view) on the browser view instance the sample pagelet

Modified: Zope3/trunk/src/zope/app/pagelet/collector.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/collector.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagelet/collector.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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)
 
@@ -113,7 +112,7 @@
 class MacroCollector(object):
     """Replaceable sample implementation of IMacroCollector.
     
-    Collect a single pagelet from the adapter service and returns 
+    Collect a single pagelet from the site manager and returns 
     a macro by name.
     Pagelet adapters are registred on context, request, view and slot
     interfaces. Use your own IMacroCollector implementation for
@@ -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/trunk/src/zope/app/pagelet/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagelet/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagelet/tales.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/tales.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagelet/tales.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagelet/tests/test_pagelet.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/tests/test_pagelet.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagelet/tests/test_pagelet.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pageletchooser/adapters.py
===================================================================
--- Zope3/trunk/src/zope/app/pageletchooser/adapters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pageletchooser/adapters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pageletchooser/collector.py
===================================================================
--- Zope3/trunk/src/zope/app/pageletchooser/collector.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pageletchooser/collector.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pageletchooser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pageletchooser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pageletchooser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -35,7 +35,7 @@
       name="chooseablepageletnames"
       factory=".vocabulary.PageletNamesVocabulary"
       layer="zope.publisher.interfaces.browser.IBrowserRequest"
-      view="zope.component.interfaces.IView"
+      view="zope.component.bbb.interfaces.IView"
       slot="zope.app.pageletchooser.interfaces.IChooseablePagelets"
       />
 

Modified: Zope3/trunk/src/zope/app/pageletchooser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/pageletchooser/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pageletchooser/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pageletchooser/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/pageletchooser/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pageletchooser/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagetemplate/engine.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/engine.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/engine.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagetemplate/simpleviewclass.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/simpleviewclass.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/simpleviewclass.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -37,21 +37,22 @@
 
         raise NotFound(self, name, request)
 
-    # XXX: we need some unittests for this !!!
     def __getitem__(self, name):
         return self.index.macros[name]
 
     def __call__(self, *args, **kw):
         return self.index(*args, **kw)
 
-def SimpleViewClass(src, offering=None, used_for=None, bases=()):
+
+def SimpleViewClass(src, offering=None, used_for=None, bases=(), name=u''):
     if offering is None:
         offering = sys._getframe(1).f_globals
 
     bases += (simple, )
 
     class_ = type("SimpleViewClass from %s" % src, bases,
-                  {'index': ViewPageTemplateFile(src, offering)})
+                  {'index': ViewPageTemplateFile(src, offering),
+                   '__name__': name})
 
     if used_for is not None:
         class_.__used_for__ = used_for

Modified: Zope3/trunk/src/zope/app/pagetemplate/tests/test_binding.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/tests/test_binding.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/tests/test_binding.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagetemplate/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagetemplate/tests/test_simpleviewclass.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/tests/test_simpleviewclass.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/tests/test_simpleviewclass.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,14 +17,15 @@
 """
 import unittest
 
+from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
+from zope.app.pagetemplate.tests.simpletestview import SimpleTestView
+from zope.publisher.browser import TestRequest
+
 class data(object): pass
 
 class SimpleViewTestCase(unittest.TestCase):
 
     def test_simple(self):
-        from zope.app.pagetemplate.tests.simpletestview import SimpleTestView
-        from zope.publisher.browser import TestRequest
-
         ob = data()
         request = TestRequest()
         view = SimpleTestView(ob, request)
@@ -36,10 +37,18 @@
                          '    <p>hello world</p>\n'
                          '  </body>\n</html>\n')
 
+    def test_name(self):
+        View = SimpleViewClass('testsimpleviewclass.pt', name='test.html')
+        view = View(None, None)
+        self.assertEqual(view.__name__, 'test.html')
+
+    def test_getitem(self):
+        View = SimpleViewClass('testsimpleviewclass.pt', name='test.html')
+        view = View(None, None)
+        self.assert_(view['test'] is not None)
+        self.assertRaises(KeyError, view.__getitem__, 'foo')
+
     def test_WBases(self):
-        from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-        from zope.publisher.browser import TestRequest
-
         class C(object): pass
 
         SimpleTestView = SimpleViewClass('testsimpleviewclass.pt', bases=(C, ))

Modified: Zope3/trunk/src/zope/app/pagetemplate/tests/test_viewzpt.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/tests/test_viewzpt.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/tests/test_viewzpt.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/pluggableauth/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,9 +11,9 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Pluggable Authentication service implementation.
+"""Pluggable Authentication utility implementation.
 
-BBB: ENTIRE PACKAGE IS DEPRECATED!!! 12/05/2004
+BBB: ENTIRE PACKAGE IS DEPRECATED!!! 12/05/2004 Gone in 3.3
 
 $Id$
 """
@@ -24,7 +24,6 @@
 import time
 import random
 import zope.schema
-
 from warnings import warn
 from persistent import Persistent
 from BTrees.IOBTree import IOBTree
@@ -32,12 +31,10 @@
 
 from zope.interface import implements
 from zope.component.interfaces import IViewFactory
-from zope.app.security.interfaces import PrincipalLookupError
+from zope.deprecation import deprecated
 
 from zope.app import zapi
-from zope.app.location import locate
-from zope.app.traversing.api import getPath
-
+from zope.app.component import queryNextUtility
 from zope.app.container.interfaces import IOrderedContainer
 from zope.app.container.interfaces import IContainerNamesContainer, INameChooser
 from zope.app.container.interfaces import IContained
@@ -45,12 +42,12 @@
 from zope.app.container.constraints import ContainerTypesConstraint
 from zope.app.container.contained import Contained, setitem, uncontained
 from zope.app.container.ordered import OrderedContainer
+from zope.app.location import locate
+from zope.app.security.interfaces import ILoginPassword, IAuthentication
+from zope.app.security.interfaces import PrincipalLookupError
+from zope.app.traversing.api import getPath
 
-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 IUserSchemafied, IPluggableAuthentication
 from interfaces import IPrincipalSource, ILoginPasswordPrincipalSource
 from interfaces import IContainedPrincipalSource, IContainerPrincipalSource
 
@@ -59,9 +56,9 @@
 
     return random.randint(0, sys.maxint-1)
 
-class PluggableAuthenticationService(OrderedContainer):
+class PluggableAuthentication(OrderedContainer):
 
-    implements(IPluggableAuthenticationService, IOrderedContainer)
+    implements(IPluggableAuthentication, IOrderedContainer)
 
     def __init__(self, earmark=None, hide_deprecation_warning=False):
         if not hide_deprecation_warning:
@@ -70,11 +67,11 @@
                  DeprecationWarning, 2)        
         self.earmark = earmark
         # The earmark is used as a token which can uniquely identify
-        # this authentication service instance even if the service moves
+        # this authentication utility instance even if the utility moves
         # from place to place within the same context chain or is renamed.
         # It is included in principal ids of principals which are obtained
-        # from this auth service, so code which dereferences a principal
-        # (like getPrincipal of this auth service) needs to take the earmark
+        # from this auth utility, so code which dereferences a principal
+        # (like getPrincipal of this auth utility) needs to take the earmark
         # into account. The earmark cannot change once it is assigned.  If it
         # does change, the system will not be able to dereference principal
         # references which embed the old earmark.
@@ -83,27 +80,27 @@
     def authenticate(self, request):
         """ See `IAuthentication`. """
         for ps_key, ps in self.items():
-            loginView = zapi.queryView(ps, "login", request)
+            loginView = zapi.queryMultiAdapter((ps, request), name="login")
             if loginView is not None:
                 principal = loginView.authenticate()
                 if principal is not None:
                     return principal
 
-        next = queryNextService(self, Authentication, None)
+        next = queryNextUtility(self, IAuthentication, None)
         if next is not None:
             return next.authenticate(request)
 
         return None
 
     def unauthenticatedPrincipal(self):
-        # It's safe to assume that the global auth service will
+        # It's safe to assume that the global auth utility will
         # provide an unauthenticated principal, so we won't bother.
         return None
 
     def unauthorized(self, id, request):
         """ See `IAuthentication`. """
 
-        next = queryNextService(self, Authentication, None)
+        next = queryNextUtility(self, IAuthentication)
         if next is not None:
             return next.unauthorized(id, request)
 
@@ -114,11 +111,11 @@
 
         For this implementation, an `id` is a string which can be
         split into a 3-tuple by splitting on tab characters.  The
-        three tuple consists of (`auth_service_earmark`,
+        three tuple consists of (`auth_utility_earmark`,
         `principal_source_id`, `principal_id`).
 
         In the current strategy, the principal sources that are members
-        of this authentication service cannot be renamed; if they are,
+        of this authentication utility cannot be renamed; if they are,
         principal references that embed the old name will not be
         dereferenceable.
 
@@ -130,11 +127,11 @@
             auth_svc_earmark, principal_src_id, principal_id = id.split('\t',2)
         except (TypeError, ValueError, AttributeError):
             auth_svc_earmark, principal_src_id, principal_id = None, None, None
-            next = queryNextService(self, Authentication, None)
+            next = queryNextUtility(self, IAuthentication)
 
         if auth_svc_earmark != self.earmark:
             # this is not our reference because its earmark doesnt match ours
-            next = queryNextService(self, Authentication, None)
+            next = queryNextUtility(self, IAuthentication)
 
         if next is not None:
             return next.getPrincipal(id)
@@ -151,15 +148,15 @@
             for p in ps.getPrincipals(name):
                 yield p
 
-        next = queryNextService(self, Authentication, None)
+        next = queryNextUtility(self, IAuthentication)
         if next is not None:
             for p in next.getPrincipals(name):
                 yield p
 
     def addPrincipalSource(self, id, principal_source):
-        """ See `IPluggableAuthenticationService`.
+        """ See `IPluggableAuthentication`.
 
-        >>> pas = PluggableAuthenticationService(None, True)
+        >>> pas = PluggableAuthentication(None, True)
         >>> sps = BTreePrincipalSource()
         >>> pas.addPrincipalSource('simple', sps)
         >>> sps2 = BTreePrincipalSource()
@@ -174,9 +171,9 @@
         self[id] = principal_source        
 
     def removePrincipalSource(self, id):
-        """ See `IPluggableAuthenticationService`.
+        """ See `IPluggableAuthentication`.
 
-        >>> pas = PluggableAuthenticationService(None, True)
+        >>> pas = PluggableAuthentication(None, True)
         >>> sps = BTreePrincipalSource()
         >>> pas.addPrincipalSource('simple', sps)
         >>> sps2 = BTreePrincipalSource()
@@ -193,10 +190,18 @@
         del self[id]
 
 
-def PluggableAuthenticationServiceAddSubscriber(self, event):
+# BBB: Gone in 3.3.
+PluggableAuthenticationService = PluggableAuthentication
+
+deprecated('PluggableAuthenticationService',
+           'The pluggable authentication service has been deprecated in '
+           'favor of authentication (aka PAS). This reference will be gone in '
+           'Zope X3.3.')
+
+def PluggableAuthenticationAddSubscriber(self, event):
     r"""Generates an earmark if one is not provided.
 
-    Define a stub for `PluggableAuthenticationService`
+    Define a stub for `PluggableAuthentication`
 
     >>> from zope.app.traversing.interfaces import IPhysicallyLocatable
     >>> class PluggableAuthStub(object):
@@ -206,22 +211,22 @@
     ...     def getName(self):
     ...         return 'PluggableAuthName'
 
-    The subscriber generates an earmark for the auth service if one is not
+    The subscriber generates an earmark for the auth utility if one is not
     set in the init.
 
     >>> stub = PluggableAuthStub()
     >>> event = ''
-    >>> PluggableAuthenticationServiceAddSubscriber(stub, event)
+    >>> PluggableAuthenticationAddSubscriber(stub, event)
     >>> stub.earmark is not None
     True
 
-    The subscriber does not modify an earmark for the auth service if one
+    The subscriber does not modify an earmark for the auth utility if one
     exists already.
 
     >>> earmark = 'my sample earmark'
     >>> stub = PluggableAuthStub(earmark=earmark)
     >>> event = ''
-    >>> PluggableAuthenticationServiceAddSubscriber(stub, event)
+    >>> PluggableAuthenticationAddSubscriber(stub, event)
     >>> stub.earmark == earmark
     True
     """

Modified: Zope3/trunk/src/zope/app/pluggableauth/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -2,20 +2,20 @@
    xmlns="http://namespaces.zope.org/browser"
    xmlns:zope="http://namespaces.zope.org/zope">
 
-<!-- Pluggable Authentication Service -->
+<!-- Pluggable Authentication -->
 
   <!-- BBB: Deactivated as a deprecation measure. -->
   <!--addMenuItem
-       class="zope.app.pluggableauth.PluggableAuthenticationService"
-       title="Authentication Service"
+       class="zope.app.pluggableauth.PluggableAuthentication"
+       title="Authentication"
        description="A Pluggable Authentication uses plug-in principal sources."
-       permission="zope.ManageServices"
+       permission="zope.ManageSite"
        /-->
 
   <containerViews
-       for="zope.app.pluggableauth.interfaces.IPluggableAuthenticationService"
-       contents="zope.ManageServices"
-       add="zope.ManageServices"
+       for="zope.app.pluggableauth.interfaces.IPluggableAuthentication"
+       contents="zope.ManageSite"
+       add="zope.ManageSite"
        />
 
 <!-- Principal Source -->
@@ -23,13 +23,13 @@
   <addMenuItem
       title="Add Principal Source" 
       class="zope.app.pluggableauth.BTreePrincipalSource"	
-      permission="zope.ManageServices"
+      permission="zope.ManageSite"
       />
 
   <containerViews
        for="zope.app.pluggableauth.interfaces.IContainerPrincipalSource"
-       contents="zope.ManageServices"
-       add="zope.ManageServices"
+       contents="zope.ManageSite"
+       add="zope.ManageSite"
        />
 
 <!-- Principal -->
@@ -48,7 +48,7 @@
   <addMenuItem
       title="Principal" 
       class="zope.app.pluggableauth.SimplePrincipal"
-      permission="zope.ManageServices"
+      permission="zope.ManageSite"
       view="AddPrincipalForm.html"
       />
 

Modified: Zope3/trunk/src/zope/app/pluggableauth/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -2,13 +2,13 @@
     xmlns="http://namespaces.zope.org/zope"
     xmlns:browser="http://namespaces.zope.org/browser">
 
-  <localService class=".PluggableAuthenticationService">
+  <localUtility class=".PluggableAuthentication">
     <factory
-        id="zope.app.services.PluggableAuthenticationService"
+        id="zope.app.services.PluggableAuthentication"
         />
     <require
-        permission="zope.ManageServices"
-        interface=".interfaces.IPluggableAuthenticationService"
+        permission="zope.ManageSite"
+        interface=".interfaces.IPluggableAuthentication"
         />
 <!--
     <allow
@@ -16,20 +16,20 @@
         />
 
     <require
-        permission="zope.ManageServices"
+        permission="zope.ManageSite"
         interface="zope.app.container.interfaces.IWriteContainer"
         />
 -->
     <require
-        permission="zope.ManageServices"
+        permission="zope.ManageSite"
         interface="zope.app.site.interfaces.ISimpleService"
         />
-  </localService>
+  </localUtility>
 
   <subscriber
-        for=".interfaces.IPluggableAuthenticationService
+        for=".interfaces.IPluggableAuthentication
              zope.app.container.interfaces.IObjectAddedEvent"
-        handler=".PluggableAuthenticationServiceAddSubscriber"
+        handler=".PluggableAuthenticationAddSubscriber"
         />
 
   <content class=".BTreePrincipalSource">
@@ -40,7 +40,7 @@
         interface="zope.app.container.interfaces.IReadContainer"
         />
     <require
-        permission="zope.ManageServices"
+        permission="zope.ManageSite"
         interface="zope.app.container.interfaces.IWriteContainer
                    zope.app.container.interfaces.INameChooser"
         />
@@ -57,7 +57,7 @@
         interface=".interfaces.IUserSchemafied"
         />
     <require
-        permission="zope.ManageServices"
+        permission="zope.ManageSite"
         set_schema=".interfaces.IUserSchemafied"
         />
   </content>

Modified: Zope3/trunk/src/zope/app/pluggableauth/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Pluggable Authentication service.
+"""Pluggable Authentication Utility.
 
 $Id$
 """
@@ -55,14 +55,14 @@
         found.
 
         Note that the id has three parts, separated by tabs.  The
-        first two part are an authentication service id and a
+        first two part are an authentication utility id and a
         principal source id.  The pricipal source will typically need
         to remove the two leading parts from the id when doing it's
         own internal lookup.
 
-        Note that the authentication service nearest to the requested
-        resource is called. It is up to authentication service
-        implementations to collaborate with services higher in the
+        Note that the authentication utility nearest to the requested
+        resource is called. It is up to authentication utility
+        implementations to collaborate with utilities higher in the
         object hierarchy.
         """
 
@@ -74,8 +74,8 @@
         """
 
 
-class IPluggableAuthenticationService(IAuthentication, IContainer):
-    """An `AuthenticationService` that can contain multiple pricipal sources.
+class IPluggableAuthentication(IAuthentication, IContainer):
+    """An `Authentication` utility that can contain multiple pricipal sources.
     """
 
     def __setitem__(id, principal_source):
@@ -113,8 +113,8 @@
 
 class IContainedPrincipalSource(IPrincipalSource, IContained):
     """This is a marker interface for principal sources that can be directly
-    added to an authentication service. It ensures that principal source can
-    **only** be added to pluggable authentication services."""
+    added to an authentication utility. It ensures that principal source can
+    **only** be added to pluggable authentication utilities."""
 
     __parent__= Field(
-        constraint = ContainerTypesConstraint(IPluggableAuthenticationService))
+        constraint = ContainerTypesConstraint(IPluggableAuthentication))

Modified: Zope3/trunk/src/zope/app/pluggableauth/tests/authsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/tests/authsetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/tests/authsetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Setup local Pluggable Authentication Service for tests
+"""Setup local Pluggable Authentication for tests
 
 This setup class can be used, if a set of local principals are required for a
 test.
@@ -21,27 +21,27 @@
 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.interfaces import ILoginPassword, IAuthentication
 from zope.app.security.basicauthadapter import BasicAuthAdapter
 from zope.app.pluggableauth import \
-     PrincipalAuthenticationView, PluggableAuthenticationService, \
+     PrincipalAuthenticationView, PluggableAuthentication, \
      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",
                           PrincipalAuthenticationView)
 
-        auth = setup.addService(sm, "PluggableAuthService",
-                                PluggableAuthenticationService(None, True))
+        auth = setup.addUtility(sm, '', IAuthentication,
+                                PluggableAuthentication(None, True))
 
         one = BTreePrincipalSource()
         two = BTreePrincipalSource()

Modified: Zope3/trunk/src/zope/app/pluggableauth/tests/test_pluggableauth.py
===================================================================
--- Zope3/trunk/src/zope/app/pluggableauth/tests/test_pluggableauth.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pluggableauth/tests/test_pluggableauth.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,25 +20,25 @@
 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.site.tests 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, \
+     SimplePrincipal, PluggableAuthentication, \
      PrincipalAuthenticationView
 from zope.app.pluggableauth.interfaces import IPrincipalSource
 
 from zope.app.pluggableauth.interfaces import IUserSchemafied
 from zope.app.security.interfaces import IPrincipal, ILoginPassword
+from zope.app.security.interfaces import IAuthentication
 from zope.app.security.basicauthadapter import BasicAuthAdapter
 
 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
 
@@ -52,8 +52,8 @@
         ztapi.browserView(IPrincipalSource, "login",
                           PrincipalAuthenticationView)
 
-        auth = setup.addService(sm, "TestPluggableAuthenticationService",
-                                PluggableAuthenticationService(None, True))
+        auth = setup.addUtility(sm, "", IAuthentication,
+                                PluggableAuthentication(None, True))
 
         one = BTreePrincipalSource()
         two = BTreePrincipalSource()
@@ -88,9 +88,9 @@
         return Request(**dict)
 
 
-class AuthServiceTest(Setup):
+class AuthUtilityTest(Setup):
 
-    def testAuthServiceAuthenticate(self):
+    def testAuthUtilityAuthenticate(self):
         auth = self._auth
         req = self.getRequest('slinkp', '123')
         pid = auth.authenticate(req).getLogin()
@@ -120,7 +120,7 @@
     def _fail_BadIdLength(self):
         self._auth.getPrincipal((self._auth.earmark, None, None))
 
-    def testAuthServiceGetPrincipal(self):
+    def testAuthUtilityGetPrincipal(self):
         auth = self._auth
         id = self._slinkp.id
         self.assertEqual(self._slinkp, auth.getPrincipal(id))
@@ -159,12 +159,13 @@
 
 
 def test_suite():
-    t1 = makeSuite(AuthServiceTest)
-    t2 = DocTestSuite('zope.app.pluggableauth',
-                      setUp=setUp, tearDown=tearDown)
-    t3 = makeSuite(BTreePrincipalSourceTest)
-    t4 = makeSuite(PrincipalAuthenticationViewTest)
-    return TestSuite((t1, t2, t3, t4))
+    return TestSuite((
+        makeSuite(AuthUtilityTest),
+        DocTestSuite('zope.app.pluggableauth',
+                     setUp=setUp, tearDown=tearDown),
+        makeSuite(BTreePrincipalSourceTest),
+        makeSuite(PrincipalAuthenticationViewTest)
+        ))
 
 
 if __name__=='__main__':

Modified: Zope3/trunk/src/zope/app/presentation/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,6 +16,3 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
-
-from zope.app.presentation.presentation import IPageRegistration
-from zope.app.presentation.presentation import PageRegistration

Copied: Zope3/trunk/src/zope/app/presentation/browser.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.py)

Copied: Zope3/trunk/src/zope/app/presentation/browser.zcml (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.zcml)

Modified: Zope3/trunk/src/zope/app/presentation/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/presentation/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,39 +1,136 @@
 <configure
-    xmlns='http://namespaces.zope.org/zope'
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:fssync="http://namespaces.zope.org/fssync"
     i18n_domain="zope"
     >
 
-<content class=".presentation.ViewRegistration">
-  <require
-      permission="zope.ManageServices"
-      interface=".presentation.IViewRegistration"
-      set_schema="zope.app.registration.interfaces.IRegistration"
+  <content class=".registration.PageRegistration">
+    <require
+        permission="zope.ManageSite"
+        interface=".interfaces.IPageRegistration"
+        set_schema=".interfaces.IPageRegistration"
+        />
+  </content>
+  
+  <class class=".registration.Registered">
+    <allow attributes="registrations" />
+  </class>
+
+  <adapter
+      for=".interfaces.IZPTTemplate"
+      provides="..component.interfaces.registration.IRegistered"
+      factory=".registration.Registered"
+      trusted="true"
       />
-</content>
 
-<content class=".presentation.PageRegistration">
-  <require
-      permission="zope.ManageServices"
-      interface=".presentation.IPageRegistration"
-      set_schema=".presentation.IPageRegistration"
+  <subscriber
+      handler=".registration.PageRegistrationAddSubscriber"
+      for=".interfaces.IPageRegistration 
+           zope.app.container.interfaces.IObjectAddedEvent"
       />
-</content>
+  
+  <subscriber
+      handler=".registration.PageRegistrationRemoveSubscriber"
+      for=".interfaces.IPageRegistration 
+           zope.app.container.interfaces.IObjectRemovedEvent"
+      />
 
-<subscriber
-    handler=".presentation.PageRegistrationAddSubscriber"
-    for=".presentation.IPageRegistration 
-         zope.app.container.interfaces.IObjectAddedEvent"
-    />
+  <!-- Page Folder -->
 
-<subscriber
-    handler=".presentation.PageRegistrationRemoveSubscriber"
-    for=".presentation.IPageRegistration 
-         zope.app.container.interfaces.IObjectRemovedEvent"
-    />
+  <content class=".pagefolder.PageFolder">
+    <factory
+        id="zope.app.presentation.pagefolder.PageFolder"
+        title="View Folder"
+        />
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" 
+        />
+    <require
+        permission="zope.View"
+        interface="zope.app.container.interfaces.IReadContainer" 
+        />
+    <require
+        permission="zope.ManageSite"
+        interface="zope.app.container.interfaces.IWriteContainer
+                   .interfaces.IPageFolderInfo"
+        set_schema=".interfaces.IPageFolderInfo"
+        attributes="registrationManager applyDefaults" 
+        />
+  </content>
+  
+  <adapter
+      for=".interfaces.IPageFolder"
+      provides="zope.app.filerepresentation.interfaces.IFileFactory"
+      factory=".zpt.ZPTFactory"
+      permission="zope.ManageSite"
+      />
+  
+  <adapter 
+      for="zope.app.site.interfaces.ISiteManagementFolder"
+      provides="zope.app.filerepresentation.interfaces.IDirectoryFactory"
+      factory=".pagefolder.PageFolderFactory"
+      permission="zope.ManageContent"
+      />
+  
+  <subscriber
+      handler=".pagefolder.templateAddedSubscriber"
+      for=".interfaces.IZPTTemplate
+           zope.app.container.interfaces.IObjectAddedEvent"
+      />
+  
+  <subscriber
+      handler=".pagefolder.templateRemovedSubscriber"
+      for=".interfaces.IZPTTemplate
+           zope.app.container.interfaces.IObjectRemovedEvent"
+      />
 
-<include file="pagefolder.zcml" />
-<include file="zpt.zcml" />
 
-<include package=".browser" />
+  <!-- Page Templates  -->
+  
+  <content class=".zpt.ZPTTemplate">
+    <factory
+        title="zope.app.ZPTTemplate"
+        description="Persistent View Page Template"
+        />
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="zope.View"
+        attributes="__call__"
+        />
+    <require
+        permission="zope.ManageServices"
+        interface=".interfaces.IZPTTemplate"
+        set_schema=".interfaces.IZPTTemplate"
+        />
+  </content>
+  
+  <adapter
+      for=".interfaces.IZPTTemplate"
+      provides="zope.app.filerepresentation.interfaces.IReadFile"
+      factory=".zpt.ReadFile"
+      permission="zope.ManageSite"
+      />
+  
+  <adapter
+      for=".interfaces.IZPTTemplate"
+      provides="zope.app.filerepresentation.interfaces.IWriteFile"
+      factory=".zpt.WriteFile"
+      permission="zope.ManageSite"
+      />
+  
+  <!-- Filesystem synchronization support -->
+  <fssync:adapter
+      class=".pagefolder.PageFolder"
+      factory=".fssync.PageFolderAdapter"
+      />
 
+  <fssync:adapter
+      class=".zpt.ZPTTemplate"
+      factory=".fssync.ZPTPageAdapter"
+      />
+  
+  <include file="browser.zcml" />
+
 </configure>

Copied: Zope3/trunk/src/zope/app/presentation/fssync.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/fssync.py)

Copied: Zope3/trunk/src/zope/app/presentation/interfaces.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/interfaces.py)

Modified: Zope3/trunk/src/zope/app/presentation/pagefolder.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/pagefolder.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/pagefolder.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,88 +21,23 @@
 __docformat__ = 'restructuredtext'
 
 from zope.interface import Interface, implements
-from zope.schema import BytesLine, Bool, Field, Choice
-
-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.container.constraints import ItemTypePrecondition
-from zope.app.presentation import PageRegistration
-from zope.app.registration.registration import RegisterableContainer
-from zope.app.container.constraints import ContainerTypesConstraint
-from zpt import IZPTTemplate
-from zope.app.traversing.api import getPath
 from zope.proxy import removeAllProxies
 from zope.publisher.interfaces.browser import IBrowserRequest
 
-from zope.app.container.interfaces import IContainer
+from zope.app import zapi
+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.component.registration import RegisterableContainer
+from zope.app.container.btree import BTreeContainer
 from zope.app.filerepresentation.interfaces import IDirectoryFactory
-from zope.fssync.server.interfaces import IObjectDirectory
-from zope.app.registration.interfaces import IRegisterableContainer
-from zope.app.i18n import ZopeMessageIDFactory as _
 
-class IPageFolderInfo(Interface):
-    """Default registration information for page folders
+import interfaces
+import registration
 
-    This information is used to configure the pages in the folder.
-    """
-
-    required = Choice(
-        title = _(u"For interface"),
-        description = _(u"The interface of the objects being viewed"),
-        vocabulary="Interfaces",
-        required = True,
-        )
-
-    factoryName = BytesLine(
-        title=_(u"The dotted name of a factory for creating the view"),
-        required = False,
-        )
-
-    layer = BytesLine(
-        title = _(u"Layer"),
-        description = _(u"The skin layer the view is registered for"),
-        required = False,
-        min_length = 1,
-        default = "default",
-        )
-
-    permission = Choice(
-        title=_(u"Permission"),
-        description=_(u"The permission required to use the view"),
-        vocabulary="Permission Ids",
-        required = True,
-        )
-
-    apply = Bool(
-        title=_(u"Apply changes to existing pages"),
-        required = True,
-        )
-
-class IPageFolder(IPageFolderInfo, IContainer, IRegisterableContainer):
-
-    def applyDefaults(self):
-        """Apply the default configuration to the already-registered pages. 
-        """
-
-    def __setitem__(name, template):
-        """Add a template to the folder
-        """
-
-    __setitem__.precondition = ItemTypePrecondition(IZPTTemplate)
-    
-    __parent__ = Field(
-        constraint = ContainerTypesConstraint(IRegisterableContainer))
-
-
 class PageFolder(RegisterableContainer, BTreeContainer):
 
-    implements(IPageFolder)
+    implements(interfaces.IPageFolder)
 
     requestType = IBrowserRequest
     layer = "default"
@@ -113,84 +48,54 @@
     template = None
     apply = True
 
-    ########################################################
-    # The logic for managing registrations is handled by the
-    # decorator class below.
-    ########################################################
-
-
-    def __setitem__(self, name, object):
-        if (IRegistrationManager.providedBy(object) or
-            IZPTTemplate.providedBy(object)):
-            super(PageFolder, self).__setitem__(name, object)
-        else:
-            raise TypeError("Can only add templates", object)
-
-
-        # If a template is added, we need to configure it too.
-        if IZPTTemplate.providedBy(object):
-            template = self[name]
-            template = getPath(template)
-            registration = PageRegistration(
-                required=self.required,
-                name=name,
-                permission=self.permission,
-                factoryName=self.factoryName,
-                template=template,
-                layer=self.layer,
-                )
-
-            registrations = self.getRegistrationManager()
-            id = registrations.addRegistration(registration)
-            registration = registrations[id]
-            registration.status = ActiveStatus
-
     def applyDefaults(self):
-        """Apply the default configuration to the already-registered pages.
-        """
+        """Apply the default configuration to the already-registered pages."""
 
-        rm = self.getRegistrationManager()
-        for name in rm:
-            registration = rm[name]
-            status = registration.status
-            if status == ActiveStatus:
-                registration.status = RegisteredStatus
-            registration.status = UnregisteredStatus
+        for name in self.registrationManager:
+            registration = self.registrationManager[name]
+            orig_status = registration.status
+            registration.status = InactiveStatus
 
-            # Cheat and set required and layer even though they're
-            # read-only.  This is ok since the registration is now not
-            # registered.
+            # Cheat and set required even though it is read-only. This is ok
+            # since the registration is now not registered.
 
             registration.required = removeAllProxies(self.required)
             registration.factoryName = self.factoryName
-            registration.layer = self.layer
             registration.permission = self.permission
 
             # Now restore the registration status
 
-            registration.status = status
+            registration.status = orig_status
 
 
-_attrNames = (
-    'factoryName',
-    'required',
-    'layer',
-    'permission',
-    )
+def templateAddedSubscriber(template, event):
+    """Create a registration for the added template."""
+    pagefolder = zapi.getParent(template)
+    # Create and add template 
+    reg = registration.PageRegistration(
+        required=pagefolder.required,
+        name=zapi.name(template),
+        permission=pagefolder.permission,
+        factoryName=pagefolder.factoryName,
+        template=template,
+        )
+    
+    id = pagefolder.registrationManager.addRegistration(reg)
+    reg.status = ActiveStatus
 
-class PageFolderAdapter(ObjectEntryAdapter):
-    """ObjectFile adapter for `PageFolder` objects."""
 
-    implements(IObjectDirectory)
+def templateRemovedSubscriber(template, event):
+    """Remove the registration of a template, when it is removed."""
+    registered = IRegistered(template)
+    reg_manager = zapi.getParent(template.registrationManager)
+    for reg in registered.registrations():
+        del reg_manager[zapi.name(reg)]
 
-    def contents(self):
-        return self.context.items()
 
-    def extra(self):
-        return AttrMapping(self.context, _attrNames)
-
-
 class PageFolderFactory(object):
+    """A directory factory to create page folders inside site
+    management folders.
+    """
 
     implements(IDirectoryFactory)
 
@@ -200,6 +105,3 @@
     def __call__(self, name):
         return PageFolder()
 
-import sys
-sys.modules['zope.app.services.viewpackage'
-            ] = sys.modules['zope.app.presentation.pagefolder']

Deleted: Zope3/trunk/src/zope/app/presentation/pagefolder.zcml
===================================================================
--- Zope3/trunk/src/zope/app/presentation/pagefolder.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/pagefolder.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,47 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:event="http://namespaces.zope.org/event"
-    xmlns:fssync="http://namespaces.zope.org/fssync"
-    >
-
-<!-- Page Folder -->
-
-<content class=".pagefolder.PageFolder">
-  <factory
-    id="zope.app.presentation.pagefolder.PageFolder"
-    title="View Folder"
-    />
-  <require
-      permission="zope.View"
-      interface="zope.app.container.interfaces.IReadContainer" />
-  <require
-      permission="zope.ManageServices"
-      interface="zope.app.container.interfaces.IWriteContainer
-                 .pagefolder.IPageFolderInfo"
-      set_schema=".pagefolder.IPageFolderInfo"
-      attributes="getRegistrationManager applyDefaults" 
-      />
-  <implements
-      interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
-</content>
-
-<adapter
-  for=".pagefolder.IPageFolder"
-  provides="zope.app.filerepresentation.interfaces.IFileFactory"
-  factory=".zpt.ZPTFactory"
-  permission="zope.ManageServices"
-  />
-
-<adapter 
-  for="zope.app.site.interfaces.ISiteManagementFolder"
-  provides="zope.app.filerepresentation.interfaces.IDirectoryFactory"
-  factory=".pagefolder.PageFolderFactory"
-  permission="zope.ManageContent"
-  />
-
-<fssync:adapter
-    class=".pagefolder.PageFolder"
-    factory=".pagefolder.PageFolderAdapter"
-    />
-
-</configure>

Copied: Zope3/trunk/src/zope/app/presentation/pagereg_details.pt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagereg_details.pt)

Deleted: Zope3/trunk/src/zope/app/presentation/presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/presentation.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/presentation.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,336 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Local presentation service
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-import persistent.dict
-
-from zope.interface import implements, providedBy, Interface, Attribute
-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.interface.interfaces
-import zope.component.interfaces
-import zope.configuration.exceptions
-import zope.proxy
-import zope.publisher.interfaces.browser
-import zope.schema
-
-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)
-
-    serviceType = zapi.servicenames.Adapters
-    status = zope.app.registration.interfaces.ActiveStatus
-
-    def __init__(self, context):
-        self.context = context
-        self.required = context.required[0]
-        self.ptype = context.required[-1]
-        self.factories = context.factory
-        self.layer = context.layer
-        self.viewName = context.name
-
-    def usageSummary(self):
-        if self.required is None:
-            ifname = _("any-interface", "Anything")
-        else:
-            ifname = self.required.getName()
-        summary = _("${view_name} ${ptype} View for ${iface_name}")
-        if self.layer and self.layer != "default":
-            summary = _(
-                "${view_name} ${ptype} View for ${iface_name} in layer ${layer}"
-                )
-        summary.mapping = {'view_name':  self.viewName,
-                           'ptype':      self.ptype.getName(),
-                           'iface_name': ifname,
-                           'layer':      self.layer}
-        return summary
-
-    def implementationSummary(self):
-        # Report that this registration is implied because it was
-        # globally defined in ZCML
-        return _("Registered by ZCML")
-
-class LocalLayer(
-    zope.app.adapter.LocalAdapterRegistry,
-    zope.app.container.contained.Contained,
-    ):
-
-    def __init__(self, base, next, parent, name):
-        zope.app.adapter.LocalAdapterRegistry.__init__(
-            self, base, next)
-        self.__parent__ = parent
-        self.__name__ = name
-
-class IViewRegistration(zope.app.adapter.IAdapterRegistration):
-
-    required = zope.schema.Choice(
-        title = _(u"For interface"),
-        description = _(u"The interface of the objects being viewed"),
-        vocabulary="Interfaces",
-        readonly = True,
-        required = True,
-        )
-
-    requestType = zope.schema.Choice(
-        title = _(u"Request type"),
-        description = _(u"The type of requests the view works with"),
-        vocabulary="Interfaces",
-        readonly = True,
-        required = True,
-        )
-
-    layer = zope.schema.BytesLine(
-        title = _(u"Layer"),
-        description = _(u"The skin layer the view is registered for"),
-        required = False,
-        readonly = True,
-        min_length = 1,
-        default = "default",
-        )
-
-class ViewRegistration(zope.app.registration.registration.SimpleRegistration):
-    implements(IViewRegistration)
-
-    serviceType = zapi.servicenames.Adapters
-    provided = Interface
-
-    # For usageSummary(); subclass may override
-    _what = _("view-component", 'View')
-
-    def __init__(self,
-                 required, name, requestType,
-                 factoryName, permission, layer='default'):
-        self.required = required
-        self.requestType = requestType
-        self.factoryName = factoryName
-        self.name = name
-        self.layer = layer
-        self.permission = permission
-
-    def usageSummary(self):
-        if self.required is None:
-            ifname = _('any-interface', "Anything")
-        else:
-            ifname = self.required.getName()
-
-        pname = self.requestType.getName()
-        summary = _("${view_name} for ${pname} ${what} ${iface_name}")
-        if self.layer and self.layer != "default":
-            summary = _(
-                "${view_name} for ${pname} ${what} ${iface_name}"
-                " in layer ${layer}"
-                )
-        summary.mapping = {'view_name':  self.name,
-                           'pname':      pname,
-                           'what':       self._what,
-                           'iface_name': ifname,
-                           'layer':      self.layer}
-        return summary
-
-    def with(self):
-        return (self.requestType, )
-    with = property(with)
-
-    def factory(self):
-        folder = self.__parent__.__parent__
-        return folder.resolve(self.factoryName)
-    factory = property(factory)
-
-class IPageRegistration(IViewRegistration):
-
-    factoryName = zope.schema.BytesLine(
-        title=_(u"Page class"),
-        required = False,
-        )
-
-    template = zope.app.registration.interfaces.ComponentPath(
-        title = _(u"Page template"),
-        required = False,
-        )
-
-    attribute = zope.schema.TextLine(
-        title = _(u"Class attribute"),
-        required = False,
-        )
-
-    factory = Attribute(
-        _("Factory to be called to construct an adapter")
-        )
-
-    def validate(self):
-        """Verifies that the registration is valid.
-
-        Raises a ConfigurationError if the validation is failed.
-        """
-
-class PageRegistration(ViewRegistration):
-    implements(IPageRegistration)
-
-    # We only care about browser pages
-    requestType = zope.publisher.interfaces.browser.IBrowserRequest
-
-    # For usageSummary()
-    _what = _("page-component", "Page")
-
-    def __init__(self,
-                 required, name, permission,
-                 factoryName=None, template=None, attribute=None,
-                 layer='default'):
-
-        # An interface coming out of an interface widget is security
-        # proxied which is not pickable, thus remove the proxies here
-        required = zope.proxy.removeAllProxies(required)
-
-        super(PageRegistration, self).__init__(
-            required, name, self.requestType,
-            factoryName, permission, layer)
-
-        self.template = template
-        self.attribute = attribute
-
-    def implementationSummary(self):
-        L = []
-        if self.template:
-            prefix = "/++etc++site/"
-            t = self.template
-            i = t.rfind(prefix)
-            if i >= 0:
-                t = t[i + len(prefix):]
-            L.append("template=%s" % t)
-        if self.factoryName:
-            L.append("class=%s" % self.factoryName)
-        if self.attribute:
-            L.append("attribute=%s" % self.attribute)
-        return ", ".join(L)
-
-    def validate(self):
-        if self.template and self.attribute:
-            raise zope.configuration.exceptions.ConfigurationError(
-                "PageRegistration for %s view name %s: "
-                "Cannot have both 'template' and 'attribute' at the same "
-                "time." %
-                (self.required, self.name))
-
-        if not self.template and not self.attribute:
-            raise zope.configuration.exceptions.ConfigurationError(
-                "PageRegistration for %s view name %s: "
-                "Should have a 'template' or 'attribute' attribute." %
-                (self.required, self.name))
-
-        if not self.factoryName and self.attribute:
-            raise zope.configuration.exceptions.ConfigurationError(
-                "PageRegistration for %s view name %s: "
-                "Cannot have an 'attribute' without a 'factoryName'." %
-                (self.required, self.name))
-
-    def factory(self):
-        self.validate()
-        sm = zapi.getServices(self)
-
-        if self.factoryName:
-            folder = self.__parent__.__parent__
-            class_ = folder.resolve(self.factoryName)
-        else:
-            class_  = DefaultClass
-
-        if self.attribute:
-            return AttrViewFactory(class_, self.attribute)
-        else:
-            if self.template[0]=='/':
-                # This is needed because we need to do an unrestricted zapi.
-                # traverse
-                root = zope.proxy.removeAllProxies(zapi.getRoot(sm))
-                template = zapi.traverse(root, self.template)
-            else:
-                template = zapi.traverse(self.__parent__.__parent__,
-                                         self.template)
-            return TemplateViewFactory(class_, template, self.permission)
-
-    factory = property(factory)
-
-def PageRegistrationAddSubscriber(self, event):
-    if self.template:
-        template = zapi.traverse(self.__parent__.__parent__,self.template)
-        dependents = IDependable(template)
-        objectpath = zapi.getPath(self)
-        dependents.addDependent(objectpath)
-
-
-def PageRegistrationRemoveSubscriber(self, event):
-    if self.template:
-        template = zapi.traverse(self.__parent__.__parent__,self.template)
-        dependents = IDependable(template)
-        objectpath = zapi.getPath(self)
-        dependents.removeDependent(objectpath)
-
-# TODO: Make this a new-style class. This is not easily possible
-# because existing databases apparently contain references to
-# instances of this class; probably because of a difference in the
-# pickling protocol, we get an UnpicklingError if we simply make this
-# a newstyle class.
-class TemplateViewFactory(object):
-
-    def __init__(self, cls, template, permission):
-        self.cls, self.template, self.permission = cls, template, permission
-
-        # XXX Trap code that uses 'Permissions' vocabulary instead of
-        #     'Permission Ids'.  This check should go away once the mess
-        #     with permissions is straigthened up.
-        from zope.app.security.permission import Permission
-        if isinstance(permission, Permission):
-            raise TypeError('permission should be a string or CheckerPublic,'
-                            ' not %r' % permission)
-
-    def __call__(self, object, request):
-        checker = NamesChecker(__call__ = self.permission)
-        template = BoundTemplate(self.template, self.cls(object, request))
-        return ProxyFactory(template, checker)
-
-class AttrViewFactory(object):
-
-    def __init__(self, cls, attr):
-        self.cls, self.attr = cls, attr
-
-    def __call__(self, object, request):
-        attr = getattr(self.cls(object, request), self.attr)
-        return ProxyFactory(attr)
-
-class DefaultClass(object):
-
-    def __init__(self, context, request):
-        self.context = context
-        self.request = request
-
-class BoundTemplate(object):
-
-    def __init__(self, template, view):
-        self.template = template
-        self.view = view
-
-    def __call__(self, *args, **kw):
-        return self.template.render(self.view, *args, **kw)

Copied: Zope3/trunk/src/zope/app/presentation/registration.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/presentation/registration.py)


Property changes on: Zope3/trunk/src/zope/app/presentation/registration.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.19
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/presentation/tests/test_pagefolder.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/tests/test_pagefolder.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/tests/test_pagefolder.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,44 +15,36 @@
 
 $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.presentation.pagefolder import PageFolder, IPageFolder
-from zope.app.presentation.zpt import ZPTTemplate
-from zope.app.registration.interfaces import ActiveStatus
-from zope.interface import Interface
+import unittest
+import zope.interface
 from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.app.registration.tests.test_registrationmanager \
-     import RegisterableContainerTests
 
-from zope.app.dependable.interfaces import IDependable
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.dependable import Dependable
 from zope.app import zapi
-from zope.app.annotation.interfaces import IAnnotations, IAnnotatable
-from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.adapter.adapter import LocalAdapterService
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.testing import PlacefulSetup
+from zope.app.container.interfaces import IObjectAddedEvent
+from zope.app.presentation.interfaces import IPageFolder, IZPTTemplate
+from zope.app.presentation.pagefolder import PageFolder
+from zope.app.presentation.pagefolder import templateAddedSubscriber
+from zope.app.presentation.zpt import ZPTTemplate
+from zope.app.testing import ztapi, setup
 
-
-class I(Interface):
+class I(zope.interface.Interface):
     pass
 
-class I2(Interface):
+class I2(zope.interface.Interface):
     pass
 
-class Test(RegisterableContainerTests, PlacefulSetup, TestCase):
+class PageFolderTest(PlacefulSetup, unittest.TestCase):
 
     def setUp(self):
         sm = PlacefulSetup.setUp(self, site=True)
-        setup.addService(sm, zapi.servicenames.Adapters,
-                         LocalAdapterService(), suffix='service')        
         default = zapi.traverse(self.rootFolder, '++etc++site/default')
+        setup.setUpAnnotations()
+        setup.setUpTraversal()
+        ztapi.subscribe((IZPTTemplate, IObjectAddedEvent),
+                        None, templateAddedSubscriber)
 
-        ztapi.provideAdapter(IAnnotatable, IAnnotations, AttributeAnnotations)
-        ztapi.provideAdapter(IAnnotatable, IDependable, Dependable)
-
         default["PF"] = PageFolder()
         pagefolder = zapi.traverse(default, "PF")
 
@@ -62,60 +54,50 @@
 
         self.__pagefolder = pagefolder
 
-
-
-    def test___setitem__(self):
+    def test_templateAddedSubscriber(self):
         
         pagefolder = self.__pagefolder
 
         pagefolder['foo.html'] = ZPTTemplate()
 
-        rm = pagefolder.getRegistrationManager()
-        name = rm.keys()[-1]
-        registration = zapi.traverse(pagefolder.getRegistrationManager(),
-                                     name)
+        rm = pagefolder.registrationManager
+        name = rm.keys()[0]
+        registration = zapi.traverse(rm, name)
         self.assertEqual(registration.status, ActiveStatus)
         self.assertEqual(registration.required, I)
         self.assertEqual(registration.requestType, IBrowserRequest)
         self.assertEqual(registration.name, u'foo.html')
-        self.assertEqual(registration.layer, 'default')
         self.assertEqual(registration.factoryName, None)
         self.assertEqual(registration.permission, 'zope.View')
         self.assertEqual(registration.attribute, None)
 
-        self.assertRaises(TypeError,
-                          pagefolder.__setitem__, 'bar.html', PageFolder())
-
     def test_applyDefaults(self):
 
         pagefolder = self.__pagefolder
 
         pagefolder['foo.html'] = ZPTTemplate()
 
-        rm = pagefolder.getRegistrationManager()
+        rm = pagefolder.registrationManager
         name = rm.keys()[-1]
-        registration = zapi.traverse(pagefolder.getRegistrationManager(), name)
+        registration = zapi.traverse(rm, name)
         self.assertEqual(registration.status, ActiveStatus)
         self.assertEqual(registration.required, I)
         self.assertEqual(registration.requestType, IBrowserRequest)
         self.assertEqual(registration.name, u'foo.html')
-        self.assertEqual(registration.layer, 'default')
         self.assertEqual(registration.factoryName, None)
         self.assertEqual(registration.permission, 'zope.View')
         self.assertEqual(registration.attribute, None)
 
         pagefolder.required = I2
         pagefolder.permission = 'zope.ManageContent'
-        pagefolder.layer = 'debug'
 
         pagefolder.applyDefaults()
 
-        registration = zapi.traverse(pagefolder.getRegistrationManager(), name)
+        registration = zapi.traverse(rm, name)
         self.assertEqual(registration.status, ActiveStatus)
         self.assertEqual(registration.required, I2)
         self.assertEqual(registration.requestType, IBrowserRequest)
         self.assertEqual(registration.name, u'foo.html')
-        self.assertEqual(registration.layer, 'debug')
         self.assertEqual(registration.factoryName, None)
         self.assertEqual(registration.permission, 'zope.ManageContent')
         self.assertEqual(registration.attribute, None)
@@ -123,9 +105,9 @@
         
 
 def test_suite():
-    return TestSuite((
-        makeSuite(Test),
+    return unittest.TestSuite((
+        unittest.makeSuite(PageFolderTest),
         ))
 
 if __name__=='__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/tests/test_presentation.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,50 +15,44 @@
 
 $Id$
 """
+import unittest
 
-from unittest import TestCase, TestSuite, main, makeSuite
-from zope.testing.doctestunit import DocTestSuite
-from zope.app.tests.placelesssetup import setUp, tearDown
-
-from zope.app import zapi
-from zope.interface import Interface, directlyProvides, implements
-from zope.interface.verify import verifyObject
-
-from zope.app.container.interfaces import IObjectAddedEvent
-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
-from zope.app.presentation.presentation import PageRegistration
-from zope.app.presentation.presentation import BoundTemplate
-from zope.app.presentation.presentation import IPageRegistration
-from zope.app.presentation.presentation import PageRegistrationAddSubscriber
-from zope.app.presentation.presentation import PageRegistrationRemoveSubscriber
-from zope.app.tests import setup
-from zope.app.traversing.api import traverse
-
+import zope.interface
 from zope.component.exceptions import ComponentLookupError
-from zope.component.interfaces import IServiceService
-from zope.app.tests import ztapi
 from zope.configuration.exceptions import ConfigurationError
-
+from zope.interface.verify import verifyObject
 from zope.proxy import removeAllProxies
-
 from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.testing.doctestunit import DocTestSuite
+
+from zope.app import zapi
+from zope.app.annotation.interfaces import IAttributeAnnotatable
+from zope.app.component.interfaces.registration import IRegistered
+from zope.app.component.testing import PlacefulSetup
 from zope.app.container.contained import contained, uncontained, setitem
 from zope.app.container.interfaces import IContained, ILocation
-
+from zope.app.container.interfaces import IObjectAddedEvent
+from zope.app.container.interfaces import IObjectRemovedEvent
+from zope.app.dependable import Dependable
 from zope.app.dependable.interfaces import IDependable
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.registration.interfaces import IRegistered
+from zope.app.folder import rootFolder
+from zope.app.module import resolve
+from zope.app.module.manager import ModuleManager
+from zope.app.module.interfaces import IModuleManager
+from zope.app.presentation.interfaces import IPageRegistration
+from zope.app.presentation.interfaces import IZPTTemplate
+from zope.app.presentation.registration import PageRegistration
+from zope.app.presentation.registration import BoundTemplate
+from zope.app.presentation.registration import PageRegistrationAddSubscriber
+from zope.app.presentation.registration import PageRegistrationRemoveSubscriber
+from zope.app.testing import ztapi, setup
+from zope.app.testing.placelesssetup import setUp, tearDown
+from zope.app.traversing.api import traverse
 from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.dependable import Dependable
 
-class I1(Interface):
+
+class I1(zope.interface.Interface):
     pass
 
 class I1E(I1):
@@ -66,10 +60,10 @@
 
 I2 = IBrowserRequest
 
-class I3(Interface):
+class I3(zope.interface.Interface):
     pass
 
-class I4(Interface):
+class I4(zope.interface.Interface):
     pass
 
 
@@ -78,15 +72,11 @@
     requestType = I2
     name = 'test'
     layer = 'default'
-    serviceType = zapi.servicenames.Adapters
-    provided = Interface
+    provided = zope.interface.Interface
 
     with = property(lambda self: (self.requestType, ))
     factories = property(lambda self: (self.factory, ))
 
-    def activated(self): pass
-    def deactivated(self): pass
-
     def __repr__(self):
         return 'Registration(%s)' % self.factory.__name__
 
@@ -94,7 +84,7 @@
 
 class PhonyTemplate(object):
     __name__ = __parent__ = None
-    implements(IZPTTemplate, IDependable, IRegistered)
+    zope.interface.implements(IZPTTemplate, IDependable, IRegistered)
 
     _dependents = ()
 
@@ -114,44 +104,19 @@
         return self._dependents
 
 
+source = '''
+from zope.app.presentation.tests.test_presentation import PhonyTemplate
+
 class A(object):
     def __init__(self, object, request):
         self.context = object
         self.request = request
 
     run = PhonyTemplate()
+'''
 
-
-class PhonyServiceManager(ServiceManager):
-
-    implements(IServiceService)
-
-class ModuleFinder(object):
-
-    implements(IContained)
-
-    __parent__ = __name__ = None
-
-    def __init__(self):
-        self._dict = {}
-
-    def resolve(self, name):
-        if name == "Foo.Bar.A":
-            return A
-        raise ImportError(name)
-
-    def __setitem__(self, key, ob):
-        setitem(self, self.__setitem, key, ob)
-    
-    def __setitem(self, key, ob):
-        self._dict[key] = ob
-
-    def get(self, key, default=None):
-        return self._dict.get(key, default)
-
-
 class PhonyPathAdapter(object):
-    implements(IPhysicallyLocatable)
+    zope.interface.implements(IPhysicallyLocatable)
 
     def __init__(self, context):
         self.context = context
@@ -166,53 +131,56 @@
         return root
 
 
-class TestViewRegistration(PlacefulSetup, TestCase):
+class Folder(object):
 
-    def test_factories(self):
-        folder = ModuleFinder()
-        folder = contained(folder, folder)
-        registration = contained(
-            ViewRegistration(I1, 'test', I2, "Foo.Bar.A", 'zope.View'),
-            folder,
-            )
+    zope.interface.implements(IContained)
 
-        self.assertEqual(registration.required, I1)
-        self.assertEqual(registration.requestType, I2)
+    __parent__ = __name__ = None
 
-        factory = registration.factory
-        self.assertEqual(factory, A)
+    def __init__(self):
+        self._dict = {}
 
+    def __setitem__(self, key, ob):
+        setitem(self, self.__setitem, key, ob)
+    
+    def __setitem(self, key, ob):
+        self._dict[key] = ob
 
-class TestPageRegistration(PlacefulSetup, TestCase):
+    def get(self, key, default=None):
+        return self._dict.get(key, default)
 
+
+class TestPageRegistration(PlacefulSetup, unittest.TestCase):
+
     def setUp(self):
         PlacefulSetup.setUp(self)
         self.rootFolder = rootFolder()
-        self.rootFolder.setSiteManager(PhonyServiceManager(self.rootFolder))
-        default = traverse(self.rootFolder, '++etc++site/default')
+        setup.createSiteManager(self.rootFolder)
+        default = self.rootFolder.getSiteManager()['default']
         self.__template = PhonyTemplate()
         default['t'] = self.__template
-        self.folder = contained(ModuleFinder(), self.rootFolder)
-        self.folder = contained(ModuleFinder(), self.folder)
+        ztapi.provideUtility(IModuleManager, ModuleManager(source), 'Foo.Bar')
+        folder = contained(Folder(), self.rootFolder)
+        self.folder = contained(Folder(), folder)
 
     def test_factories_template(self):
         registration = contained(
-            PageRegistration(I1, 'test', 'zope.View',
+            PageRegistration('test', I1, 'zope.View',
                               "Foo.Bar.A",
-                              template='/++etc++site/default/t',
+                              template=self.__template,
                               ),
             self.folder,
             )
 
         c = C()
         request = TestRequest()
-        factory = registration.factory
+        factory = registration.component
         view = factory(c, request)
         self.assertEqual(view.__class__, BoundTemplate)
         self.assertEqual(removeAllProxies(view).template, self.__template)
 
         view = removeAllProxies(view).view
-        self.assert_(issubclass(view.__class__, A))
+        self.assert_(issubclass(view.__class__, resolve('Foo.Bar.A')))
         self.assertEqual(view.context, c)
         self.assertEqual(view.request, request)
         self.assertEqual(registration.required, I1)
@@ -226,9 +194,9 @@
             )
         c = C()
         request = TestRequest()
-        factory = registration.factory
+        factory = registration.component
         view = factory(c, request)
-        self.assertEquals(view, A.run)
+        self.assertEquals(view, resolve('Foo.Bar.A').run)
 
     def test_factories_errors(self):
         registration = contained(
@@ -237,10 +205,10 @@
             )
         c = C()
         request = TestRequest()
-        self.assertRaises(ConfigurationError, lambda: registration.factory)
-        registration.template = '/++etc++site/default/t'
+        self.assertRaises(ConfigurationError, lambda: registration.component)
+        registration.template = self.__template
         registration.attribute = 'run'
-        self.assertRaises(ConfigurationError, lambda: registration.factory)
+        self.assertRaises(ConfigurationError, lambda: registration.component)
 
     def test_registerAddSubscriber_template(self):
         ztapi.provideAdapter(ILocation, IPhysicallyLocatable,
@@ -248,7 +216,7 @@
         ztapi.handle((IPageRegistration, IObjectAddedEvent),
                      PageRegistrationAddSubscriber)
         registration = PageRegistration(I1, 'test', 'zope.View', "Foo.Bar.A",
-                                        template='/++etc++site/default/t')
+                                        template=self.__template)
         
         # Test add event
         self.folder['test'] = registration
@@ -261,7 +229,7 @@
         ztapi.handle((IPageRegistration, IObjectRemovedEvent),
                      PageRegistrationRemoveSubscriber)
         registration = PageRegistration(I1, 'test', 'zope.View', "Foo.Bar.A",
-                                        template='/++etc++site/default/t')
+                                        template=self.__template)
 
         # Test remove event
         self.folder['test'] = registration
@@ -280,12 +248,11 @@
 
 
 def test_suite():
-    return TestSuite([
-        makeSuite(TestViewRegistration),
-        makeSuite(TestPageRegistration),
-        ])
+    return unittest.TestSuite((
+        unittest.makeSuite(TestPageRegistration),
+        ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')
 
 

Modified: Zope3/trunk/src/zope/app/presentation/tests/test_zpt.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/tests/test_zpt.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/tests/test_zpt.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,20 +15,18 @@
 
 $Id$
 """
-from unittest import TestCase, TestSuite, makeSuite
+import unittest
+import zope.interface
+from zope.publisher.browser import TestRequest
+
 from zope.app.presentation.zpt import ZPTTemplate, ZPTFactory
 from zope.app.presentation.zpt import ReadFile, WriteFile
-from zope.publisher.browser import TestRequest
 from zope.app.publisher.browser import BrowserView
 
 # All this just to get zapi.getPath() work :(
-from zope.app.tests import ztapi
-from zope.interface import directlyProvides
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.traversing.interfaces import IPhysicallyLocatable
+from zope.app.testing import ztapi, setup
+from zope.app.testing.placelesssetup import PlacelessSetup
 from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.location.traversing import LocationPhysicallyLocatable
-from zope.app.traversing.adapters import RootPhysicallyLocatable
 from zope.app.container.contained import contained
 
 
@@ -36,7 +34,7 @@
     pass
 
 
-class Test(TestCase):
+class ZPTTemplateTest(unittest.TestCase):
 
     # TODO: We need tests for the template class itself and for the
     # SearchableText adapter.
@@ -70,15 +68,18 @@
         self.assertEqual(template.source, source)
 
 
-class TestDebugFlags(PlacelessSetup, TestCase):
+class TestDebugFlags(PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        ztapi.provideAdapter(
-              None, IPhysicallyLocatable, LocationPhysicallyLocatable)
-        ztapi.provideAdapter(
-              IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
+        setup.setUpTraversal()
 
+    def pageInContext(self, page):
+        root = Data()
+        zope.interface.directlyProvides(root, IContainmentRoot)
+        folder = contained(Data(), root, name='folder')
+        return contained(page, folder, name='zpt')
+
     def test_source_file(self):
         template = ZPTTemplate()
         self.assert_(template.pt_source_file() is None)
@@ -86,12 +87,6 @@
         template = self.pageInContext(template)
         self.assertEquals(template.pt_source_file(), '/folder/zpt')
 
-    def pageInContext(self, page):
-        root = Data()
-        directlyProvides(root, IContainmentRoot)
-        folder = contained(Data(), root, name='folder')
-        return contained(page, folder, name='zpt')
-
     def test_debug_flags(self):
         template = self.pageInContext(ZPTTemplate())
         template.source = u'<tal:p>Test</tal:p>'
@@ -114,7 +109,10 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(Test),
-        makeSuite(TestDebugFlags),
+    return unittest.TestSuite((
+        unittest.makeSuite(ZPTTemplateTest),
+        unittest.makeSuite(TestDebugFlags),
         ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope3/trunk/src/zope/app/presentation/zpt.py
===================================================================
--- Zope3/trunk/src/zope/app/presentation/zpt.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/zpt.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,64 +16,28 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
-
+import persistent
 import re
 
-from zope.security.proxy import ProxyFactory
-from persistent import Persistent
-from zope.interface import Interface, implements
-from zope.schema import Text, BytesLine, Bool
+import zope.interface
+import zope.security.proxy
+from zope.pagetemplate.pagetemplate import PageTemplate
 
+import zope.app.filerepresentation.interfaces
+
+from zope.app import zapi
+from zope.app.component.interfaces.registration import IRegisterable
 from zope.app.container.contained import Contained
-from zope.app.registration.interfaces 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
-from zope.app.filerepresentation.interfaces import IFileFactory
 from zope.app.pagetemplate.engine import AppPT
-from zope.pagetemplate.pagetemplate import PageTemplate
-from zope.app import zapi
 
-class IZPTInfo(Interface):
-    """ZPT Template configuration information
-    """
+import interfaces
 
-    contentType = BytesLine(
-        title=u'Content type of generated output',
-        required=True,
-        default='text/html'
-        )
+class ZPTTemplate(AppPT, PageTemplate, persistent.Persistent, Contained):
 
-    source = Text(
-        title=u"Source",
-        description=u"""The source of the page template.""",
-        required=True)
+    zope.interface.implements(interfaces.IZPTTemplate)
 
-    expand = Bool(
-        title=u"Expand macros",
-        )
-
-class IZPTTemplate(IZPTInfo, IRegisterable):
-    """ZPT Templates for use in views"""
-
-    def render(context, request, *args, **kw):
-        """Render the page template.
-
-        The context argument is bound to the top-level `context`
-        variable.  The request argument is bound to the top-level
-        `request` variable. The positional arguments are bound to the
-        `args` variable and the keyword arguments are bound to the
-        `options` variable.
-
-        """
-
-class ZPTTemplate(AppPT, PageTemplate, Persistent, Contained):
-
-    implements(IZPTTemplate)
-
     contentType = 'text/html'
     expand = False
-    usage = u''
 
     def getSource(self):
         """See `zope.app.presentation.zpt.IZPTInfo`"""
@@ -85,9 +49,8 @@
             raise TypeError("source text must be Unicode" , text)
         self.pt_edit(text, self.contentType)
 
-    # See zope.app.presentation.zpt.IZPTInfo
-    source = property(getSource, setSource, None,
-                      """Source of the Page Template.""")
+    # See zope.app.presentation.interfaces.IZPTInfo
+    source = property(getSource, setSource)
 
     def pt_getContext(self, view, **_kw):
         # instance is a View component
@@ -106,27 +69,22 @@
     def render(self, view, *args, **keywords):
 
         if args:
-            args = ProxyFactory(args)
+            args = zope.security.proxy.ProxyFactory(args)
 
-        if self.usage:
-            if "template_usage" not in keywords:
-                kw = {'template_usage': self.usage}
-                kw.update(keywords)
-                keywords = kw
+        kw = zope.security.proxy.ProxyFactory(keywords)
 
-        kw = ProxyFactory(keywords)
-
         namespace = self.pt_getContext(view, args=args, options=kw)
         debug_flags = view.request.debug
 
         return self.pt_render(namespace, showtal=debug_flags.showTAL,
                               sourceAnnotations=debug_flags.sourceAnnotations)
 
-# Adapters for file-system emulation
 
+# Adapters for file-system emulation
 class ReadFile(object):
 
-    implements(IReadFile)
+    zope.interface.implements(
+        zope.app.filerepresentation.interfaces.IReadFile)
 
     def __init__(self, context):
         self.context = context
@@ -140,7 +98,8 @@
 
 class WriteFile(object):
 
-    implements(IWriteFile)
+    zope.interface.implements(
+        zope.app.filerepresentation.interfaces.IWriteFile)
 
     def __init__(self, context):
         self.context = context
@@ -151,30 +110,13 @@
 
 class ZPTFactory(object):
 
-    implements(IFileFactory)
+    zope.interface.implements(
+        zope.app.filerepresentation.interfaces.IFileFactory)
 
     def __init__(self, context):
         self.context = context
 
     def __call__(self, name, content_type, data):
-        r = ZPTTemplate()
-        r.source = data
-        return r
-
-
-class ZPTPageAdapter(ObjectEntryAdapter):
-    """ObjectFile adapter for `ZPTTemplate` objects."""
-
-    implements(IObjectFile)
-
-    def getBody(self):
-        return self.context.source
-
-    def setBody(self, data):
-        # Convert the data to Unicode, since that's what ZPTTemplate
-        # wants; it's normally read from a file so it'll be bytes.
-        # The default encoding in Zope is UTF-8.
-        self.context.source = data.decode('UTF-8')
-
-    def extra(self):
-        return AttrMapping(self.context, ('contentType', 'expand'))
+        template = ZPTTemplate()
+        template.source = data
+        return template

Deleted: Zope3/trunk/src/zope/app/presentation/zpt.zcml
===================================================================
--- Zope3/trunk/src/zope/app/presentation/zpt.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/presentation/zpt.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,48 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:event="http://namespaces.zope.org/event"
-    xmlns:fssync="http://namespaces.zope.org/fssync"
-    >
-
-<!-- Page Templates  -->
-
-<content class=".zpt.ZPTTemplate">
-  <factory
-      title="zope.app.ZPTTemplate"
-      description="Persistent View Page Template"
-      />
-  <require
-      permission="zope.View"
-      attributes="__call__"
-      />
-  <require
-      permission="zope.ManageServices"
-      interface=".zpt.IZPTTemplate"
-      set_schema=".zpt.IZPTTemplate"
-      />
-  <implements
-      interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
-      />
-</content>
-
-<adapter
-  for=".zpt.IZPTTemplate"
-  provides="zope.app.filerepresentation.interfaces.IReadFile"
-  factory=".zpt.ReadFile"
-  permission="zope.ManageServices"
-  />
-
-<adapter
-  for=".zpt.IZPTTemplate"
-  provides="zope.app.filerepresentation.interfaces.IWriteFile"
-  factory=".zpt.WriteFile"
-  permission="zope.ManageServices"
-  />
-
-<!-- Filesystem synchronization support -->
-<fssync:adapter
-    class=".zpt.ZPTTemplate"
-    factory=".zpt.ZPTPageAdapter"
-    />
-
-</configure>

Modified: Zope3/trunk/src/zope/app/principalannotation/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/principalannotation/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,9 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-# TODO: register utility as adapter for IAnnotations on utility activation
-# this depends on existence of LocalAdapterService, so once that's done
-# implement this.
+# TODO: register utility as adapter for IAnnotations on utility activation.
 
 from persistent import Persistent
 from persistent.dict import PersistentDict
@@ -30,7 +28,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/trunk/src/zope/app/principalannotation/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/principalannotation/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,6 +21,13 @@
      title="Principal Annotation Utility"
      description="Stores Annotations for Principals" />
 
+  <browser:tool
+      interface=".interfaces.IPrincipalAnnotationUtility"
+      title="Principal Annotations"
+      description="Stores annotations for any principal."
+      unique="true"
+      />
+
   <subscriber
       for="zope.app.appsetup.IDatabaseOpenedEvent"
       handler=".bootstrap.bootStrapSubscriber"

Modified: Zope3/trunk/src/zope/app/principalannotation/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/principalannotation/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Service for storing `IAnnotations` for principals.
+"""Utility for storing `IAnnotations` for principals.
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/principalannotation/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/principalannotation/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/principalannotation/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,6 +16,7 @@
 $Id$
 """
 from unittest import TestCase, TestLoader, TextTestRunner
+
 from zope import component as capi
 from zope.interface import implements
 from zope.app import zapi
@@ -23,10 +24,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 +62,6 @@
     def testGetFromLayered(self):
         princeSomebody = Principal('somebody')
         sm1 = self.makeSite('folder1')
-        setup.addService(sm1, 'Utilities', LocalUtilityService())
         subUtil = setup.addUtility(sm1, '', IPrincipalAnnotationUtility,
                                    PrincipalAnnotationUtility())
 

Modified: Zope3/trunk/src/zope/app/publication/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/browser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/browser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publication/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,9 +16,9 @@
 $Id$
 """
 import unittest
+from zope.app.testing import functional
 
 def test_suite():
-    from zope.app.tests import functional
     return unittest.TestSuite((
         functional.FunctionalDocFileSuite('notfound.txt'),
         ))

Modified: Zope3/trunk/src/zope/app/publication/ftp.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/ftp.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/ftp.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,12 +16,12 @@
 $Id$
 """
 __docformat__ = 'restructuredtext'
+from zope.publisher.interfaces import NotFound
+from zope.publisher.publish import mapply
 
+from zope.app import zapi
 from zope.app.publication.zopepublication import ZopePublication
 
-from zope.component import queryView
-from zope.publisher.interfaces import NotFound
-from zope.publisher.publish import mapply
 
 
 class FTPPublication(ZopePublication):
@@ -29,7 +29,7 @@
 
     def callObject(self, request, ob):
         method = request['command']
-        view = queryView(ob, method, request, self)
+        view = zapi.queryMultiAdapter((ob, request), name=method, default=self)
         if view is self:
             raise NotFound(ob, method, request)
 

Modified: Zope3/trunk/src/zope/app/publication/http.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/http.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/http.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publication/httpfactory.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/httpfactory.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/httpfactory.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -66,7 +66,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/trunk/src/zope/app/publication/publicationtraverse.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/publicationtraverse.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/publicationtraverse.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_browserpublication.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -223,7 +223,7 @@
         ob2 = pub.traverseName(r, ob, '@@spam')
         self.assertEqual(ob2.__class__, V)
 
-    def testTraverseNameServices(self):
+    def testTraverseNameSiteManager(self):
         pub = self.klass(self.db)
         class C(object):
             def getSiteManager(self):

Modified: Zope3/trunk/src/zope/app/publication/tests/test_http.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_http.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_http.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publication/tests/test_httpfactory.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_httpfactory.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_httpfactory.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,15 +22,13 @@
 from zope.publisher.browser import BrowserRequest
 from zope.publisher.http import HTTPRequest
 from zope.publisher.xmlrpc import XMLRPCRequest
-from zope.component.interfaces import IAdapterService
-from zope.component.adapter import GlobalAdapterService
 from zope.component.tests.placelesssetup import PlacelessSetup
 
 from zope.app.publication.httpfactory import HTTPPublicationRequestFactory
 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/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_simplecomponenttraverser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_xmlrpcpublication.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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):
@@ -114,7 +113,7 @@
         self.assertEqual(removeAllProxies(ob2).__class__, V)
         
 
-    def testTraverseNameServices(self):
+    def testTraverseNameSiteManager(self):
         pub = self.klass(self.db)
         class C(object):
             def getSiteManager(self):

Modified: Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/tests/test_zopepublication.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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):
@@ -235,7 +212,7 @@
             '  Error while reporting an error to the Error Reporting utility')
 
         # Here we got a single log record, because we havdn't
-        # installed an error reporting service.  That's OK.
+        # installed an error reporting utility.  That's OK.
 
         handler.uninstall()
         self.out.seek(0)
@@ -277,7 +254,7 @@
 
         # Now, since the view was a system error view, we should have
         # a log entry for the E2 error (as well as the missing
-        # error reporting service).
+        # error reporting utility).
         self.assertEqual(
             str(handler),
             'SiteError ERROR\n'
@@ -377,11 +354,9 @@
         self.assert_(txn is not get_transaction())    
 
     def testAbortTransactionWithErrorReportingUtility(self):
-        # provide our fake error logging service
-        sm = getGlobalServices()
-        utils = sm.getService('Utilities')
-        utils.provideUtility(IErrorReportingUtility,
-                             ErrorReportingUtility())
+        # provide our fake error reporting utility
+        sm = zapi.getGlobalSiteManager()
+        sm.provideUtility(IErrorReportingUtility, ErrorReportingUtility())
 
         class FooError(Exception):
             pass
@@ -398,8 +373,8 @@
         new_txn_info = self.db.undoInfo()[0]
         self.assertEqual(last_txn_info, new_txn_info)
 
-        # instead, we expect a message in our logging service
-        error_log = utils.getUtility(IErrorReportingUtility)
+        # instead, we expect a message in our logging utility
+        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/trunk/src/zope/app/publication/traversers.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/traversers.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/traversers.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,11 +17,11 @@
 """
 __docformat__ = 'restructuredtext'
 
+from zope.app import zapi
 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
@@ -34,12 +34,12 @@
 
     def browserDefault(self, request):
         ob = self.context
-        view_name = getDefaultViewName(ob, request)
+        view_name = zapi.getDefaultViewName(ob, request)
         return ob, (view_name,)
 
     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 +55,7 @@
     def browserDefault(self, request):
         ob = self.context
 
-        view_name = getDefaultViewName(ob, request)
+        view_name = zapi.getDefaultViewName(ob, request)
         view = self.publishTraverse(request, view_name)
         if hasattr(view, 'browserDefault'):
             view, path = view.browserDefault(request)
@@ -78,7 +78,7 @@
         ob = self.context
 
         if providedBy(ob):
-            view_name = getDefaultViewName(ob, request)
+            view_name = zapi.getDefaultViewName(ob, request)
             return ob, (("@@%s" % view_name),)
 
         return ob, ()
@@ -86,7 +86,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/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/zopepublication.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publication/zopepublication.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -49,7 +49,7 @@
 from zope.app.security.principalregistry import principalRegistry as prin_reg
 from zope.app.security.interfaces import IUnauthenticatedPrincipal
 from zope.app.security.interfaces import IAuthentication
-from zope.app.site.interfaces import ISite
+from zope.app.component.interfaces import ISite
 from zope.app.traversing.interfaces import IPhysicallyLocatable
 
 class Cleanup(object):
@@ -90,19 +90,17 @@
             return
 
         if not ISite.providedBy(ob):
-            # We won't find an authentication service here, so give up.
+            # We won't find an authentication utility here, so give up.
             return
 
         sm = removeSecurityProxy(ob).getSiteManager()
 
-        try:
-            utils = sm.getService(zapi.servicenames.Utilities)
-            auth = utils.getUtility(IAuthentication)
-        except ComponentLookupError:
+        auth = sm.queryUtility(IAuthentication)
+        if auth is None:
             # No auth utility here
             return
 
-        # Try to authenticate against the auth service
+        # Try to authenticate against the auth utility
         principal = auth.authenticate(request)
         if principal is None:
             principal = auth.unauthenticatedPrincipal()
@@ -188,8 +186,7 @@
             # Views are made children of their contexts, but that
             # doesn't necessarily mean that we can fully resolve the
             # path. E.g. the family tree of a resource cannot be
-            # resolved completely, as the presentation service is a
-            # dead end.
+            # resolved completely, as the site manager is a dead end.
             try:
                 path = locatable.getPath()
             except (AttributeError, TypeError):
@@ -296,9 +293,10 @@
                 # Give the exception instance its location and look up the
                 # view.
                 exception = LocationProxy(exc_info[1], loc, '')
-                name = zapi.queryDefaultViewName(exception, request)
+                name = zapi.getDefaultViewName(exception, request)
                 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/trunk/src/zope/app/publisher/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,20 +15,71 @@
 
 $Id$
 """
+from zope.component.interfaces import ComponentLookupError, IDefaultViewName
+from zope.component import getSiteManager
+
+import zope.interface
 from zope.interface import implements, directlyProvidedBy, directlyProvides
 from zope.app.location import Location
 from zope.app.publisher.interfaces.browser import IBrowserView
 from zope.publisher.interfaces.browser import ISkin
 
+# XXX: needs testing of __parent__ property
 class BrowserView(Location):
     implements(IBrowserView)
 
     def __init__(self, context, request):
         self.context = context
         self.request = request
-        self.__parent__ = context
 
+    def __getParent(self):
+        return hasattr(self, '_parent') and self._parent or self.context
 
+    def __setParent(self, parent):
+        self._parent = parent
+
+    __parent__ = property(__getParent, __setParent)
+
+
+class IDefaultViewNameAPI(zope.interface.Interface):
+
+    def getDefaultViewName(object, request, context=None):
+        """Get the name of the default view for the object and request.
+
+        The request must implement IPresentationRequest, and provides the
+        desired view type.  The nearest one to the object is found.
+        If a matching default view name cannot be found, raises
+        ComponentLookupError.
+
+        If context is not specified, attempts to use
+        object to specify a context.
+        """
+
+    def queryDefaultViewName(object, request, default=None, context=None):
+        """Look for the name of the default view for the object and request.
+
+        The request must implement IPresentationRequest, and provides
+        the desired view type.  The nearest one to the object is
+        found.  If a matching default view name cannot be found,
+        returns the default.
+
+        If context is not specified, attempts to use object to specify
+        a context.
+        """
+
+# XXX: needs tests
+def getDefaultViewName(object, request, context=None):
+    name = queryDefaultViewName(object, request, context=context)
+    if name is not None:
+        return name
+    raise ComponentLookupError("Couldn't find default view name",
+                               context, request)
+
+def queryDefaultViewName(object, request, default=None, context=None):
+    name = getSiteManager(context).adapters.lookup(
+        map(zope.interface.providedBy, (object, request)), IDefaultViewName)
+    return name or default
+
 def applySkin(request, skin):
     """Change the presentation skin for this request.
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -55,7 +55,7 @@
 
 <browser:page 
     name=""
-    for="zope.app.site.interfaces.ISite"
+    for="zope.app.component.interfaces.ISite"
     class="zope.app.publisher.browser.resources.Resources"
     permission="zope.Public"
     allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"

Modified: Zope3/trunk/src/zope/app/publisher/browser/fields.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/fields.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/fields.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -31,7 +31,7 @@
     r"""This fields represents a menu (item type).
 
     Besides being able to look up the menu by importing it, we also try
-    to look up the name in the utility service.
+    to look up the name in the site manager.
 
     >>> from zope.interface import directlyProvides
     >>> from zope.interface.interface import InterfaceClass
@@ -75,10 +75,10 @@
     >>> if old is not None:
     ...     sys.modules['zope.app.menus'] = old
 
-    Test 3: Get the menu from the utility service
-    ---------------------------------------------
+    Test 3: Get the menu from the Site Manager
+    ------------------------------------------
     
-    >>> from zope.app.tests import ztapi
+    >>> from zope.app.testing import ztapi
     >>> ztapi.provideUtility(IMenuItemType, menu1, 'menu1')
 
     >>> field.fromUnicode('menu1') is menu1

Modified: Zope3/trunk/src/zope/app/publisher/browser/i18nresourcemeta.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/i18nresourcemeta.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/i18nresourcemeta.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/icon.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/icon.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/icon.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/menu.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/menu.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/menu.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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})
@@ -613,8 +613,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/trunk/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -246,7 +246,7 @@
         description=u"""
         This is the name used in resource urls. Resource urls are of
         the form site/@@/resourcename, where site is the url of
-        "site", a folder with a service manager.
+        "site", a folder with a site manager.
 
         We make resource urls site-relative (as opposed to
         content-relative) so as not to defeat caches.""",
@@ -285,7 +285,7 @@
         description=u"""
         This is the name used in resource urls. Resource urls are of
         the form site/@@/resourcename, where site is the url of
-        "site", a folder with a service manager.
+        "site", a folder with a site manager.
 
         We make resource urls site-relative (as opposed to
         content-relative) so as not to defeat caches.""",
@@ -333,7 +333,7 @@
         description=u"""
         This is the name used in resource urls. Resource urls are of
         the form site/@@/resourcename, where site is the url of
-        "site", a folder with a service manager.
+        "site", a folder with a site manager.
 
         We make resource urls site-relative (as opposed to
         content-relative) so as not to defeat caches.""",

Modified: Zope3/trunk/src/zope/app/publisher/browser/resource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/resource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/resource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/resourcemeta.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/resourcemeta.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/resourcemeta.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/resources.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/resources.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/resources.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/support.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/support.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/support.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,10 +17,9 @@
 """
 from zope.interface import implements
 
-from zope.component.service import serviceManager
-
+from zope.app import zapi
 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
 
 
@@ -28,7 +27,7 @@
     implements(ISite, IContainmentRoot)
 
     def getSiteManager(self):
-        return serviceManager
+        return zapi.getGlobalSiteManager()
 
 site = Site()
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_addMenuItem.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,7 +22,6 @@
 from zope.interface import Interface, implements, directlyProvides, providedBy
 
 import zope.security.management
-from zope.component.service import serviceManager
 from zope.configuration.xmlconfig import xmlconfig, XMLConfig
 from zope.configuration.exceptions import ConfigurationError
 from zope.publisher.browser import TestRequest
@@ -42,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
 
@@ -93,7 +90,6 @@
     def index(self):
         return self
 
-
 class ITestMenu(Interface):
     """Test menu."""
 
@@ -104,7 +100,7 @@
 
 
 
-class Test(PlacelessSetup, unittest.TestCase):
+class Test(placelesssetup.PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
         super(Test, self).setUp()
@@ -113,7 +109,7 @@
 
 
     def testPage(self):
-        self.assertEqual(zapi.queryView(ob, 'test', request),
+        self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
                          None)
 
         xmlconfig(StringIO(template % (
@@ -128,11 +124,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')
                          
@@ -156,12 +152,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')
                          
@@ -184,12 +180,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')
 
@@ -214,12 +210,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')
                          
@@ -246,12 +242,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 % (
             '''
@@ -261,12 +257,11 @@
             '''
             )))
 
-        self.assertEqual(zapi.getDefaultViewName(ob, request
-                                 ), 'test')
+        self.assertEqual(zapi.getDefaultViewName(ob, request), 'test')
 
     def testSkinResource(self):
         self.assertEqual(
-            zapi.queryResource('test', Request(IV), None), None)
+            zapi.queryAdapter(Request(IV), name='test'), None)
 
         xmlconfig(StringIO(template % (
             '''
@@ -283,16 +278,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" />
@@ -315,15 +311,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 % (
             '''
@@ -345,14 +342,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')
@@ -366,9 +363,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())
@@ -408,7 +405,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')
@@ -426,7 +423,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')
@@ -445,7 +442,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')
 
@@ -463,7 +460,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')
 
@@ -481,7 +478,7 @@
             '''
             ))
 
-        v = zapi.getView(ob, 'test', request)
+        v = zapi.getMultiAdapter((ob, request), name='test')
         self.assertEqual(v.index(), v)
         self.assert_(IBrowserPublisher.providedBy(v))
 
@@ -502,7 +499,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 %
@@ -520,15 +518,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 %
             '''
@@ -545,7 +544,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', ))
 
@@ -559,7 +558,8 @@
 
 
     def testNamedViewNoPagesForCallable(self):
-        self.assertEqual(zapi.queryView(ob, 'test', request), None)
+        self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
+                         None)
 
         xmlconfig(StringIO(template %
             '''
@@ -572,12 +572,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 %
             '''
@@ -590,12 +591,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 %
@@ -614,7 +616,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', ))
 
@@ -630,7 +632,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 %
@@ -650,7 +653,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', ))
 
@@ -683,7 +686,7 @@
             '''
             ))
 
-        view = zapi.getView(ob, 'test', request)
+        view = zapi.getMultiAdapter((ob, request), name='test')
         view = removeSecurityProxy(view)
         view.publishTraverse(request, 'index.html')
         
@@ -710,7 +713,7 @@
             '''
             ))
 
-        view = zapi.getView(ob, 'test', request)
+        view = zapi.getMultiAdapter((ob, request), name='test')
         view = removeSecurityProxy(view)
         view.publishTraverse(request, 'index.html')
 
@@ -718,7 +721,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 %
@@ -739,16 +742,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 %
@@ -770,14 +773,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 %
             '''
@@ -803,16 +807,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 %
             '''
@@ -823,7 +828,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")
@@ -841,9 +846,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')
 
@@ -856,18 +859,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 %
             '''
@@ -879,13 +882,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 test_page_menu_within_different_layers(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 %
             '''
@@ -916,14 +920,14 @@
             ''' % (path, 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 %
             '''
@@ -936,7 +940,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):
@@ -944,7 +948,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 %
@@ -971,12 +975,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>')
 
@@ -1015,7 +1019,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 %
             '''
@@ -1028,7 +1033,7 @@
             '''
             ))
 
-        v = zapi.queryView(ob, 'test', request, providing=IV)
+        v = zapi.queryMultiAdapter((ob, request), IV, name='test')
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -1043,12 +1048,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 %
@@ -1061,7 +1066,7 @@
             '''
             ))
 
-        v = zapi.queryView(ob, '', request, None, providing=IV)
+        v = zapi.queryMultiAdapter((ob, request), IV)
         self.assertEqual(v, None)
 
         xmlconfig(StringIO(template %
@@ -1075,7 +1080,7 @@
             '''
             ))
 
-        v = zapi.queryView(ob, '', request, None, providing=IV)
+        v = zapi.queryMultiAdapter((ob, request), IV)
 
         self.assert_(isinstance(v, V1))
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_fields.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_fields.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_fields.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_fileresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_fileresource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_fileresource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_menu.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_menu.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_menu.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_menudirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_menudirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_menudirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_pagetemplateresource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_resource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_resource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_resource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/test_resources.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_resources.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_resources.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/tests/testi18nfileresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/testi18nfileresource.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/testi18nfileresource.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/publisher/browser/viewmeta.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/viewmeta.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/browser/viewmeta.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -117,6 +117,7 @@
             raise ConfigurationError("No such file", template)
         required['__getitem__'] = permission
 
+    # XXX: new __name__ attribute must be tested
     if class_:
         if attribute != '__call__':
             if not hasattr(class_, attribute):
@@ -125,8 +126,7 @@
                     )
         if template:
             # class and template
-            new_class = SimpleViewClass(
-                template, bases=(class_, ))
+            new_class = SimpleViewClass(template, bases=(class_, ), name=name)
         else:
             if not hasattr(class_, 'browserDefault'):
                 cdict = {
@@ -136,17 +136,16 @@
             else:
                 cdict = {}
 
+            cdict['__name__'] = name
             cdict['__page_attribute__'] = attribute
-            new_class = type(class_.__name__,
-                             (class_, simple,),
-                             cdict)
+            new_class = type(class_.__name__, (class_, simple,), cdict)
 
         if hasattr(class_, '__implements__'):
             classImplements(new_class, IBrowserPublisher)
 
     else:
         # template
-        new_class = SimpleViewClass(template)
+        new_class = SimpleViewClass(template, name=name)
 
     for n in (attribute, 'browserDefault', '__call__', 'publishTraverse'):
         required[n] = permission
@@ -163,7 +162,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 +170,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 +272,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 +285,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
 
@@ -316,6 +315,7 @@
         except:
             cname = "GeneratedClass"
 
+        cdict['__name__'] = name
         newclass = type(cname, bases, cdict)
 
         for n in ('publishTraverse', 'browserDefault', '__call__'):
@@ -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/trunk/src/zope/app/publisher/xmlrpc/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -12,10 +12,6 @@
 Let's write a view that returns a folder listing:
 
   >>> class FolderListing:
-  ...     def __init__(self, context, request):
-  ...         self.context = context
-  ...         self.request = request
-  ...
   ...     def contents(self):
   ...         return list(self.context.keys())
 

Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -24,18 +24,17 @@
 
 class XMLRPCView(object):
     """A base XML-RPC view that can be used as mix-in for XML-RPC views.""" 
-
     zope.interface.implements(zope.app.publisher.interfaces.xmlrpc.IXMLRPCView)
 
     def __init__(self, context, request):
         self.context = context
         self.request = request
 
-
 class IMethodPublisher(zope.interface.Interface):
     """Marker interface for an object that wants to publish methods
     """
 
+# Need to test new __parent__ attribute
 class MethodPublisher(XMLRPCView, zope.app.location.Location):
     """Base class for very simple XML-RPC views that publish methods
 
@@ -43,9 +42,17 @@
 
     This example is explained in the README.txt file for this package
     """
-
     zope.interface.implements(IMethodPublisher)
 
+    def __getParent(self):
+        return hasattr(self, '_parent') and self._parent or self.context
+
+    def __setParent(self, parent):
+        self._parent = parent
+
+    __parent__ = property(__getParent, __setParent)
+
+
 class MethodTraverser(object):
     zope.interface.implements(
         zope.publisher.interfaces.xmlrpc.IXMLRPCPublisher)

Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,7 +19,7 @@
 import zope.interface
 import zope.app.folder.folder
 import zope.publisher.interfaces.xmlrpc
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi, functional
 
 # Evil hack to make pickling work with classes defined in doc tests
 class NoCopyDict(dict):
@@ -68,8 +68,7 @@
     del sys.modules[name]
 
 def test_suite():
-    from zope.app.tests.functional import FunctionalDocFileSuite
-    return FunctionalDocFileSuite(
+    return functional.FunctionalDocFileSuite(
         'README.txt',
         setUp=setUp, tearDown=tearDown, globs=globs)
 

Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,9 +22,9 @@
 from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
 
 from zope.app import zapi
-from zope.app.location import Location
 from zope.app.component.interface import provideInterface
 from zope.app.component.metaconfigure import handler
+from zope.app.publisher.xmlrpc import MethodPublisher
 
 def view(_context, for_=None, interface=None, methods=None,
          class_=None,  permission=None, name=None):
@@ -50,6 +50,13 @@
                 args = ('', for_)
                 )
 
+    # Make sure that the class inherits MethodPublisher, so that the views
+    # have a location
+    if class_ is None:
+        class_ = MethodPublisher
+    else:
+        class_ = type(class_.__name__, (class_, MethodPublisher), {})
+
     if name:
         # Register a single view
         
@@ -69,7 +76,7 @@
         _context.action(
             discriminator = ('view', for_, name, IXMLRPCRequest),
             callable = handler,
-            args = (zapi.servicenames.Adapters, 'register',
+            args = ('provideAdapter',
                     (for_, IXMLRPCRequest), Interface, name, class_,
                     _context.info)
             )
@@ -80,21 +87,19 @@
             checker = None
 
         for name in require:
-            # create a new callable class with a security checker; mix
-            # in zope.app.location.Location so that the view inherits
-            # a security context
+            # create a new callable class with a security checker;
             cdict = {'__Security_checker__': checker,
                      '__call__': getattr(class_, name)}
-            new_class = type(class_.__name__, (class_, Location), cdict)
+            new_class = type(class_.__name__, (class_,), cdict)
             _context.action(
                 discriminator = ('view', for_, name, IXMLRPCRequest),
                 callable = handler,
-                args = (zapi.servicenames.Adapters, 'register',
+                args = ('provideAdapter',
                         (for_, IXMLRPCRequest), Interface, name, new_class,
                         _context.info)
                 )
 
-    # Register the used interfaces with the interface service
+    # Register the used interfaces with the site manager
     if for_ is not None:
         _context.action(
             discriminator = None,

Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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,36 @@
 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)
+        view = zapi.queryMultiAdapter((ob, request), name='test')
+        self.assert_(V1 in view.__class__.__bases__)
+        self.assert_(xmlrpc.MethodPublisher in view.__class__.__bases__)
 
     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 +81,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/trunk/src/zope/app/pythonpage/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pythonpage/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pythonpage/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,6 @@
 from zope.app import zapi
 from zope.app.container.contained import Contained
 from zope.app.interpreter.interfaces import IInterpreter
-from zope.component.servicenames import Utilities
 from zope.interface import Interface, implements
 from zope.schema import SourceText, TextLine
 from zope.app.i18n import ZopeMessageIDFactory as _
@@ -218,8 +217,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/trunk/src/zope/app/pythonpage/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/pythonpage/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/pythonpage/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,9 +23,8 @@
 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
 from zope.testing.doctestunit import DocTestSuite
 
@@ -38,9 +37,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/trunk/src/zope/app/rdb/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rdb/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -40,10 +40,8 @@
 from zope.app.rdb.interfaces import ISQLCommand
 from zope.app.rdb.interfaces import IManageableZopeDatabaseAdapter
 from zope.app.rdb.interfaces import IZopeDatabaseAdapter
-from zope.app.rdb.interfaces import IGlobalConnectionService
 
 
-
 def sqlquote(x):
     """
     Escape data suitable for inclusion in generated ANSI SQL92 code for

Modified: Zope3/trunk/src/zope/app/rdb/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/rdb/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rdb/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 
 <!-- ZopeDatabaseAdapter default views -->
 
-  <!-- XXX need an index.html that gives the source and is the def view -->
+  <!-- TODO: need an index.html that gives the source and is the def view -->
 
   <view
       name="+"
@@ -46,18 +46,6 @@
       for="zope.app.rdb.interfaces.IManageableZopeDatabaseAdapter"
       name="editForm.html" />
 
-  <addform
-      label="Add Database Connection Registration"
-      for="zope.app.rdb.interfaces.IManageableZopeDatabaseAdapter"
-      name="addRegistration.html"
-      schema="zope.app.utility.interfaces.IUtilityRegistration"
-      class="zope.app.utility.browser.AddRegistration"
-      permission="zope.ManageServices"
-      content_factory="zope.app.utility.UtilityRegistration"
-      arguments="name interface componentPath"
-      set_after_add="status"
-      fields="name interface componentPath permission status" />
-
   <zope:include file="gadflyda.zcml" />
 
 </zope:configure>

Modified: Zope3/trunk/src/zope/app/rdb/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rdb/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -306,26 +306,6 @@
         """
 
 
-class IConnectionService(Interface):
-
-    def getConnection(name):
-        """Returns a connection object by name."""
-
-    def queryConnection(name, default):
-        """Returns a connection object by name or default."""
-
-    def getAvailableConnections():
-        """Returns the connection names available from this connection
-        service."""
-
-
-class IGlobalConnectionService(IConnectionService):
-    """A global connection service"""
-
-    def provideConnection(name, adapter, dsn):
-        """ Register a connection instance for site-wide use """
-
-
 class IDBIConnection(Interface):
     """A DB-API based Interface """
 
@@ -375,10 +355,8 @@
 
 class IZopeDatabaseAdapter(IDBITypeInfo):
     """Interface for persistent object that returns
-    volatile IZopeConnections.
+    volatile IZopeConnections."""
 
-    This object is internal to the connection service."""
-
     def isConnected():
         """Check whether the Zope Connection is actually connected to the
         database."""

Modified: Zope3/trunk/src/zope/app/rdb/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rdb/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -29,10 +29,10 @@
 def provideConnection(name, connection):
     """ Registers a database connection
     
-     Uses the Utility Service for registering
+    Uses the global site manager for registering the connection
     """
-    utilities = zapi.getGlobalService(zapi.servicenames.Utilities)
-    utilities.provideUtility(IZopeDatabaseAdapter, connection, name)
+    gsm = zapi.getGlobalSiteManager()
+    gsm.provideUtility(IZopeDatabaseAdapter, connection, name)
 
 
     

Modified: Zope3/trunk/src/zope/app/rdb/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rdb/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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

Deleted: Zope3/trunk/src/zope/app/registration/PACKAGE.cfg
===================================================================
--- Zope3/trunk/src/zope/app/registration/PACKAGE.cfg	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/PACKAGE.cfg	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,5 +0,0 @@
-# The fssync sub-package is a separate component.
-
-<collection>
-  fssync -
-</collection>

Deleted: Zope3/trunk/src/zope/app/registration/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/registration/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,126 +0,0 @@
-============
-Registration
-============
-
-:Author: Jim Fulton
-:Version: $Rev$
-
-Many services act as component registries.  Their primary job is to
-allow components to be looked up based on parameters such as names,
-interfaces or both. Examples of component registries include the
-adapter service, the presentation service, the service service, and the
-utility service.
-
-An important feature of component registration services is that they
-support multiple conflicting registrations for the same registration
-parameters.  At most one of the conflicting registrations is active.
-A site developer can switch between alternate components by simply
-changing which one is active.
-
-Consider the following scenario.  A product provides a utility.  A
-site manager gets a new version of the utility and installs
-it.  The new version is active.  The site developer then finds a
-bug in the new version.  Because the old utility is still registered,
-the site developer can easily switch back to it by making it active.
-In fact, the site manager only needs to inactivate the new version and
-the old version becomes active again.
-
-To support this registration flexibility, Zope provides a registration
-framework:
-
-- Registration objects manage registration parameters and other data.
-  They also provide access to registered components. In some cases,
-  such as adapters and views, they are responsible for constructing
-  components on the fly.
-
-- Registration managers support management of registration objects
-  in folders.  Each folder has a registration manager containing all
-  of the registration objects for that folder.
-
-- `RegistrationStack` objects manage multiple registrations for
-  the same registration parameters (at most one of which is active at
-  any given time).  For example, in the case of a utility service
-  these would be registrations for the same interface and name.
-
-There are two kinds of registrations:
-
-- Local-object registrations register objects in site-management
-  folders, such as service instances, utility instances, database
-  connections, caches, and templates.
-
-  Local objects are named using a path.
-
-  Local-object registrations are primarily managed through the objects
-  that they register. The objects have a "Registrations" tab that
-  allows the registrations (usually 1) for the objects to be managed.
-
-  Local-object registrations can also be browsed and edited in the
-  registration manager for the folder containing the registered
-  components.
-
-- Module-global registrations register objects stored in
-  modules. Objects in modules aren't managable directly, so we can't
-  manage their registrations through them.  (The state of an object
-  stored in a module must be represented solely by the module source.)
-
-  Module-global objects are named using dotted names.
-
-  Module-global registrations are added, browsed and edited in
-  registration mananagers.
-
-Implementation of services that support registration is substantially
-more difficult that implementation of non-registry services.
-
-High-level registration concepts glossary
------------------------------------------
-
-There are several major concepts/terms that need to be understood
-
-Registerables
-  Registerables are objects that can be registered.  They implement the
-  `IRegisterable` interface.
-
-Registries
-  Registeries are objects that registerables are registered with.
-  Typically, these are component-management services like the adapter
-  or utility service.
-
-Registration objects
-  Registration objects store data about registrations.  They store
-  registration data and represent the relationship between registries
-  and registerables.
-
-Registration managers
-  Registration managers are containers for managing registrations.
-  Registrations are stored in registration managers.  All of the
-  registrations for objects stored in a site-management folder are
-  contained in the folder's registration manager. Currently, the
-  registration manager is an item in the folder. We want to change
-  this so that the registration manager is exposed as a folder tab
-  rather than as an item.
-
-Registration stack
-  Registries allow multiple registrations for the same set of
-  registration parameters. At most one registration for a set of
-  parameters can be active at one time, but multiple registrations are
-  managed. 
-
-  Registries provide functions for looking up (`queryRegistrationsFor()`)
-  or creating (`createRegistrationsFor()`) registration stacks.  These
-  methods are passed registration objects whos attribute values are
-  used to specify the desired registration stacks.
-
-  This is a little but confusing, so we'll look at an example.
-  Utilities are registered using 2 parameterer, the interface provided
-  by the uttility, and the utility name.  For a given interface and
-  name, the utility service may have multiple utility
-  registrations. It uses a registration stack to store these. We can
-  get the registration stack by calling `queryRegistrationsFor()` with
-  a registration object that has the desired interface and name.  The
-  registration object passed need not be in in the stack. It is used
-  soley to provide the parameters.  
-
-Registered
-  The interface `IRegistered` provides storage and access to the
-  registrations for a registerable.  When we make a registration, we
-  refer to it in a registration stack and in the registered object.

Modified: Zope3/trunk/src/zope/app/registration/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +0,0 @@
-# Import this.


Property changes on: Zope3/trunk/src/zope/app/registration/__init__.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/registration/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,93 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
-
-  <!-- Registration registries -->
-
-  <content class=".registration.RegistrationStack">
-    <require
-        permission="zope.ManageServices"
-        interface=".interfaces.IRegistrationStack"
-        />
-  </content>
-
-  <content class=".registration.NotifyingRegistrationStack">
-    <require
-        permission="zope.ManageServices"
-        interface=".interfaces.IRegistrationStack"
-        />
-  </content>
-
-  <adapter
-      for=".interfaces.IRegisterable"
-      provides=".interfaces.IRegistered"
-      factory=".registration.Registered"
-      trusted="true"
-      />
-
-  <class class=".registration.Registered">
-    <require
-        permission="zope.ManageContent"
-        attributes="addUsage removeUsage" />
-    <allow attributes="usages registrations" />
-  </class>
-
-  <adapter
-      for=".interfaces.IRegisterable"
-      provides="zope.app.copypastemove.interfaces.IObjectCopier"
-      factory=".registration.RegisterableCopier"
-      permission="zope.ManageContent"
-    />
-
-  <!-- Registration Manager -->
-
-  <content class=".registration.RegistrationManager">
-    <factory
-        id="zope.app.services.RegistrationManager"
-        title="Registration Manager" />
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IReadContainer" />
-    <require
-        permission="zope.ManageServices"
-        interface="
-        zope.app.container.interfaces.IWriteContainer
-        .interfaces.IOrderedContainer
-        zope.app.container.interfaces.INameChooser
-        "
-        />
-    <implements
-        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
-        />
-  </content>
-
-  <subscriber
-      handler=".registration.SimpleRegistrationRemoveSubscriber"
-      for=".interfaces.IRegistration
-           zope.app.container.interfaces.IObjectRemovedEvent"
-      />
-
-  <subscriber
-      handler=".registration.ComponentRegistrationRemoveSubscriber"
-      for=".interfaces.IComponentRegistration
-           zope.app.container.interfaces.IObjectRemovedEvent"
-      />
-
-  <subscriber
-      handler=".registration.ComponentRegistrationAddSubscriber"
-      for=".interfaces.IComponentRegistration
-           zope.app.container.interfaces.IObjectAddedEvent"
-      />
-
-  <subscriber
-      handler=".registration.RegisterableMoveSubscriber"
-      for=".interfaces.IRegisterable
-           zope.app.container.interfaces.IObjectMovedEvent"
-      />
-
-  <subscriber
-    handler=".registration.componentRegistrationEventNotify"
-    for=".interfaces.IComponentRegistration
-         .interfaces.IRegistrationEvent" />
-
-</configure>

Modified: Zope3/trunk/src/zope/app/registration/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002-2005 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -13,39 +13,40 @@
 ##############################################################################
 """Interfaces for objects supporting registration
 
-$Id$
+$Id: interfaces.py 28654 2004-12-20 21:13:50Z gintautasm $
 """
-import zope.component.interfaces
-from zope.interface import Interface, Attribute, implements
-from zope.schema import TextLine, Field, Choice
-from zope.schema.interfaces import ITextLine, IField
+from zope.deprecation import deprecated
+from zope.interface import Interface, implements
+from zope.schema import TextLine
+from zope.schema.interfaces import ITextLine
+from zope.app.component.interfaces import registration
 
-from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.annotation.interfaces import IAnnotatable
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.container.interfaces import IContainerNamesContainer
-from zope.app.container.interfaces import IContained, IContainer
-from zope.app.container.constraints import ItemTypePrecondition
-from zope.app.container.constraints import ContainerTypesConstraint
-from zope.app.event.interfaces import IObjectEvent
+UnregisteredStatus = registration.InactiveStatus
+RegisteredStatus = registration.InactiveStatus
+ActiveStatus = registration.ActiveStatus
 
-UnregisteredStatus = _('Unregistered')
-RegisteredStatus = _('Registered')
-ActiveStatus = _('Active')
+deprecated(('UnregisteredStatus', 'RegisteredStatus'),
+           'Registered and unregistered status has have been collapsed into '
+           'zope.app.component.interfaces.registration.InactiveStatus. '
+           'Will be gone in X3.3.')
+deprecated('ActiveStatus',
+           'ActiveStatus is now available in '
+           'zope.app.component.interfaces.registration. '
+           'Will be gone in X3.3.')
 
+IRegistrationEvent = registration.IRegistrationEvent
+IRegistrationActivatedEvent = registration.IRegistrationActivatedEvent
+IRegistrationDeactivatedEvent = registration.IRegistrationDeactivatedEvent
 
-class IRegistrationEvent(IObjectEvent):
-    """An event that involves a registration"""
+deprecated(('IRegistrationEvent',
+            'IRegistrationActivatedEvent', 'IRegistrationDeactivatedEvent'),
+           'The registration events have moved to '
+           'zope.app.component.interfaces.registration. '
+           'Will be gone in X3.3.')
 
-class IRegistrationActivatedEvent(IRegistrationEvent):
-    """This event is fired, when a component's registration is activated."""
 
-class IRegistrationDeactivatedEvent(IRegistrationEvent):
-    """This event is fired, when a component's registration is deactivated."""
-
 class INoLocalServiceError(Interface):
-    """No local service to register with.
-    """
+    """No local service to register with."""
 
 class NoLocalServiceError(Exception):
     """No local service to configure
@@ -53,66 +54,20 @@
     An attempt was made to register a registration for which there is
     no local service.
     """
-
     implements(INoLocalServiceError)
 
-class IRegistration(Interface):
-    """Registration object
+deprecated(('INoLocalServiceError', 'NoLocalServiceError'),
+           'The concept of services has been removed. This event will '
+           'be gone in X3.3.')
 
-    A registration object represents a specific registration
-    decision, such as registering an adapter or defining a permission.
+IRegistration = registration.IRegistration
 
-    In addition to the attributes or methods defined here,
-    registration objects will include additional attributes
-    identifying how they should be used. For example, a service
-    registration will provide a service type. An adapter
-    registration will specify a used-for interface and a provided
-    interface.
-    """
+deprecated(('IRegistrationEvent',
+            'IRegistrationActivatedEvent', 'IRegistrationDeactivatedEvent'),
+           'The registration events have moved to '
+           'zope.app.component.interfaces.registration. '
+           'Will be gone in X3.3.')
 
-    serviceType = Attribute("service type that manages "
-                            "this registration type")
-    # A string; typically a class attribute
-
-    status = Choice(
-        title=_("Registration status"),
-        values=(UnregisteredStatus, RegisteredStatus, ActiveStatus),
-        default=UnregisteredStatus
-        )
-
-    # BBB Deprecated methods, since their functionality is better implemented
-    # using event, which is done now. 12/05/2004
-    # ----------------------------------------------------------------------
-    def activated():
-        """Method called when a registration is made active.
-        """
-
-    def deactivated():
-        """Method called when a registration is made inactive.
-        """
-    # ----------------------------------------------------------------------
-
-    def usageSummary():
-        """Single-line usage summary.
-
-        This should include the registration keys and the kind of
-        registration. For example, a service registration will have a
-        usage summary that indicates a registration for a service of
-        some type.  (e.g. "View Service")
-
-        """
-
-    def implementationSummary():
-        """Single-line implementation summary.
-
-        This summarizes the implementation of the thing being
-        registered. For example, for local-component registrations,
-        this will include the component path. For a page registration,
-        this might include a template path and a dotted class name.
-        """
-
-#############################################################################
-# BBB: Kept for backward-compatibility. 12/05/2004
 class IComponentPath(ITextLine):
     """A component path
 
@@ -127,193 +82,32 @@
     traversed to get an object.
     """
     implements(IComponentPath)
-#############################################################################
 
+deprecated(('IComponentPath', 'ComponentPath'),
+           'Registrations now use component references instead of component '
+           'paths. Use zope.app.component.interfaces.registration.Component '
+           'instead. This field will be gone in X3.3.')
 
-class IComponent(IField):
-    """A component path
+IComponentRegistration = registration.IComponentRegistration
 
-    This is just the interface for the ComponentPath field below.  We'll use
-    this as the basis for looking up an appropriate widget.
-    """
+deprecated('IComponentRegistration',
+           'The IComponentRegistration interface has moved to '
+           'zope.app.component.interfaces.registration. '
+           'This reference will be gone in X3.3.')
 
-class Component(Field):
-    """A component path
+from zope.app.component.bbb.interfaces import IRegistrationStack
 
-    Values of the field are absolute unicode path strings that can be
-    traversed to get an object.
-    """
-    implements(IComponent)
+deprecated('IRegistrationStack',
+           'The registration stack concept has been removed. '
+           'This interface will be gone in X3.3.')
 
+IRegistry = registration.IRegistry
 
+deprecated('IRegistry',
+           'The IRegistry interface has moved to '
+           'zope.app.component.interfaces.registration. '
+           'This reference will be gone in X3.3.')
 
-class IComponentRegistration(IRegistration):
-    """Registration object that uses a component path and a permission."""
-
-    permission = Choice(
-        title=_("The permission needed to use the component"),
-        vocabulary="Permissions",
-        required=False,
-        )
-
-    component = Component(
-        title=_("Registration Component"),
-        description=_("The component the registration is for."),
-        required=True)
-
-    #########################################################################
-    # BBB: Kept for backward-compatibility. 12/05/2004
-    componentPath = ComponentPath(
-        title=_("Component path"),
-        description=_("The path to the component; this may be absolute, "
-                      "or relative to the nearest site management folder"),
-        required=True)
-
-    
-    def getComponent():
-        """Return the component named in the registration.
-
-        This is provided for backward compatibility; please use the
-        `component` attribute instead.
-        """
-    #########################################################################
-
-
-class IRegistrationStack(Interface):
-    """A stack of registrations for a set of parameters
-
-    A service will have a registry containing registry stacks
-    for specific parameters.  For example, an adapter service will
-    have a registry stack for each given used-for and provided
-    interface.
-
-    The registry stack works like a stack: the first element is
-    active; when it is removed, the element after it is automatically
-    activated.  An explicit None may be present (at most once) to
-    signal that nothing is active.  To deactivate an element, it is
-    moved to the end.
-    """
-
-    def register(registration):
-        """Register the given registration without activating it.
-
-        Do nothing if the registration is already registered.
-        """
-
-    def unregister(registration):
-        """Unregister the given registration.
-
-        Do nothing if the registration is not registered.
-
-        Implies deactivate() if the registration is active.
-        """
-
-    def registered(registration):
-        """Is the registration registered?
-
-        Return a boolean indicating whether the registration has been
-        registered.
-        """
-
-    def activate(registration):
-        """Make the registration active.
-
-        The activated() method is called on the registration.  If
-        another registration was previously active, its deactivated()
-        method is called first.
-
-        If the argument is None, the currently active registration if
-        any is disabled and no new registration is activated.
-
-        Raises a ValueError if the given registration is not registered.
-        """
-
-    def deactivate(registration):
-        """Make the registration inactive.
-
-        If the registration is active, the deactivated() method is
-        called on the registration.  If this reveals a registration
-        that was previously active, that registration's activated()
-        method is called.
-
-        Raises a ValueError if the given registration is not registered.
-
-        The call has no effect if the registration is registered but
-        not active.
-        """
-
-    def active():
-        """Return the active registration, if any.
-
-        Otherwise, returns None.
-        """
-
-    def info():
-        """Return a sequence of registration information.
-
-        The sequence items are mapping objects with keys:
-
-        active -- A boolean indicating whether the registration is
-                  active.
-
-        registration -- The registration object.
-        """
-
-    def __nonzero__(self):
-        """The registry is true iff it has no registrations."""
-
-
-class IRegistry(zope.component.interfaces.IRegistry):
-    """A component that can be configured using a registration manager."""
-
-    def registrations(localOnly=False):
-        """Returns a list of all registrations.
-
-        This method returns a complete list of Registration objects, which can
-        be used for 'queryRegistrationFor()', for example. Usually this method
-        will return registrations from all accessible registries of the same
-        kind, but if 'localOnly' is set to true only registrations defined in
-        this registry will be returned.
-        """
-
-    def queryRegistrationsFor(registration, default=None):
-        """Return an IRegistrationStack for the registration.
-
-        Data on the registration is used to decide which registry to
-        return. For example, a service manager will use the
-        registration name attribute to decide which registry
-        to return.
-
-        Typically, an object that implements this method will also
-        implement a method named queryRegistrations, which takes
-        arguments for each of the parameters needed to specify a set
-        of registrations.
-
-        The registry must be in the context of the registry.
-
-        """
-
-    def createRegistrationsFor(registration):
-        """Create and return an IRegistrationStack for the registration.
-
-        Data on the registration is used to decide which regsitry to
-        create. For example, a service manager will use the
-        registration name attribute to decide which regsitry
-        to create.
-
-        Typically, an object that implements this method will also
-        implement a method named createRegistrations, which takes
-        arguments for each of the parameters needed to specify a set
-        of registrations.
-
-        Calling createRegistrationsFor twice for the same registration
-        returns the same registry.
-
-        The registry must be in the context of the registry.
-
-        """
-
-
 class IOrderedContainer(Interface):
     """Containers whose items can be reorderd."""
 
@@ -333,114 +127,30 @@
         """Move the objects corresponding to the given names down.
         """
 
-class IRegistrationManager(IContainerNamesContainer, IOrderedContainer):
-    """Manage Registrations
-    """
+deprecated('IOrderedContainer',
+           'The ordered container should have not been declared here. The '
+           'registerable container does not support this interface anymore, '
+           'since it was useless anyways. '
+           'This interface will be gone in X3.3.')
 
-class IRegisterableContainer(IContainer):
-    """Containers with registration managers
+IRegistrationManager = registration.IRegistrationManager
+IRegisterableContainer = registration.IRegisterableContainer
+IRegisterable = registration.IRegisterable
+IRegistered = registration.IRegistered
 
-    These are site-management folders of one sort or another.
+deprecated(('IRegistrationManager', 'IRegisterableContainer',
+            'IRegisterable', 'IRegistered'), 
+           'This interface has moved to '
+           'zope.app.component.interfaces.registration. '
+           'This reference will be gone in X3.3.')
 
-    The container allows clients to access the registration manager
-    without knowing it's name.
+IAttributeRegisterable = IRegisterable
 
-    TODO: At this point, it doesn't really make sense for regsitration
-    managers to be items.  It would probably be better to expose the
-    registrations as a separate tab.
+deprecated('IAttributeRegisterable', 
+           'Registrations are not stored on the component anymore and thus '
+           'the attribute registerable is now simply a registerable. '
+           'This reference will be gone in X3.3.')
 
-    The container prevents deletion of the last registration manager.
-
-    The container may allow more than one registration manager. If it
-    has more than one, the one returned from an unnamed access is
-    undefined.
-    TODO: The container should allow one and only one.
-
-    The registration manager container *also* supports local-module
-    lookup.
-
-    """
-
-    def getRegistrationManager():
-        """Get a registration manager.
-
-        Find a registration manager.  Clients can get the
-        registration manager without knowing its name. Normally,
-        folders have one registration manager. If there is more than
-        one, this method will return one; which one is undefined.
-
-        An error is raised if no registration manager can be found.
-        """
-
-    def findModule(name):
-        """Find the module of the given name.
-
-        If the module can be find in the folder or a parent folder
-        (within the site manager), then return it, otherwise, delegate
-        to the module service.
-
-        This must return None when the module is not found.
-
-        """
-
-    def resolve(name):
-        """Resolve a dotted object name.
-
-        A dotted object name is a dotted module name and an object
-        name within the module.
-
-        TODO: We really should switch to using some other character than
-        a dot for the delimiter between the module and the object
-        name.
-
-        """
-
-    def __setitem__(name, object):
-        """Add to object"""
-
-class IRegisterable(IAnnotatable, IContained):
-    """A marker interface."""
-    
-    __parent__ = Field(
-        constraint = ContainerTypesConstraint(IRegisterableContainer))
-
-IRegisterableContainer['__setitem__'].setTaggedValue(
-    'precondition',
-    ItemTypePrecondition(IRegisterable, IRegisterableContainer))
-    
-
-class IRegistered(Interface):
-    """An object that can keep track of its configured uses.
-
-    The object need not implement this functionality itself, but must at
-    least support doing so via an adapter.
-    """
-
-    def addUsage(location):
-        """Add a usage by location.
-
-        The location is the physical path to the registration object that
-        configures the usage.
-        """
-    def removeUsage(location):
-        """Remove a usage by location.
-
-        The location is the physical path to the registration object that
-        configures the usage.
-        """
-    def usages():
-        """Return a sequence of locations.
-
-        A location is a physical path to a registration object that
-        configures a usage.
-        """
-
-    def registrations():
-        """Return a sequence of registration objects for this object."""
-
-class IAttributeRegisterable(IAttributeAnnotatable, IRegisterable):
-    """A marker interface."""
-
 class INoRegistrationManagerError(Interface):
     """No registration manager error
     """
@@ -454,3 +164,8 @@
 
     """
     implements(INoRegistrationManagerError)
+
+deprecated(('INoRegistrationManagerError', 'NoRegistrationManagerError'),
+           'It is now guaranteed that a registerable container has a '
+           'registration manager; thus this error is never raised. '
+           'This event will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/registration/interfaces.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.9
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/registration/registration.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/registration.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/registration/registration.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,1019 +13,58 @@
 ##############################################################################
 """Component registration support for services
 
-$Id$
+$Id: registration.py 29078 2005-02-07 22:50:03Z garrett $
 """
-import sys
-import warnings
-from persistent import Persistent
+from zope.deprecation import deprecated
 
-import zope.cachedescriptors.property
-import zope.event
-from zope.interface import implements
-from zope.exceptions import DuplicationError
-from zope.proxy import removeAllProxies, getProxiedObject
-from zope.security.checker import InterfaceChecker, CheckerPublic
-from zope.security.proxy import Proxy, removeSecurityProxy
+from zope.app.component import registration
 from zope.component import subscribers
+from zope.component import subscribers
+from zope.component import subscribers
 
-from zope.app import zapi
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.component.localservice import getLocalServices
-from zope.app.container.contained import Contained
-from zope.app.container.contained import setitem, contained, uncontained
-from zope.app.copypastemove import ObjectCopier
-from zope.app.dependable.interfaces import IDependable, DependencyError
-from zope.app.event import objectevent
-from zope.app.location import inside
-from zope.app.module.interfaces import IModuleManager
-from zope.app.registration import interfaces
+RegistrationEvent = registration.RegistrationEvent
+RegistrationActivatedEvent = registration.RegistrationActivatedEvent
+RegistrationDeactivatedEvent = registration.RegistrationDeactivatedEvent
 
+deprecated(('RegistrationEvent',
+            'RegistrationActivatedEvent', 'RegistrationDeactivatedEvent'),
+           'The registration events have moved to '
+           'zope.app.component.registration. '
+           'Will be gone in X3.3.')
 
-class RegistrationEvent(objectevent.ObjectEvent):
-    implements(interfaces.IRegistrationEvent)
+RegistrationStatusPropery = registration.RegistrationStatusProperty
 
-class RegistrationActivatedEvent(RegistrationEvent):
-    implements(interfaces.IRegistrationActivatedEvent)
+deprecated('RegistrationStatusProperty',
+           'The status property has moved to zope.app.component.registration. '
+           'Will be gone in X3.3.')
 
-class RegistrationDeactivatedEvent(RegistrationEvent):
-    implements(interfaces.IRegistrationDeactivatedEvent)
+from zope.app.component.bbb.registration import RegistrationStack
+NotifyingRegistrationStack = RegistrationStack
 
+deprecated(('RegistrationStack', 'NotifyingRegistrationStack'),
+           'The registration stack concept has been removed. '
+           'This class will be gone in X3.3.')
 
-class RegistrationStatusProperty(object):
+SimpleRegistrationRemoveSubscriber = \
+    registration.SimpleRegistrationRemoveSubscriber
+SimpleRegistration = registration.SimpleRegistration
 
-    def __get__(self, inst, klass):
-        if inst is None:
-            return self
+ComponentRegistration = registration.ComponentRegistration
+ComponentRegistrationAddSubscriber = \
+    registration.ComponentRegistrationAddSubscriber
+ComponentRegistrationRemoveSubscriber = \
+    registration.ComponentRegistrationRemoveSubscriber
+RegisterableMoveSubscriber = registration.RegisterableMoveSubscriber
 
-        registration = inst
-        service = self._get_service(registration)
-        registry = service and service.queryRegistrationsFor(registration)
+Registered = registration.Registered
 
-        if registry:
+RegistrationManager = registration.RegistrationManager
 
-            if registry.active() == registration:
-                return interfaces.ActiveStatus
-            if registry.registered(registration):
-                return interfaces.RegisteredStatus
+RegisterableContainer = registration.RegisterableContainer
 
-        return interfaces.UnregisteredStatus
-
-    def __set__(self, inst, value):
-        registration = inst
-        service = self._get_service(registration)
-        registry = service and service.queryRegistrationsFor(registration)
-
-        if value == interfaces.UnregisteredStatus:
-            if registry:
-                registry.unregister(registration)
-
-        else:
-            if not service:
-                raise interfaces.NoLocalServiceError(
-                    "This registration change cannot be performed because "
-                    "there isn't a corresponding %s service defined in this "
-                    "site. To proceed, first add a local %s service."
-                    % (registration.serviceType, registration.serviceType))
-
-            if registry is None:
-                registry = service.createRegistrationsFor(registration)
-
-            if value == interfaces.RegisteredStatus:
-                if registry.active() == registration:
-                    registry.deactivate(registration)
-                else:
-                    registry.register(registration)
-
-            elif value == interfaces.ActiveStatus:
-                if not registry.registered(registration):
-                    registry.register(registration)
-                registry.activate(registration)
-
-    def _get_service(self, registration):
-        # how we get the service is factored out so subclasses can
-        # approach this differently
-        sm = zapi.getServices(registration)
-        return sm.queryLocalService(registration.serviceType)
-
-
-class RegistrationStack(Persistent, Contained):
-    """Registration registry implemention
-
-       A registration stack provides support for a collection of
-       registrations such that, at any time, at most one is active.  The
-       "stack" aspect of the api is designed to support "uninstallation",
-       as will be described below.
-
-       Registration stacks manage registrations.  They don't really care
-       what registrations are.
-
-         >>> from zope.app.registration import interfaces
-
-         >>> class Registration(object):
-         ...
-         ...     def __init__(self, name):
-         ...         self.name = name
-         ...         self.active = False
-         ...
-         ...     def __repr__(self):
-         ...         return self.name
-         ...
-
-       When a registration is activated or deactivated, an event is published
-       to which one can subscribe; in our case the registration components
-       themselves subscribe to these events to set their status.
-
-         >>> def setActive(event):
-         ...     event.object.active = True
-         >>> subscribe((interfaces.IRegistrationActivatedEvent,), None,
-         ...           setActive)
-
-         >>> def unsetActive(event):
-         ...     event.object.active = False
-         >>> subscribe((interfaces.IRegistrationDeactivatedEvent,), None,
-         ...           unsetActive)
-
-
-       We create a registration stack by providing it with a parent:
-
-         >>> from zope.app.registration.registration import RegistrationStack
-         >>> stack = RegistrationStack(42)
-         >>> stack.__parent__
-         42
-
-       If a stack doesn't have any registrations, it's false:
-
-         >>> bool(stack)
-         False
-
-       And it has no active registration:
-
-         >>> stack.active()
-
-       We can register a registration:
-
-         >>> r1 = Registration('r1')
-         >>> stack.register(r1)
-
-       and then the stack is true:
-
-         >>> bool(stack)
-         True
-
-       But we still don't have an active registration:
-
-         >>> stack.active()
-
-       Until we activate one:
-
-         >>> stack.activate(r1)
-         >>> stack.active()
-         r1
-
-       at which point, the registration has been notified that it is
-       active:
-
-         >>> r1.active
-         True
-
-       We can't activate a registration unless it's registered:
-
-         >>> r2 = Registration('r2')
-         >>> stack.activate(r2)
-         Traceback (most recent call last):
-         ...
-         ValueError: ('Registration to be activated is not registered', r2)
-
-         >>> stack.register(r2)
-         >>> stack.activate(r2)
-
-       Note that activating r2, deactivated r1:
-
-         >>> r1.active
-         False
-
-       We can get status on the stack by calling it's info method:
-
-         >>> for info in stack.info():
-         ...     print info['registration'], info['active']
-         r2 True
-         r1 False
-
-       So why is this a stack? Unregistering an object is a bit like
-       popping an element. Suppose we unregister r2:
-
-         >>> stack.unregister(r2)
-
-       Whenever we unregister an object, we make the object that was
-       previously active active again:
-
-         >>> stack.active()
-         r1
-
-         >>> r1.active
-         True
-
-       Now, let's deactivate r1:
-
-         >>> stack.deactivate(r1)
-         >>> stack.active()
-         >>> r1.active
-         False
-
-       And register and activate r2:
-
-         >>> stack.register(r2)
-         >>> stack.activate(r2)
-         >>> stack.active()
-         r2
-
-       Now, if we unregister r2:
-
-         >>> stack.unregister(r2)
-
-       We won't have an active registration:
-
-         >>> stack.active()
-
-       Because there wasn't an active registration before we made r2
-       active.
-       """
-
-#     The invariants for _data are as follows:
-#
-#         (1) The last element (if any) is not None
-#
-#         (2) No value occurs more than once
-#
-#         (3) Each value except None is a relative path from the nearest
-#             service manager to an object implementing IRegistration
-
-    implements(interfaces.IRegistrationStack)
-
-    def __init__(self, container):
-        self.__parent__ = container
-        self.data = ()
-
-    def register(self, registration):
-        data = self.data
-        if data:
-            if registration in data:
-                return # already registered
-        else:
-            # Nothing registered. Need to stick None in front so that nothing
-            # is active.
-            data = (None, )
-
-        self.data = data + (registration, )
-
-    def unregister(self, registration):
-        data = self.data
-        if data:
-            if data[0] == registration:
-                # It is active!
-                data = data[1:]
-                self.data = data
-
-                # Tell it that it is no longer active
-                self._deactivate(registration)
-
-                if data and data[0] is not None:
-                    # Activate the newly active component
-                    self._activate(data[0])
-            else:
-                # Remove it from our data
-                data = tuple([item for item in data if item != registration])
-
-                # Check for trailing None
-                if data and data[-1] is None:
-                    data = data[:-1]
-
-                self.data = data
-
-    def registered(self, registration):
-        return registration in self.data
-
-    def _activate(self, registration):
-        zope.event.notify(RegistrationActivatedEvent(registration))
-        # BBB: Depraction warningl 12/05/2004
-        if hasattr(registration, 'activated'):
-            warnings.warn(
-                "activated() deprected. Subscribe to "
-                "IRegistrationActivatedEvent instead.",
-                DeprecationWarning, stacklevel=3,
-                )
-            registration.activated()
-
-    def _deactivate(self, registration):
-        zope.event.notify(RegistrationDeactivatedEvent(registration))
-        # BBB: Depraction warningl 12/05/2004
-        if hasattr(registration, 'deactivated'):
-            warnings.warn(
-                "deactivated() deprected. Subscribe to "
-                "IRegistrationDeactivatedEvent instead.",
-                DeprecationWarning, stacklevel=3,
-                )
-            registration.deactivated()
-
-    def activate(self, registration):
-        data = self.data
-
-        if registration is None and not data:
-            return # already in the state we want
-
-        if registration is None or registration in data:
-            old = data[0]
-            if old == registration:
-                return # already active
-
-            # Insert it in front, removing it from back
-            data = ((registration, ) +
-                    tuple([item
-                           for item in data
-                           if item != registration])
-                    )
-
-            # Check for trailing None
-            if data[-1] == None:
-                data = data[:-1]
-
-            # Write data back
-            self.data = data
-
-            if old is not None:
-                # Deactivated the currently active component
-                self._deactivate(old)
-
-            if registration is not None:
-                # Tell it that it is now active
-                self._activate(registration)
-
-        else:
-            raise ValueError(
-                "Registration to be activated is not registered",
-                registration)
-
-    def deactivate(self, registration):
-        data = self.data
-
-        if registration not in data:
-            raise ValueError(
-                "Registration to be deactivated is not registered",
-                registration)
-
-        if data[0] != registration:
-            return # already inactive
-
-        if None not in data:
-            # Append None
-            data += (None,)
-
-        # Move it to the end
-        data = data[1:] + data[:1]
-
-        # Write data back
-        self.data = data
-
-        # Tell it that it is no longer active
-        self._deactivate(registration)
-
-        if data[0] is not None:
-            # Activate the newly active component
-            self._activate(data[0])
-
-    def active(self):
-        data = self.data
-        if data:
-            return data[0]
-        return None
-
-    def __nonzero__(self):
-        return bool(self.data)
-
-    def info(self):
-        data = self.data
-        result = [{'active': False,
-                   'registration': registration,
-                  }
-                  for registration in data
-                 ]
-
-        if result:
-            result[0]['active'] = True
-
-        return [r for r in result if r['registration'] is not None]
-
-    #########################################################################
-    # BBB: Backward compat
-    #
-    def data(self):
-        # Need to convert old path-based data to object-based data
-        # It won't affect new objects that get instance-based data attrs
-        # on construction.
-
-        data = []
-        sm = zapi.getServices(self)
-        for path in self._data:
-            if isinstance(path, basestring):
-                try:
-                    data.append(zapi.traverse(sm, path))
-                except KeyError:
-                    # ignore objects we can't get to
-                    raise # for testing
-            else:
-                data.append(path)
-
-        return tuple(data)
-
-    data = zope.cachedescriptors.property.CachedProperty(data)
-    #
-    #########################################################################
-
-
-#############################################################################
-# The functionality provided by this class can is better implemented by
-# subscribing to the RegistrationActivatedEvent and
-# RegistrationDeactivatedEvent.
-class NotifyingRegistrationStack(RegistrationStack):
-    """Notifying registration registry implemention
-
-       First, see RegistrationStack.
-
-       A notifying registration stack notifies both the registration
-       *and* the stacks parent when it changes.  It notifies the
-       parent by calling nothingActivated and notifyDeactivated:
-
-         >>> class Parent(object):
-         ...
-         ...     active = deactive = None
-         ...
-         ...     def notifyActivated(self, stack, registration):
-         ...         self.active = registration
-         ...
-         ...     def notifyDeactivated(self, stack, registration):
-         ...         self.active = None
-         ...         self.deactive = registration
-
-
-       To see this, we'll go through the same scenario we went through
-       in the RegistrationStack documentation.
-       A registration stack provides support for a collection of
-
-         >>> from zope.app.registration import interfaces
-         >>> class Registration(object):
-         ...
-         ...     def __init__(self, name):
-         ...         self.name = name
-         ...         self.active = False
-         ...
-         ...     def __repr__(self):
-         ...         return self.name
-
-         >>> def setActive(event):
-         ...     event.object.active = True
-         >>> subscribe((interfaces.IRegistrationActivatedEvent,), None,
-         ...           setActive)
-
-         >>> def unsetActive(event):
-         ...     event.object.active = False
-         >>> subscribe((interfaces.IRegistrationDeactivatedEvent,), None,
-         ...           unsetActive)
-
-       We create a registration stack by providing it with a parent:
-
-         >>> parent = Parent()
-         >>> from zope.app.registration import registration
-         >>> stack = registration.NotifyingRegistrationStack(parent)
-
-       We can register a registration:
-
-         >>> r1 = Registration('r1')
-         >>> stack.register(r1)
-
-       But we still don't have an active registration:
-
-         >>> stack.active()
-         >>> parent.active
-
-       Until we activate one:
-
-         >>> stack.activate(r1)
-         >>> parent.active
-         r1
-
-       if we activate a new registration:
-
-         >>> r2 = Registration('r2')
-         >>> stack.register(r2)
-         >>> stack.activate(r2)
-
-       The parent will be notified of the activation and the
-       deactivation:
-
-         >>> parent.active
-         r2
-         >>> parent.deactive
-         r1
-
-       If we unregister r2, it will become inactive and the parent
-       will be notified, but whenever we unregister an object, we make
-       the object that was previously active active again:
-
-         >>> stack.unregister(r2)
-         >>> parent.active
-         r1
-         >>> parent.deactive
-         r2
-
-       Now, let's deactivate r1:
-
-         >>> stack.deactivate(r1)
-         >>> parent.active
-         >>> parent.deactive
-         r1
-
-       And register and activate r2:
-
-         >>> stack.register(r2)
-         >>> stack.activate(r2)
-         >>> parent.active
-         r2
-
-       Now, if we unregister r2:
-
-         >>> stack.unregister(r2)
-
-       We won't have an active registration:
-
-         >>> parent.active
-         >>> parent.deactive
-         r2
-
-       Because there wasn't an active registration before we made r2
-       active.
-       """
-    def _activate(self, registration):
-        super(NotifyingRegistrationStack, self)._activate(registration)
-        self.__parent__.notifyActivated(self, registration)
-
-    def _deactivate(self, registration):
-        super(NotifyingRegistrationStack, self)._deactivate(registration)
-        self.__parent__.notifyDeactivated(self, registration)
-#############################################################################
-
-
-def SimpleRegistrationRemoveSubscriber(registration, event):
-    """Receive notification of remove event."""
-
-    services = getLocalServices(registration)
-    removed = event.object
-    if (services == removed) or inside(services, removed):
-        # we don't really care if the rigistration is active or
-        # registered, since the site is going away.
-        return
-
-    objectstatus = registration.status
-
-    if objectstatus == interfaces.ActiveStatus:
-        try:
-            objectpath = zapi.getPath(registration)
-        except: # XXX
-            objectpath = str(registration)
-        raise DependencyError("Can't delete active registration (%s)"
-                              % objectpath)
-    elif objectstatus == interfaces.RegisteredStatus:
-        registration.status = interfaces.UnregisteredStatus
-
-
-class SimpleRegistration(Persistent, Contained):
-    """Registration objects that just contain registration data"""
-
-    # We are including IAttributeAnnotatable here because we want all
-    # of the subclasses to get it and we don't really need to be
-    # flexible about the policy here. At least we don't *think* we
-    # do. :)
-    implements(interfaces.IRegistration, IAttributeAnnotatable)
-
-    status = RegistrationStatusProperty()
-
-    # Methods from IRegistration
-
-    # BBB: Deprecated on 12/05/2004
-    # def activated(self):
-    #     pass
-    #
-    # def deactivated(self):
-    #     pass
-
-    def usageSummary(self):
-        return self.__class__.__name__
-
-    def implementationSummary(self):
-        return ""
-
-
-# BBB: 12/05/2004
-NULL_COMPONENT = object()
-
-class ComponentRegistration(SimpleRegistration):
-    """Component registration.
-
-    Subclasses should define a getInterface() method returning the interface
-    of the component.
-    """
-
-    implements(interfaces.IComponentRegistration)
-
-    def __init__(self, component, permission=None):
-        # BBB: 12/05/2004
-        if isinstance(component, (str, unicode)):
-            self.componentPath = component
-        else:
-            # We always want to set the plain component. Untrusted code will
-            # get back a proxied component anyways.
-            self.component = removeSecurityProxy(component)
-        if permission == 'zope.Public':
-            permission = CheckerPublic
-        self.permission = permission
-
-    def implementationSummary(self):
-        return zapi.getPath(self.component)
-
-    ###########################################################################
-    # BBB: Backward compatibility from 12/05/2004
-    def getComponent(self):
-        warnings.warn(
-            "`getComponent()` is deprecated, since the component is now "
-            "available directly via `component`. Also, you should not use the "
-            "not use `componentPath` anymore, since it is deprecated.",
-            DeprecationWarning, stacklevel=2,
-            )
-        return self.__BBB_getComponent()
-
-    def __BBB_getComponent(self):
-        if self._component is NULL_COMPONENT:
-            return self.__BBB_old_getComponent(self._BBB_componentPath)
-
-        # This condition should somehow make it in the final code, since it
-        # honors the permission.
-        if self.permission:
-            checker = InterfaceChecker(self.getInterface(), self.permission)
-            return Proxy(self._component, checker)
-
-        return self._component
-
-    def __BBB_old_getComponent(self, path):
-        service_manager = zapi.getServices(self)
-
-        # Get the root and unproxy it
-        if path.startswith("/"):
-            # Absolute path
-            root = removeAllProxies(zapi.getRoot(service_manager))
-            component = zapi.traverse(root, path)
-        else:
-            # Relative path.
-            ancestor = self.__parent__.__parent__
-            component = zapi.traverse(ancestor, path)
-
-        if self.permission:
-            if type(component) is Proxy:
-                # There should be at most one security Proxy around an object.
-                # So, if we're going to add a new security proxy, we need to
-                # remove any existing one.
-                component = removeSecurityProxy(component)
-
-            interface = self.getInterface()
-
-            checker = InterfaceChecker(interface, self.permission)
-
-            component = Proxy(component, checker)
-
-        return component
-
-    def __BBB_setComponent(self, component):
-        self._BBB_componentPath = None
-        self._component = component
-
-    component = property(__BBB_getComponent, __BBB_setComponent)
-
-    def __BBB_getComponentPath(self):
-        warnings.warn(
-            "`componentPath` is deprecated. You can get to the component "
-            "directly by accessing `component`.",
-            DeprecationWarning, stacklevel=3,
-            )
-        if self._BBB_componentPath is not None:
-            return self._BBB_componentPath
-        return '/' + '/'.join(zapi.getPath(self.component))
-
-    def __BBB_setComponentPath(self, path):
-        warnings.warn(
-            "`componentPath` is deprecated. You can get to the component "
-            "directly by accessing `component`.",
-            DeprecationWarning, stacklevel=3,
-            )
-        self._component = NULL_COMPONENT
-        self._BBB_componentPath = path
-
-    componentPath = property(__BBB_getComponentPath, __BBB_setComponentPath)
-
-    def __setstate__(self, dict):
-        super(ComponentRegistration, self).__setstate__(dict)
-        # For some reason the component path is not set correctly by the
-        # default __setstate__ mechanism.
-        if 'componentPath' in dict:
-            self._component = NULL_COMPONENT
-            self._BBB_componentPath = dict['componentPath']
-
-        if isinstance(self._BBB_componentPath, (str, unicode)):
-            self._component = NULL_COMPONENT
-
-    ###########################################################################
-
-
-def ComponentRegistrationRemoveSubscriber(component_registration, event):
-    """Receive notification of remove event."""
-    component = component_registration.component
-    dependents = IDependable(component)
-    objectpath = zapi.getPath(component_registration)
-    dependents.removeDependent(objectpath)
-    # Also update usage, if supported
-    adapter = interfaces.IRegistered(component, None)
-    if adapter is not None:
-        adapter.removeUsage(zapi.getPath(component_registration))
-
-def ComponentRegistrationAddSubscriber(component_registration, event):
-    """Receive notification of add event."""
-    component = component_registration.component
-    dependents = IDependable(component)
-    objectpath = zapi.getPath(component_registration)
-    dependents.addDependent(objectpath)
-    # Also update usage, if supported
-    adapter = interfaces.IRegistered(component, None)
-    if adapter is not None:
-        adapter.addUsage(objectpath)
-
-def RegisterableMoveSubscriber(registerable, event):
-    """Updates componentPath for registrations on component rename."""
-    if event.oldParent is not None and event.newParent is not None:
-        if event.oldParent is not event.newParent:
-            raise DependencyError(
-                "Can't move a registered component from its container.")
-
-from zope.app.dependable import PathSetAnnotation
-
-class Registered(PathSetAnnotation):
-    """An adapter from IRegisterable to IRegistered.
-
-    This class is the only place that knows how 'Registered'
-    data is represented.
-    """
-    implements(interfaces.IRegistered)
-
-    __used_for__ = interfaces.IRegisterable
-
-    # We want to use this key:
-    #   key = "zope.app.registration.Registered"
-    # But we have existing annotations with the following key, so we'll keep
-    # it. :(
-    key = "zope.app.services.configuration.UseConfiguration"
-
-    addUsage = PathSetAnnotation.addPath
-    removeUsage = PathSetAnnotation.removePath
-    usages = PathSetAnnotation.getPaths
-
-    def registrations(self):
-        return [zapi.traverse(self.context, path)
-                for path in self.getPaths()]
-
-class RegisterableCopier(ObjectCopier):
-    """Copies registerable components.
-
-    Performs the additional step of removing existing registered usages
-    for the new copy.
-    """
-    __used_for__ = interfaces.IRegisterable
-
-    def _configureCopy(self, copy, target, new_name):
-        ObjectCopier._configureCopy(self, copy, target, new_name)
-        registered = interfaces.IRegistered(copy, None)
-        if registered is not None:
-            for usage in registered.usages():
-                registered.removeUsage(usage)
-
-class RegistrationManager(Persistent, Contained):
-    """Registration manager
-
-    Manages registrations within a package.
-    """
-    implements(interfaces.IRegistrationManager)
-
-    def __init__(self):
-        self._data = ()
-
-    def __getitem__(self, key):
-        "See IItemContainer"
-        v = self.get(key)
-        if v is None:
-            raise KeyError, key
-        return v
-
-    def get(self, key, default=None):
-        "See IReadMapping"
-        for k, v in self._data:
-            if k == key:
-                return v
-        return default
-
-    def __contains__(self, key):
-        "See IReadMapping"
-        return self.get(key) is not None
-
-    def keys(self):
-        "See IEnumerableMapping"
-        return [k for k, v in self._data]
-
-    def __iter__(self):
-        return iter(self.keys())
-
-    def values(self):
-        "See IEnumerableMapping"
-        return [v for k, v in self._data]
-
-    def items(self):
-        "See IEnumerableMapping"
-        return self._data
-
-    def __len__(self):
-        "See IEnumerableMapping"
-        return len(self._data)
-
-    def __setitem__(self, key, v):
-        setitem(self, self.__setitem, key, v)
-
-    def __setitem(self, key, v):
-        if key in self:
-            raise DuplicationError(key)
-        self._data += ((key, v), )
-
-    def addRegistration(self, object):
-        "See IWriteContainer"
-        key = self._chooseName('', object)
-        self[key] = object
-        return key
-
-    def _chooseName(self, name, object):
-        if not name:
-            name = object.__class__.__name__
-
-        i = 1
-        n = name
-        while n in self:
-            i += 1
-            n = name + str(i)
-
-        return n
-
-    def __delitem__(self, key):
-        "See IWriteContainer"
-        uncontained(self[key], self, key)
-        self._data = tuple(
-            [item
-             for item in self._data
-             if item[0] != key]
-            )
-
-    def moveTop(self, names):
-        self._data = tuple(
-            [item for item in self._data if (item[0] in names)]
-            +
-            [item for item in self._data if (item[0] not in names)]
-            )
-
-    def moveBottom(self, names):
-        self._data = tuple(
-            [item for item in self._data if (item[0] not in names)]
-            +
-            [item for item in self._data if (item[0] in names)]
-            )
-
-    def _moveUpOrDown(self, names, direction):
-        # Move each named item by one position. Note that this
-        # might require moving some unnamed objects by more than
-        # one position.
-
-        indexes = {}
-
-        # Copy named items to positions one less than they currently have
-        i = -1
-        for item in self._data:
-            i += 1
-            if item[0] in names:
-                j = max(i + direction, 0)
-                while j in indexes:
-                    j += 1
-
-                indexes[j] = item
-
-        # Fill in the rest where there's room.
-        i = 0
-        for item in self._data:
-            if item[0] not in names:
-                while i in indexes:
-                    i += 1
-                indexes[i] = item
-
-        items = indexes.items()
-        items.sort()
-
-        self._data = tuple([item[1] for item in items])
-
-    def moveUp(self, names):
-        self._moveUpOrDown(names, -1)
-
-    def moveDown(self, names):
-        self._moveUpOrDown(names, 1)
-
-
-class RegisterableContainer(object):
-    """Mix-in to implement IRegisterableContainer
-    """
-    implements(interfaces.IRegisterableContainer)
-
-    def __init__(self):
-        super(RegisterableContainer, self).__init__()
-        rm = RegistrationManager()
-        rm.__parent__ = self
-        rm.__name__ = 'RegistrationManager'
-        zope.event.notify(objectevent.ObjectCreatedEvent(rm))
-        self[rm.__name__] = rm
-
-    def __delitem__(self, name):
-        """Delete an item, but not if it's the last registration manager
-        """
-        item = self[name]
-        if interfaces.IRegistrationManager.providedBy(item):
-            # Check to make sure it's not the last one
-            if len([i for i in self.values()
-                    if interfaces.IRegistrationManager.providedBy(i)
-                    ]
-                   ) < 2:
-                raise interfaces.NoRegistrationManagerError(
-                    "Can't delete the last registration manager")
-        super(RegisterableContainer, self).__delitem__(name)
-
-    def getRegistrationManager(self):
-        """Get a registration manager
-        """
-        # Get the registration manager for this folder
-        for name in self:
-            item = self[name]
-            if interfaces.IRegistrationManager.providedBy(item):
-                # We found one. Get it in context
-                return item
-        else:
-            raise interfaces.NoRegistrationManagerError(
-                "Couldn't find an registration manager")
-
-    def findModule(self, name):
-        # Used by the persistent modules import hook
-
-        # Look for a .py file first:
-        manager = self.get(name+'.py')
-        if manager is not None:
-            # found an item with that name, make sure it's a module(manager):
-            if IModuleManager.providedBy(manager):
-                return manager.getModule()
-
-        # Look for the module in this folder:
-        manager = self.get(name)
-        if manager is not None:
-            # found an item with that name, make sure it's a module(manager):
-            if IModuleManager.providedBy(manager):
-                return manager.getModule()
-
-
-        # See if out container is a RegisterableContainer:
-        c = self.__parent__
-        if interfaces.IRegisterableContainer.providedBy(c):
-            return c.findModule(name)
-
-        # Use sys.modules in lieu of module service:
-        module = sys.modules.get(name)
-        if module is not None:
-            return module
-
-        raise ImportError(name)
-
-
-    def resolve(self, name):
-        l = name.rfind('.')
-        mod = self.findModule(name[:l])
-        return getattr(mod, name[l+1:])
-
-
-def componentRegistrationEventNotify(componentReg, event):
-    """Subscriber to dispatch registration events for components."""
-    adapters = subscribers((componentReg.component, event), None)
-    for adapter in adapters:
-        pass # getting them does the work
+deprecated(('ComponentRegistration', 'ComponentRegistrationAddSubscriber',
+            'ComponentRegistrationRemoveSubscriber',
+            'RegisterableMoveSubscriber', 'Registered',
+            'RegistrationManager', 'RegisterableContainer'),
+           'This class has moved to zope.app.component.registration. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/registration/registration.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.11
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/renderer/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/renderer/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -41,10 +41,11 @@
                     u"view on the source.",
         required=True)
 
+# XXX: Does not seem to be tested
 def renderer(_context, sourceType, for_, factory):
     _context.action(
         discriminator = ('view', sourceType, u'', for_, 'default'),
         callable = handler,
-        args = (zapi.servicenames.Adapter, 'register',
+        args = ('provideAdapter',
                 (sourceType,), for_, u'', factory, 'default')
         )

Modified: Zope3/trunk/src/zope/app/renderer/tests/test_vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/renderer/tests/test_vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/renderer/tests/test_vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,19 +11,19 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Tests for Global Wiki Source Type Service.
+"""Tests for Renderer Vocabulary.
 
 $Id$
 """
 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/trunk/src/zope/app/rotterdam/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rotterdam/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,7 @@
 """
 import unittest
 from xml.dom import minidom
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class TestNavTree(BrowserTestCase):
 
@@ -45,7 +45,7 @@
         #add a site manager This will break when site adding is fixed
         # see above for examples to fix by filling out a form
         # when further action is required to make a site
-        response = self.publish("/First/somesite/addServiceManager.html",
+        response = self.publish("/First/somesite/addSiteManager.html",
                                                 basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 302)
         # /First/FirstsFolder/@@singleBranchTree.xml 

Modified: Zope3/trunk/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rotterdam/tests/test_xmlnavigationviews.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/rotterdam/xmlobject.py
===================================================================
--- Zope3/trunk/src/zope/app/rotterdam/xmlobject.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/rotterdam/xmlobject.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Service manager interfaces
+"""Support classes for XML-based tree
 
 $Id$
 """
@@ -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
@@ -70,7 +70,7 @@
 
         keys = list(container.keys())
 
-        # include the service manager
+        # include the site manager
         keys.append('++etc++site')
 
         for name in keys:
@@ -123,7 +123,7 @@
             else:
                 keys = []
 
-            # include the service manager
+            # include the site manager
             keys.append('++etc++site')
 
             for name in keys:
@@ -170,9 +170,8 @@
         parent = getParent(self.context)
         while parent is not None:
                 if IReadContainer.providedBy(parent):
-                    view = zapi.queryView(parent,
-                                          'singleBranchTree.xml',
-                                          self.request)
+                    view = zapi.queryMultiAdapter(
+                        (parent, self.request), name='singleBranchTree.xml')
                     return view()
                 else:
                     parent = getParent(parent)

Modified: Zope3/trunk/src/zope/app/schema/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schema/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,18 +25,6 @@
 
   </view>
 
-  <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"
-      permission="zope.ManageServices"
-      content_factory="zope.app.schema.schema.SchemaRegistration"
-      arguments="name interface componentPath"
-      set_after_add="status"
-      fields="name interface componentPath permission status" />
-
   <addMenuItem
       title="Mutable Schema"
       description="A Persistent Schema that can be edited through the web"
@@ -44,7 +32,6 @@
       permission="zope.ManageServices"
     />
 
-
   <defaultView
       for="zope.app.schema.interfaces.IMutableSchema"
       name="editschema.html" />

Modified: Zope3/trunk/src/zope/app/schema/browser/traversal.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/browser/traversal.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/browser/traversal.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -14,16 +14,14 @@
 $Id$
 """
 from zope.interface import implements
-from zope.component import getDefaultViewName, queryView
 from zope.publisher.interfaces.browser import IBrowserPublisher
-from zope.app.schema.interfaces import IMutableSchema
-
-from zope.app.traversing.interfaces import TraversalError
 from zope.publisher.interfaces import NotFound
 
-from zope.app.traversing.interfaces import ITraversable
-from zope.app.traversing.namespace import UnexpectedParameters
+from zope.app import zapi
 from zope.app.location.interfaces import ILocation
+from zope.app.schema.interfaces import IMutableSchema
+from zope.app.traversing.interfaces import TraversalError, ITraversable
+from zope.app.traversing.namespace import UnexpectedParameters
 
 _marker = object()
 
@@ -40,7 +38,7 @@
 
         if subob is None:
 
-            view = queryView(self.context, name, request)
+            view = zapi.queryMultiAdapter((self.context, request), name=name)
             if view is not None:
                 if ILocation.providedBy(view):
                     view.__parent__ = self.context
@@ -54,7 +52,7 @@
 
     def browserDefault(self, request):
         c = self.context
-        view_name = getDefaultViewName(c, request)
+        view_name = zapi.getDefaultViewName(c, request)
         view_uri = "@@%s" % view_name
         return c, (view_uri,)
 

Modified: Zope3/trunk/src/zope/app/schema/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schema/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/fields.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schema/fields.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/fields.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,7 +23,7 @@
 
     <allow attributes="__name__" />
 
-    <!-- XXX put the whole interface under one permission for now -->
+    <!-- TODO: put the whole interface under one permission for now -->
 
     <require
 	permission="zope.ManageContent"

Modified: Zope3/trunk/src/zope/app/schema/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,7 +22,7 @@
 class IVocabularyDirective(Interface):
     '''Define a named vocabulary.
 
-    This associates a vocabulary name in the global vocabulary service with a
+    This associates a vocabulary name in the global vocabulary registry with a
     factory.  Each name may only be defined once.
 
     Additional keyword arguments may be passed to the factory by adding

Modified: Zope3/trunk/src/zope/app/schema/schema.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/schema.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/schema.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -266,8 +266,7 @@
 
     def nextURL(self):
         """See zope.app.container.interfaces.IAdding"""
-        return (str(zapi.getView(self.context, "absolute_url", self.request))
-                + '/@@editschema.html')
+        return zapi.absoluteURL(self.context, self.request)+'/@@editschema.html'
 
 
 class SchemaRegistration(UtilityRegistration):

Modified: Zope3/trunk/src/zope/app/schema/tests/fields.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/fields.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/fields.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/tests/test_field.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_field.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_field.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/tests/test_fieldfactory.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/tests/test_fieldfactory.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_fieldfactory.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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">
@@ -26,7 +25,7 @@
 	/>
     -->
 
-    <!-- XXX put the whole interface under one permission for now -->
+    <!-- TODO: put the whole interface under one permission for now -->
     <require
 	permission="zope.ManageContent"
 	interface="zope.schema.interfaces.IField"

Modified: Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_interfaceutility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,33 +11,28 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Utility service tests
+"""Interfaces as Utilities tests
 
 $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/trunk/src/zope/app/schema/tests/test_schemautility.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_schemautility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_schemautility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/tests/test_schemautilitypersistence.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_schemautilitypersistence.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/tests/test_schemautilitypersistence.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schema/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schema/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -42,12 +42,12 @@
         return factory(context)
 
 def _clear():
-    """Re-initialize the vocabulary service."""
+    """Re-initialize the vocabulary registry."""
     # This should normally only be needed by the testing framework,
     # but is also used for module initialization.
-    global vocabularyService
+    global vocabularyRegistry
     vocabulary._clear()
-    vocabularyService = vocabulary.getVocabularyRegistry()
+    vocabularyRegistry = vocabulary.getVocabularyRegistry()
     vocabulary._clear()
     vocabulary.setVocabularyRegistry(ZopeVocabularyRegistry())
 

Modified: Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/browser/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,7 +23,6 @@
 from zope.app.form.utility import setUpWidget
 from zope.app.form.interfaces import IInputWidget
 from zope.app.schemacontent.interfaces import IContentComponentDefinition
-from zope.app.servicenames import Utilities
 from zope.app.schemacontent.content import ContentComponentInstance
 from zope.component.exceptions import ComponentLookupError
 from zope.interface import implements
@@ -141,9 +140,8 @@
             type_name, content_name = name.split("=", 1)
             self.context.contentName = content_name
 
-        utilities = zapi.getService(Utilities)
         matching = [util
-                    for name, util in utilities.getUtilitiesFor(
+                    for name, util in zapi.getUtilitiesFor(
                                                   IContentComponentDefinition)
                     if name == type_name]
             

Modified: Zope3/trunk/src/zope/app/schemacontent/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,20 +11,6 @@
 
 <!-- Content Component Definition -->
 
-  <addform
-      label="Content Component Definition Registration"
-      for= "zope.app.schemacontent.interfaces.IContentComponentDefinition"
-      name="addRegistration.html"
-      schema="zope.app.utility.interfaces.IUtilityRegistration"
-      class="zope.app.utility.browser.AddRegistration"
-      permission="zope.ManageServices"
-      content_factory="
-          zope.app.schemacontent.content.ContentComponentDefinitionRegistration"
-      arguments="name interface componentPath"
-      set_after_add="status"
-      fields="name interface componentPath permission status" />
-
-
   <!-- Menu entry for "add component" menu -->
   <menuItem
       for="zope.app.container.interfaces.IAdding"

Modified: Zope3/trunk/src/zope/app/schemacontent/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,8 @@
   <content class=".content.ContentComponentDefinitionRegistration">
     <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>
 

Modified: Zope3/trunk/src/zope/app/schemacontent/content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/content.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/content.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/schemacontent/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -49,10 +49,10 @@
 
     create = Bool(
         title=_("Create Menu"),
-        description=_("If set to True, the system will create a local Browser "
-                      "Menu Service and local Browser Menu for you. If this "
+        description=_("If set to True, the system will create a local Browser"
+                      "local browser menu item for you. If this "
                       "option is set to False, the system will try to find "
-                      "the next local browser menu service that has a menu "
+                      "the next site manager that has a menu "
                       "with the specifed id. If no menu was found or the menu "
                       "is a global menu, then an error is created."),
         default=True,

Modified: Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py
===================================================================
--- Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/schemacontent/tests/test_content.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/security/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -2,6 +2,7 @@
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser">
 
+
   <adapter
       for="zope.app.security.interfaces.IAuthentication
            zope.publisher.interfaces.browser.IBrowserRequest"
@@ -16,6 +17,13 @@
       factory="zope.app.security.browser.principalterms.PrincipalTerms"
       />
 
+  <browser:tool
+      interface="..interfaces.IAuthenticationUtility"
+      title="Authentication"
+      description="Authenticates Principals."
+      unique="true"
+      />
+
   <browser:page
       name="login.html"
       for="*"

Modified: Zope3/trunk/src/zope/app/security/browser/principalterms.txt
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/principalterms.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/browser/principalterms.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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(IAuthentication, AuthUtility())
 
 We need a principal source so that we can create a view from it.

Modified: Zope3/trunk/src/zope/app/security/browser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/browser/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/security/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -41,13 +41,13 @@
 
   <subscriber
      for="zope.security.interfaces.IPermission
-          ..registration.interfaces.IRegistrationActivatedEvent"
+          ..component.interfaces.registration.IRegistrationActivatedEvent"
      handler=".permission.setIdOnActivation"
      />
 
   <subscriber
      for="zope.security.interfaces.IPermission
-          ..registration.interfaces.IRegistrationDeactivatedEvent"
+          ..component.interfaces.registration.IRegistrationDeactivatedEvent"
      handler=".permission.unsetIdOnDeactivation"
      />
 
@@ -98,6 +98,11 @@
       title="[manage-services-permission] Manage Services"
       />
 
+  <permission 
+      id="zope.ManageSite" 
+      title="[manage-site-permission] Manage Site" 
+      />
+
   <permission
       id="zope.ManagePrincipals"
       title="[manage-principal-permission] Manage Principals"

Modified: Zope3/trunk/src/zope/app/security/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/security/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -58,15 +58,15 @@
     issuing challenges or providing login interfaces.
 
     `IAuthentication` objects are used to implement authentication
-    utilities. Because they implement services, they are expected to
-    collaborate with services in other contexts. Client code doesn't search a
-    context and call multiple services. Instead, client code will call the
-    most specific service in a place and rely on the service to delegate to
-    other services as necessary.
+    utilities. Because they implement utilities, they are expected to
+    collaborate with utilities in other contexts. Client code doesn't search a
+    context and call multiple utilities. Instead, client code will call the
+    most specific utility in a place and rely on the utility to delegate to
+    other utilities as necessary.
 
-    The interface doesn't include methods for data management. Services may
+    The interface doesn't include methods for data management. Utilities may
     use external data and not allow management in Zope. Simularly, the data to
-    be managed may vary with different implementations of a service.
+    be managed may vary with different implementations of a utility.
     """
 
     def authenticate(request):
@@ -114,10 +114,10 @@
         as issuing an HTTP authentication challenge or
         displaying a login interface.
 
-        Note that the authentication service nearest to the
+        Note that the authentication utility nearest to the
         requested resource is called. It is up to
-        authentication service implementations to
-        collaborate with services higher in the object
+        authentication utility implementations to
+        collaborate with utilities higher in the object
         hierarchy.
 
         If no principal has been identified, id will be
@@ -131,9 +131,9 @@
         id. A PrincipalLookupError is raised if the principal cannot be
         found.
 
-        Note that the authentication service nearest to the requested
-        resource is called. It is up to authentication service
-        implementations to collaborate with services higher in the
+        Note that the authentication utility nearest to the requested
+        resource is called. It is up to authentication utility
+        implementations to collaborate with utilities higher in the
         object hierarchy.
         """
 

Modified: Zope3/trunk/src/zope/app/security/permission.py
===================================================================
--- Zope3/trunk/src/zope/app/security/permission.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/permission.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -58,8 +58,8 @@
     >>> perm1 = LocalPermission('Permission 1', 'A first permission')
     >>> perm1.id
     u'<permission not activated>'
-
-    >>> from zope.app.registration import registration
+    
+    >>> from zope.app.component import registration 
     >>> event = registration.RegistrationActivatedEvent(
     ...     Registration(perm1, 'perm1'))
 
@@ -87,7 +87,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'))
 
@@ -104,10 +104,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')
@@ -126,10 +126,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/trunk/src/zope/app/security/tests/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,6 @@
 def addCheckerPublic():
     """Add the CheckerPublic permission as 'zope.Public'"""
 
-    utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
-
     perm = Permission('zope.Public', 'Public',
             """Special permission used for resources that are always public
 
@@ -31,4 +29,5 @@
             it allows security computation to be bypassed.
             """
             )
-    utilityService.provideUtility(IPermission, perm, perm.id)
+    gsm = zapi.getGlobalSiteManager()
+    gsm.provideUtility(IPermission, perm, perm.id)

Modified: Zope3/trunk/src/zope/app/security/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,12 +23,11 @@
 
 import zope.app.security
 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/trunk/src/zope/app/security/tests/test_principalregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/test_principalregistry.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/security/tests/test_protectclass.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_protectclass.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/test_protectclass.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/security/tests/test_protectsubclass.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/test_protectsubclass.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/security/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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 IAuthentication, IPermission

Modified: Zope3/trunk/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/security/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/security/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -24,7 +24,7 @@
 from zope.schema.interfaces import ISourceQueriables
 from zope.app.security.interfaces import IPermission, IAuthentication
 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')
@@ -119,7 +119,7 @@
         principal. Whether the utility consults other utilities to give an
         answer is up to the utility itself.
 
-        First we need to create a dummy service that will return a user, if
+        First we need to create a dummy utility that will return a user, if
         the id is 'bob'.
         
         >>> class DummyUtility:
@@ -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, IAuthentication)
         >>> testingNextUtility(dummy2, dummy3, IAuthentication)
         

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -57,7 +57,7 @@
   <!-- The role-permission mapping is really the domain of programmers -->
 
   <pages
-      for="zope.app.site.interfaces.ISiteManager"
+      for="zope.app.component.interfaces.ILocalSiteManager"
       permission="zope.Security"
       class=".rolepermissionview.RolePermissionView">
     <page

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,9 +16,9 @@
 $Id$
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing import functional
 
-class RolePermissionsTest(BrowserTestCase):
+class RolePermissionsTest(functional.BrowserTestCase):
 
     def testAllRolePermissionsForm(self):
         response = self.publish(
@@ -28,7 +28,7 @@
         body = response.getBody()
         self.assert_('Permissions' in body)
         self.assert_('Manage Content' in body)
-        self.assert_('Manage Services' in body)
+        self.assert_('Manage Site' in body)
         self.assert_('Roles' in body)
         self.assert_('Site Manager' in body)
         self.assert_('Site Member' in body)
@@ -85,10 +85,9 @@
 '''
 
 def test_suite():
-    import zope.app.tests.functional
     return unittest.TestSuite((
         unittest.makeSuite(RolePermissionsTest),
-        zope.app.tests.functional.FunctionalDocFileSuite('granting_ftest.txt'),
+        functional.FunctionalDocFileSuite('granting_ftest.txt'),
         ))
 
 if __name__ == '__main__':

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/granting.pt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/granting.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/granting.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -4,7 +4,9 @@
   <h2 i18n:translate="">Granting Roles and Permissions to Principals</h2>
   <p tal:define="status view/status"
      tal:condition="status"
-     tal:content="status" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+     tal:content="status" />
+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
   <form action="" method="POST">
 
@@ -34,7 +36,9 @@
                            tal:content="widget/label">The Label</label>
                   </div>
                 </td>
-								<tal:block tal:content="structure widget">roles widget</tal:block>
+                <tal:block tal:content="structure widget">
+                  roles widget
+                </tal:block>
               </tr>
               <tr>
                 <td colspan="2"><a href="#top" i18n:translate="">^ top</a></td>
@@ -57,7 +61,9 @@
                            tal:content="widget/label">The Label</label>
                   </div>
                 </td>
-								<tal:block tal:content="structure widget">permission widget</tal:block>
+                <tal:block tal:content="structure widget">
+                  permission widget
+                </tal:block>
               </tr>
               <tr>
                 <td colspan="2"><a href="#top" i18n:translate="">^ top</a></td>

Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/browser/tests/test_granting.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_granting.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_granting.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -70,13 +70,13 @@
 
   <subscriber
      for=".interfaces.IRole
-          ..registration.interfaces.IRegistrationActivatedEvent"
+         ..component.interfaces.registration.IRegistrationActivatedEvent"
      handler=".role.setIdOnActivation"
      />
 
   <subscriber
      for=".interfaces.IRole
-          ..registration.interfaces.IRegistrationDeactivatedEvent"
+          ..component.interfaces.registration.IRegistrationDeactivatedEvent"
      handler=".role.unsetIdOnDeactivation"
      />
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/role.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/role.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/role.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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(role, 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'))
 
@@ -89,7 +89,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/trunk/src/zope/app/securitypolicy/tests/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/functional.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/functional.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 
 from zope import interface
-from zope.app.tests import functional
+from zope.app.testing import functional
 
 class ManagerSetup:
     interface.implements(functional.IManagerSetup)

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalpermissionmanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationprincipalrolemanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_annotationrolepermissionmanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,14 +18,13 @@
 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 IAuthentication
 from zope.app.security.permission import Permission
 
-from zope.app.servicenames import Authentication
 from zope.app.security.settings import Allow, Deny, Unset
 from zope.app.security.principalregistry import principalRegistry
 

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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 IAuthentication
 from zope.app.security.settings import Allow, Deny

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_rolepermissionmanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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 IAuthentication

Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_zopepolicy.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/securitypolicy/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -31,7 +31,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()
@@ -41,7 +41,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/trunk/src/zope/app/securitypolicy/zopepolicy.txt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -505,7 +505,7 @@
 
   >>> auth = FauxPrincipals()
 
-  >>> from zope.app.tests import ztapi
+  >>> from zope.app.testing import ztapi
   >>> ztapi.provideUtility(IAuthentication, auth)
   >>> from zope.app import zapi
 

Modified: Zope3/trunk/src/zope/app/session/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/session/bootstrap.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/bootstrap.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,7 @@
 
 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.
+essential utilities.
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/session/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/session/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id: tests.py 26427 2004-07-12 16:05:02Z Zen $
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.zptpage.zptpage import ZPTPage
 
 class ZPTSessionTest(BrowserTestCase):

Modified: Zope3/trunk/src/zope/app/session/http.py
===================================================================
--- Zope3/trunk/src/zope/app/session/http.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/http.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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
@@ -71,7 +71,7 @@
             )
 
 class CookieClientIdManager(Persistent):
-    """Session service implemented using cookies."""
+    """Session utility implemented using cookies."""
 
     implements(IClientIdManager, ICookieClientIdManager,
                ILocalUtility, IAttributeAnnotatable,
@@ -254,10 +254,10 @@
         # TODO: Currently, the path is the ApplicationURL. This is reasonable,
         #     and will be adequate for most purposes.
         #     A better path to use would be that of the folder that contains
-        #     the service-manager this service is registered within. However,
+        #     the site manager this service is registered within. However,
         #     that would be expensive to look up on each request, and would
         #     have to be altered to take virtual hosting into account.
-        #     Seeing as this service instance has a unique namespace for its
+        #     Seeing as this utility instance has a unique namespace for its
         #     cookie, using ApplicationURL shouldn't be a problem.
 
         if self.cookieLifetime is not None:

Modified: Zope3/trunk/src/zope/app/session/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/session/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Interfaces for session service.
+"""Interfaces for session utility.
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/session/session.py
===================================================================
--- Zope3/trunk/src/zope/app/session/session.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/session.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/session/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/session/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/session/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 import unittest, doctest, os, os.path, sys
 from zope.app import zapi
-from zope.app.tests import ztapi, placelesssetup
+from zope.app.testing import ztapi, placelesssetup
 
 from zope.app.session.interfaces import IClientId, IClientIdManager, ISession
 from zope.app.session.interfaces import ISessionDataContainer
@@ -97,5 +97,3 @@
 
 if __name__ == '__main__':
     unittest.main()
-
-# vim: set filetype=python ts=4 sw=4 et si

Deleted: Zope3/trunk/src/zope/app/site/PACKAGE.cfg
===================================================================
--- Zope3/trunk/src/zope/app/site/PACKAGE.cfg	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/PACKAGE.cfg	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,5 +0,0 @@
-# The fssync sub-package is a separate component.
-
-<collection>
-  fssync -
-</collection>

Modified: Zope3/trunk/src/zope/app/site/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/site/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +1 @@
-# Import this.
+# Import this


Property changes on: Zope3/trunk/src/zope/app/site/__init__.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/site/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/site/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,84 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
-
-  <module module=".interfaces">
-    <allow attributes="ISite" />
-  </module>
-
-  <subscriber
-     for=".interfaces.IBindingAware
-          ..registration.interfaces.IRegistrationActivatedEvent"
-     handler=".service.bindOnActivated"
-     />
-
-  <subscriber
-     for=".interfaces.IBindingAware
-          ..registration.interfaces.IRegistrationDeactivatedEvent"
-     handler=".service.unbindOnDeactivated"
-     />
-
-  <!-- Service Manager -->
-
-  <content class=".service.SiteManager">
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IReadContainer" />
-    <require
-        permission="zope.ManageServices"
-        interface=".interfaces.ISiteManager
-                   zope.app.container.interfaces.IWriteContainer" />
-    <implements
-        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
-    </content>
-
-  <content class=".service.ServiceRegistration">
-    <require
-        permission="zope.ManageServices"
-        interface=".interfaces.IServiceRegistration"
-        set_attributes="serviceType componentPath permission"
-        set_schema="zope.app.registration.interfaces.IRegistration"
-        />
-
-  </content>
-
-  <!-- SiteManagementFolders -->
-
-  <content class=".folder.SiteManagementFolders">
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IReadContainer" />
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IWriteContainer" />
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.site.interfaces.IComponentManager" />
-    <implements
-        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
-
-    </content>
-
-  <content class=".folder.SiteManagementFolder">
-    <factory />
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IReadContainer" />
-    <require
-        permission="zope.ManageServices"
-        interface="zope.app.container.interfaces.IWriteContainer"
-        attributes="getRegistrationManager resolve"
-        />
-    <implements
-        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
-
-    </content>
-
-  <adapter
-      for="zope.app.site.interfaces.ISiteManager"
-      provides="zope.app.filerepresentation.interfaces.IDirectoryFactory"
-      factory=".folder.SMFolderFactory"
-      permission="zope.ManageContent"
-      />
-
-</configure>

Modified: Zope3/trunk/src/zope/app/site/folder.py
===================================================================
--- Zope3/trunk/src/zope/app/site/folder.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/folder.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,35 +13,22 @@
 ##############################################################################
 """A site management folder contains components and component registrations.
 
-$Id$
+$Id: folder.py 25177 2004-06-02 13:17:31Z jim $
 """
-from zope.interface import implements
+from zope.deprecation import deprecated
 from zope.app.container.btree import BTreeContainer
-from zope.app.filerepresentation.interfaces import IDirectoryFactory
-from zope.app.registration.registration import RegisterableContainer
-from zope.app.traversing.api import getPath
-from zope.app.container.contained import setitem
 
-from zope.app.site.interfaces import ISiteManagementFolders
-from zope.app.site.interfaces import ISiteManagementFolder
-from zope.app.site.interfaces import IComponentManager
+from zope.app.component.site import SiteManagementFolder
+from zope.app.component.site import SMFolderFactory
 
-class SiteManagementFolder(RegisterableContainer, BTreeContainer):
-    implements(ISiteManagementFolder)
+deprecated(('SiteManagementFolder', 'SMFolderFactory'),
+           'This class has moved to zope.app.component.site. '
+           'The reference will be gone in X3.3.')
 
-class SMFolderFactory(object):
-    implements(IDirectoryFactory)
-
-    def __init__(self, context):
-        self.context = context
-
-    def __call__(self, name):
-        return SiteManagementFolder()
-
+# I really hope that noone is using this.
 class SiteManagementFolders(BTreeContainer):
-    pass 
+    pass
 
-import sys
-
-sys.modules['zope.app.services.package'
-            ] = sys.modules['zope.app.site.folder']
+deprecated('SiteManagementFolders',
+           'This class has been deprecated. It was not used anyways. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/site/folder.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.5
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/site/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/site/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,18 +13,29 @@
 ##############################################################################
 """Interfaces for folders.
 
-$Id$
+$Id: interfaces.py 27514 2004-09-13 15:54:05Z fdrake $
 """
-from zope.interface import Interface, Attribute
 import zope.schema
-from zope.component.interfaces import IServiceService
+from zope.deprecation import deprecated
+from zope.interface import Interface
+
+from zope.app.component.interfaces import registration
 from zope.app.container.interfaces import IContainer
-from zope.app.container.constraints import ContainerTypesConstraint
-from zope.app.container.constraints import ItemTypePrecondition
-from zope.app.registration import interfaces as registration
-from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.component.interfaces import IPossibleSite, ISite
+from zope.app.component.interfaces import ILocalSiteManager
+from zope.app.component.interfaces import ISiteManagementFolder
 
+deprecated(('IPossibleSite', 'ISite'),
+           'This interface has been moved to zope.app.component.interfaces. '
+           'The reference will be gone in X3.3.')
 
+ISiteManager = ILocalSiteManager
+
+deprecated('ISiteManager',
+           'This interface has been moved to zope.app.component.interfaces '
+           'and been renamed ISiteManager. '
+           'The reference will be gone in X3.3.')
+
 class ILocalService(registration.IRegisterable):
     """A local service isn't a local service if it doesn't implement this.
 
@@ -34,14 +45,17 @@
     IRegistered).  Implementing ILocalService implies this.
     """
 
-
-class ISimpleService(ILocalService, registration.IAttributeRegisterable):
+class ISimpleService(ILocalService):
     """Most local services should implement this instead of ILocalService.
 
     It implies a specific way of implementing IRegisterable,
     by subclassing IAttributeRegisterable.
     """
 
+deprecated(('ILocalService', 'ISimpleService'),
+           'The concept of services has been removed. Use utilities instead. '
+           'The reference will be gone in X3.3.')
+
 class IComponentManager(Interface):
 
     def queryComponent(type=None, filter=None, all=0):
@@ -58,25 +72,10 @@
 
         """
 
+deprecated('IComponentManager',
+           'This interface has been removed. It was horrible anyways. '
+           'The reference will be gone in X3.3.')
 
-class IPossibleSite(Interface):
-    """An object that could be a site
-    """
-
-    def setSiteManager(sm):
-        """Sets the service manager for this object.
-        """
-
-    def getSiteManager():
-        """Returns the service manager contained in this object.
-
-        If there isn't a service manager, raise a component lookup.
-        """
-
-class ISite(IPossibleSite):
-    """Marker interface to indicate that we have a site
-    """
-
 class IBindingAware(Interface):
 
     def bound(name):
@@ -93,59 +92,10 @@
         this object from performing the named service.
         """
 
+deprecated('IBindingAware',
+           'Now that services are gone, we do not need the binding support. '
+           'The reference will be gone in X3.3.')
 
-class ISiteManager(IServiceService, IComponentManager,
-                   registration.IRegistry):
-    """Service Managers act as containers for Services.
-
-    If a Service Manager is asked for a service, it checks for those it
-    contains before using a context-based lookup to find another service
-    manager to delegate to.  If no other service manager is found they defer
-    to the ComponentArchitecture ServiceManager which contains file based
-    services.
-    """
-
-    def queryRegistrations(name, default=None):
-        """Return an IRegistrationRegistry for the registration name.
-
-        queryRegistrationsFor(cfg, default) is equivalent to
-        queryRegistrations(cfg.name, default)
-        """
-
-    def createRegistrationsFor(registration):
-        """Create and return an IRegistrationRegistry for the registration
-        name.
-
-        createRegistrationsFor(cfg, default) is equivalent to
-        createRegistrations(cfg.name, default)
-        """
-
-    def listRegistrationNames():
-        """Return a list of all registered registration names.
-        """
-
-    def queryActiveComponent(name, default=None):
-        """Finds the registration registry for a given name, checks if it has
-        an active registration, and if so, returns its component.  Otherwise
-        returns default.
-        """
-
-    def queryLocalService(service_type, default=None):
-        """Return a local service, if there is one
-
-        A local service is one configured in the local service manager.
-        """
-
-    def addSubsite(subsite):
-        """Add a subsite of the site
-
-        Local sites are connected in a tree. Each site knows about
-        its containing sites and its subsites.
-        """
-
-    next = Attribute('The site that this site is a subsite of.')
-
-
 class IServiceRegistration(registration.IComponentRegistration):
     """Service Registration
 
@@ -157,28 +107,18 @@
     """
 
     name = zope.schema.TextLine(
-        title=_("Name"),
-        description=_("The name that is registered"),
+        title=u"Name",
+        description=u"The name that is registered",
         readonly=True,
         # Don't allow empty or missing name:
         required=True,
         min_length=1,
         )
 
+deprecated('IServiceRegistration',
+           'The concept of services has been removed. Use utilities instead. '
+           'The reference will be gone in X3.3.')
 
-class ISiteManagementFolder(
-    registration.IRegisterableContainer,
-    IContainer,
-    ):
-    """Component and component registration containers."""
-
-    __parent__ = zope.schema.Field(
-        constraint = ContainerTypesConstraint(
-            ISiteManager,
-            registration.IRegisterableContainer,
-            ),
-        )
-
 class ISiteManagementFolders(IContainer, IComponentManager):
     """A collection of ISiteManagementFolder objects.
 
@@ -186,3 +126,7 @@
     well as package query and lookup.
     
     """
+
+deprecated('ISiteManagementFolders',
+           'This interface has been removed. It was unused. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/site/interfaces.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.3
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/site/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/site/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,15 +16,22 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
+import zope.deprecation
 from zope.interface import classImplements
 from zope.app.component.contentdirective import ContentDirective
 
-from interfaces import ISimpleService
+zope.deprecation.__show__.off()
+from zope.app.site.interfaces import ISimpleService
+zope.deprecation.__show__.on()
 
-
 class LocalServiceDirective(ContentDirective):
 
     def __init__(self, _context, class_):
         if not ISimpleService.implementedBy(class_):
             classImplements(class_, ISimpleService)
         super(LocalServiceDirective, self).__init__(_context, class_)
+
+zope.deprecation.deprecated(
+    'LocalServiceDirective',
+    'The concept of services has been removed. Use utilities instead. '
+    'The reference will be gone in X3.3.')

Modified: Zope3/trunk/src/zope/app/site/service.py
===================================================================
--- Zope3/trunk/src/zope/app/site/service.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/service.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,301 +11,40 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Service manager implementation
+"""Service Manager code
 
-A service manager has a number of roles:
-
-  - A service service
-
-  - A place to do TTW development or to manage database-based code
-
-  - A registry for persistent modules.  The Zope import hook uses the
-    ServiceManager to search for modules.  (This functionality will
-    eventually be replaced by a separate module service.)
-
-$Id$
+$Id: service.py 29078 2005-02-07 22:50:03Z garrett $
 """
-import sys
-from transaction import get_transaction
-from zodbcode.module import PersistentModuleRegistry
-
-import zope.event
+__docformat__ = "reStructuredText"
 import zope.interface
-from zope.component.exceptions import ComponentLookupError
+import zope.deprecation
 
-import zope.app.registration.interfaces
-from zope.app import zapi
-from zope.app.component.localservice import getNextService
-from zope.app.component.localservice import getNextServices
-from zope.app.container.btree import BTreeContainer
-from zope.app.container.constraints import ItemTypePrecondition
-from zope.app.container.contained import Contained
-from zope.app.container.interfaces import IContainer
-from zope.app.event import objectevent
-from zope.app.registration.interfaces import IRegistry
-from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.traversing.api import getPath
-from zope.app.location import inside
-from zope.app.site.folder import SiteManagementFolder
-from zope.app.registration.registration import ComponentRegistration
-from zope.app.registration.registration import RegistrationStack
+from zope.app.component.site import LocalSiteManager, UtilityRegistration
+from zope.app.component.interfaces.registration import \
+     IRegisterableContainerContaining as IRegisterableContainerContainer
 
-from zope.app.site.interfaces import IBindingAware, ILocalService
-from zope.app.site.interfaces import IPossibleSite, ISite, ISiteManager
-from zope.app.site.interfaces import IServiceRegistration
+zope.deprecation.__show__.off()
+from interfaces import IServiceRegistration
+zope.deprecation.__show__.on()
 
-class IRegisterableContainerContainer(zope.interface.Interface):
+zope.deprecation.deprecated(
+    ('SiteManager', 'UtilityRegistration'),
+    'This class has been moved to zope.app.component.site. '
+    'The reference will be gone in X3.3.')
 
-    def __setitem__(name, folder):
-        """Add a site-management folder
-        """
-    __setitem__.precondition = ItemTypePrecondition(
-       zope.app.registration.interfaces.IRegisterableContainer)
+zope.deprecation.deprecated(
+    'IRegisterableContainerContainer',
+    'This interface has been moved to zope.app.component.interfaces '
+    'and been renamed to IRegisterableContainerContaining. '
+    'The reference will be gone in X3.3.')
 
+ServiceManager = LocalSiteManager
+SiteManager = LocalSiteManager
 
-class SiteManager(BTreeContainer, PersistentModuleRegistry):
-
-    zope.interface.implements(ISiteManager,
-                              IRegisterableContainerContainer,
-                              IRegistry)
-
-    def __init__(self, site):
-        self._bindings = {}
-        self.__parent__ = site
-        self.__name__ = '++etc++site'
-        BTreeContainer.__init__(self)
-        PersistentModuleRegistry.__init__(self)
-        self.subSites = ()
-        self._setNext(site)
-        folder = SiteManagementFolder()
-        zope.event.notify(objectevent.ObjectCreatedEvent(folder))
-        self['default'] = folder
-
-    def _setNext(self, site):
-        """Find set the next service manager
-        """
-        while True:
-            if IContainmentRoot.providedBy(site):
-                # we're the root site, use the global sm
-                self.next = zapi.getGlobalServices()
-                return
-            site = site.__parent__
-            if site is None:
-                raise TypeError("Not enough context information")
-            if ISite.providedBy(site):
-                self.next = site.getSiteManager()
-                self.next.addSubsite(self)
-                return
-
-    def addSubsite(self, sub):
-        """See ISiteManager interface
-        """
-        subsite = sub.__parent__
-
-        # Update any sites that are now in the subsite:
-        subsites = []
-        for s in self.subSites:
-            if inside(s, subsite):
-                s.next = sub
-                sub.addSubsite(s)
-            else:
-                subsites.append(s)
-
-        subsites.append(sub)
-        self.subSites = tuple(subsites)
-
-    def queryRegistrationsFor(self, cfg, default=None):
-        """See IRegistry"""
-        return self.queryRegistrations(cfg.name, default)
-
-    def queryRegistrations(self, name, default=None):
-        """See INameRegistry"""
-        return self._bindings.get(name, default)
-
-    def createRegistrationsFor(self, cfg):
-        """See IRegistry"""
-        return self.createRegistrations(cfg.name)
-
-    def createRegistrations(self, name):
-        try:
-            registry = self._bindings[name]
-        except KeyError:
-            registry = RegistrationStack(self)
-            self._bindings[name] = registry
-            self._p_changed = 1
-        return registry
-
-    def listRegistrationNames(self):
-        return filter(self._bindings.get,
-                      self._bindings.keys())
-
-    def queryActiveComponent(self, name, default=None):
-        registry = self.queryRegistrations(name)
-        if registry:
-            registration = registry.active()
-            if registration is not None:
-                return registration.component
-        return default
-
-    def getServiceDefinitions(self):
-        """See IServiceService
-        """
-        # Get the services defined here and above us, if any (as held
-        # in a ServiceInterfaceService, presumably)
-        sm = self.next
-        if sm is not None:
-            serviceDefs = sm.getServiceDefinitions()
-        else:
-            serviceDefs = {}
-
-        return serviceDefs
-
-    def getService(self, name):
-        """See IServiceService
-        """
-
-        # This is rather tricky. Normally, getting a service requires
-        # the use of other services, like the adapter service.  We
-        # need to be careful not to get into an infinite recursion by
-        # getting out getService to be called while looking up
-        # services, so we'll use _v_calling to prevent recursive
-        # getService calls.
-
-        if name == 'Services':
-            return self # We are the service service
-
-        if not getattr(self, '_v_calling', False):
-
-            self._v_calling = True
-            try:
-                service = self.queryActiveComponent(name)
-                if service is not None:
-                    return service
-            finally:
-                self._v_calling = False
-
-        return getNextService(self, name)
-
-    def queryLocalService(self, name, default=None):
-        """See ISiteManager
-        """
-
-        # This is rather tricky. Normally, getting a service requires
-        # the use of other services, like the adapter service.  We
-        # need to be careful not to get into an infinate recursion by
-        # getting our getService to be called while looking up
-        # services, so we'll use _v_calling to prevent recursive
-        # getService calls.
-
-        if name == 'Services':
-            return self # We are the service service
-
-        if not getattr(self, '_v_calling', False):
-
-            self._v_calling = True
-            try:
-                service = self.queryActiveComponent(name)
-                if service is not None:
-                    return service
-            finally:
-                self._v_calling = False
-
-        return default
-
-    def getInterfaceFor(self, service_type):
-        """See IServiceService
-        """
-        for type, interface in self.getServiceDefinitions():
-            if type == service_type:
-                return interface
-
-        raise NameError(service_type)
-
-    def queryComponent(self, type=None, filter=None, all=0):
-        local = []
-        path = getPath(self)
-        for pkg_name in self:
-            package = self[pkg_name]
-            for name in package:
-                component = package[name]
-                if type is not None and not type.providedBy(component):
-                    continue
-                if filter is not None and not filter(component):
-                    continue
-                local.append({'path': "%s/%s/%s" % (path, pkg_name, name),
-                              'component': component,
-                              })
-
-        if all:
-            next_service_manager = self.next
-            if IComponentManager.providedBy(next_service_manager):
-                next_service_manager.queryComponent(type, filter, all)
-
-            local += list(all)
-
-        return local
-
-    def findModule(self, name):
-        # override to pass call up to next service manager
-        mod = super(ServiceManager, self).findModule(name)
-        if mod is not None:
-            return mod
-
-        sm = self.next
-        try:
-            findModule = sm.findModule
-        except AttributeError:
-            # The only service manager that doesn't implement this
-            # interface is the global service manager.  There is no
-            # direct way to ask if sm is the global service manager.
-            return None
-        return findModule(name)
-
-    def __import(self, module_name):
-        mod = self.findModule(module_name)
-        if mod is None:
-            mod = sys.modules.get(module_name)
-            if mod is None:
-                raise ImportError(module_name)
-
-        return mod
-
-ServiceManager = SiteManager # Backward compat
-
-class ServiceRegistration(ComponentRegistration):
-    """Registrations for named components.
-
-    This configures components that live in folders, by name.
-    """
-
-    serviceType = zapi.servicenames.Services
-
+class ServiceRegistration(UtilityRegistration):
     zope.interface.implements(IServiceRegistration)
 
-    def __init__(self, name, service, context=None):
-        super(ServiceRegistration, self).__init__(service, None)
-        self.name = name
-
-        if context is not None:
-            # Check that the object implements stuff we need
-            self.__parent__ = context
-            if not ILocalService.providedBy(service):
-                raise TypeError(
-                    "service %r doesn't implement ILocalService" %
-                    service)
-        # Else, this must be a hopeful test invocation
-
-    def getInterface(self):
-        service_manager = zapi.getServices(self)
-        return service_manager.getInterfaceFor(self.name)
-
-    def usageSummary(self):
-        return self.name + " Service"
-
-
-def bindOnActivated(bindingAwareService, event):
-    bindingAwareService.bound(event.object.name)
-
-def unbindOnDeactivated(bindingAwareService, event):
-    bindingAwareService.unbound(event.object.name)
-
+zope.deprecation.deprecated(
+    ('ServiceManager', 'ServiceRegistration'),
+    'The concept of services has been removed. Use utilities instead. '
+    'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/site/service.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.6
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/site/servicecontainer.py
===================================================================
--- Zope3/trunk/src/zope/app/site/servicecontainer.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/servicecontainer.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,47 +11,18 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""ServiceManagerContainer implementation.
+"""Service Manager Container
 
-$Id$
+$Id: servicecontainer.py 25177 2004-06-02 13:17:31Z jim $
 """
+__docformat__ = "reStructuredText"
+from zope.deprecation import deprecated
 
-import zope.interface
+from zope.app.component.site import SiteManagerContainer
 
-from transaction import get_transaction
-from zope.app.container.contained import Contained
-from zope.app.site.interfaces import IPossibleSite, ISite
-from zope.component.exceptions import ComponentLookupError
-from zope.component.interfaces import IServiceService
-from zope.interface import implements
+ServiceManagerContainer = SiteManagerContainer
 
-class ServiceManagerContainer(Contained):
-    """Implement access to the service manager (++etc++site).
-
-    This is a mix-in that implements the IPossibleSite
-    interface; for example, it is used by the Folder implementation.
-    """
-    zope.interface.implements(IPossibleSite)
-
-    __sm = None
-
-    def getSiteManager(self):
-        if self.__sm is not None:
-            return self.__sm
-        else:
-            raise ComponentLookupError('no site manager defined')
-
-    def setSiteManager(self, sm):
-        if ISite.providedBy(self):
-            raise TypeError("Already a site")
-
-        if IServiceService.providedBy(sm):
-            self.__sm = sm
-            sm.__name__ = '++etc++site'
-            sm.__parent__ = self
-        else:
-            raise ValueError('setSiteManager requires an IServiceService')
-
-        zope.interface.directlyProvides(
-            self, ISite,
-            zope.interface.directlyProvidedBy(self))
+deprecated('ServiceManagerContainer',
+           'This class has been moved to zope.app.component.site '
+           'and been renamed to SiteManagerContainer. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/site/servicecontainer.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.3
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/site/tests/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +1,6 @@
-# Import this.
+# BBB: Goes away in 3.3
+
+from zope.app.component.testing import PlacefulSetup
+
+def test_suite():
+    return None


Property changes on: Zope3/trunk/src/zope/app/site/tests/__init__.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/site/tests/placefulsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/placefulsetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/placefulsetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,81 +1 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Base Mix-in class for Placeful Setups 
-
-$Id$
-"""
-from zope.app import zapi
-from zope.app.tests import setup
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.folder import rootFolder
-
-class Place(object):
-
-    def __init__(self, path):
-        self.path = path
-
-    def __get__(self, inst, cls=None):
-        if inst is None:
-            return self
-
-        try:
-            # Use __dict__ directly to avoid infinite recursion
-            root = inst.__dict__['rootFolder']
-        except KeyError:
-            root = inst.rootFolder = setup.buildSampleFolderTree()
-
-        return zapi.traverse(root, self.path)
-
-class PlacefulSetup(PlacelessSetup):
-
-    # Places :)
-    rootFolder  = Place('')
-
-    folder1     = Place('folder1')
-    folder1_1   = Place('folder1/folder1_1')
-    folder1_1_1 = Place('folder1/folder1_1/folder1_1_1')
-    folder1_1_2 = Place('folder1/folder1_2/folder1_1_2')
-    folder1_2   = Place('folder1/folder1_2')
-    folder1_2_1 = Place('folder1/folder1_2/folder1_2_1')
-
-    folder2     = Place('folder2')
-    folder2_1   = Place('folder2/folder2_1')
-    folder2_1_1 = Place('folder2/folder2_1/folder2_1_1')
-
-
-    def setUp(self, folders=False, site=False):
-        setup.placefulSetUp()
-        if folders or site:
-            return self.buildFolders(site)
-
-    def tearDown(self):
-        setup.placefulTearDown()
-        # clean up folders and placeful service managers and services too?
-
-    def buildFolders(self, site=False):
-        self.rootFolder = setup.buildSampleFolderTree()
-        if site:
-            return self.makeSite()
-
-    def makeSite(self, path='/'):
-        folder = zapi.traverse(self.rootFolder, path)
-        return setup.createServiceManager(folder, True)
-
-    def createRootFolder(self):
-        self.rootFolder = rootFolder()
-
-    def createStandardServices(self):
-        '''Create a bunch of standard placeful services'''
-
-        setup.createStandardServices(self.rootFolder)
+from zope.app.component.testing import *


Property changes on: Zope3/trunk/src/zope/app/site/tests/placefulsetup.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.1
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/site/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_directives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/test_directives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,60 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Local Service Directive Tests
-
-$Id: tests.py 27873 2004-10-10 07:24:06Z srichter $
-"""
-import unittest
-from StringIO import StringIO
-
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-
-import zope.app.security
-import zope.app.site
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.site.interfaces import ISimpleService
-
-def configfile(s):
-    return StringIO("""<configure
-      xmlns='http://namespaces.zope.org/zope'
-      i18n_domain='zope'>
-      %s
-      </configure>
-      """ % s)
-
-class ServiceStub(object):
-    pass
-
-class TestLocalServiceDirective(PlacelessSetup, unittest.TestCase):
-
-    def setUp(self):
-        super(TestLocalServiceDirective, self).setUp()
-        XMLConfig('meta.zcml', zope.app.component)()
-        XMLConfig('meta.zcml', zope.app.site)()
-
-    def testDirective(self):
-        f = configfile('''
-        <localService
-            class="zope.app.site.tests.test_directives.ServiceStub">
-        </localService>
-        ''')
-        xmlconfig(f)
-        self.assert_(ISimpleService.implementedBy(ServiceStub))
-    
-
-def test_suite():
-    return unittest.makeSuite(TestLocalServiceDirective)
-
-if __name__ == '__main__':
-    unittest.main(default='test_suite')

Deleted: Zope3/trunk/src/zope/app/site/tests/test_folder.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_folder.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/test_folder.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,34 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Site-management folder tests
-
-$Id$
-"""
-import unittest
-from zope.app.registration.tests.test_registrationmanager \
-     import RegisterableContainerTests
-
-
-class TestSomething(RegisterableContainerTests, unittest.TestCase):
-    "Test registration manager access"
-        
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(TestSomething))
-    return suite
-
-
-if __name__ == '__main__':
-    unittest.main()

Deleted: Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/test_servicemanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,190 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Service Manager Tests
-
-$Id$
-"""
-from unittest import TestCase, TestLoader, TextTestRunner
-
-from zope.app import zapi
-from zope.app.tests import setup
-from zope.interface import Interface, implements
-from zope.app.site.service import ServiceManager, ServiceRegistration
-from zope.component import getService, getServices, getGlobalServices
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.app.traversing.api import traverse
-from zope.app.registration.interfaces import UnregisteredStatus
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.registration.interfaces import RegisteredStatus
-from zope.component.service import serviceManager
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-
-class ITestService(Interface):
-    pass
-
-class TestService(object):
-    implements(ITestService, IAttributeAnnotatable)
-
-class ServiceManagerTests(PlacefulSetup, TestCase):
-
-    def setUp(self):
-        PlacefulSetup.setUp(self, site=True)
-        serviceManager.defineService('test_service', ITestService)
-
-    def testGetService(self):
-        sm = traverse(self.rootFolder, '++etc++site')
-        default = traverse(sm, 'default')
-
-        ts = TestService()
-        default['test_service1'] = ts
-        registration = ServiceRegistration('test_service',
-                                           default['test_service1'])
-
-        rm = default.getRegistrationManager()
-        name = rm.addRegistration(registration)
-        traverse(rm, name).status = ActiveStatus
-
-        testOb = getService('test_service', self.rootFolder)
-        self.assertEqual(testOb.__parent__.__parent__.__parent__,
-                         self.rootFolder)
-        self.assertEqual(testOb, ts)
-        # used by one of the callers
-        return name
-
-    def test_queryLocalService(self):
-        sm = traverse(self.rootFolder, '++etc++site')
-
-        # Test no service case
-        self.assertEqual(sm.queryLocalService('test_service'), None)
-        self.assertEqual(sm.queryLocalService('test_service', 42), 42)
-
-        # Test Services special case
-        self.assertEqual(sm.queryLocalService('Services', 42), sm)
-
-        # Test found local
-        default = traverse(sm, 'default')
-        ts = TestService()
-        default['test_service1'] = ts
-        registration = ServiceRegistration('test_service',
-                                           default['test_service1'])
-        rm = default.getRegistrationManager()
-        name = rm.addRegistration(registration)
-        traverse(rm, name).status = ActiveStatus
-
-        testOb = sm.queryLocalService('test_service')
-        self.assertEqual(testOb.__parent__.__parent__.__parent__,
-                         self.rootFolder)
-        self.assertEqual(testOb, ts)
-
-
-    def test_get(self):
-        sm = traverse(self.rootFolder, '++etc++site')
-        default = sm.get('default')
-        self.assertEqual(default, sm['default'])
-        self.assertEqual(sm.get('spam'), None)
-
-    def testAddService(self):
-        sm = traverse(self.rootFolder, '++etc++site')
-        default = traverse(sm, 'default')
-
-        ts1 = TestService()
-        default['test_service1'] = ts1
-        registration = ServiceRegistration('test_service',
-                                           default['test_service1'])
-        rm = default.getRegistrationManager()
-        name = rm.addRegistration(registration)
-        traverse(rm, name).status = ActiveStatus
-
-        ts2 = TestService()
-        default['test_service2'] = ts2
-        registration = ServiceRegistration('test_service',
-                                           default['test_service2'])
-        name = rm.addRegistration(registration)
-        traverse(rm, name).status = RegisteredStatus
-
-        testOb = getService('test_service', self.rootFolder)
-        self.assertEqual(testOb, ts1)
-
-
-    def testUnbindService(self):
-
-        root_ts = TestService()
-        gsm = getGlobalServices()
-        gsm.provideService('test_service', root_ts)
-
-        name = self.testGetService() # set up localservice
-
-        sm = traverse(self.rootFolder, '++etc++site')
-        cm = traverse(sm, 'default').getRegistrationManager()
-        traverse(cm, name).status = UnregisteredStatus
-
-        self.assertEqual(getService('test_service', self.rootFolder), root_ts)
-
-    def testContextServiceLookup(self):
-        self.testGetService() # set up localservice
-        sm = getServices(self.rootFolder)
-        self.assertEqual(getService('test_service', self.folder1_1),
-                         sm['default']['test_service1'])
-
-    def testContextServiceLookupWithMultipleServiceManagers(self):
-        self.testGetService() # set up root localservice
-        sm = getServices(self.rootFolder)
-
-        sm2 = self.makeSite('folder1')
-
-        self.assertEqual(getService('test_service', self.folder1),
-                         sm['default']['test_service1'])
-
-    def testComponentArchitectureServiceLookup(self):
-        self.makeSite()
-        self.makeSite('folder1')
-
-        ts = TestService()
-
-        globsm = getGlobalServices()
-        globsm.provideService('test_service', ts)
-
-        service = getService('test_service', self.folder1)
-        self.assertEqual(service, ts)
-
-    def test_site_manager_connections(self):
-        root = self.rootFolder
-        mr = root.getSiteManager()
-        m1 = setup.createServiceManager(zapi.traverse(root, 'folder1')) 
-        m2 = setup.createServiceManager(zapi.traverse(root, 'folder2'))
-        m111 = setup.createServiceManager(
-            zapi.traverse(root, 'folder1/folder1_1/folder1_1_1'))
-        self.assertEqual(m1.next, mr)
-        self.assertEqual(m2.next, mr)
-        self.assertEqual(m111.next, m1)
-        self.assertEqual(mr.subSites, (m1, m2))
-        self.assertEqual(m1.subSites, (m111, ))
-
-        # Now insert a site and make sure everything is still right:
-        m11 = setup.createServiceManager(
-            zapi.traverse(root, 'folder1/folder1_1'))
-        self.assertEqual(m11.next, m1)
-        self.assertEqual(m111.next, m11)
-        self.assertEqual(m1.subSites, (m11, ))
-        self.assertEqual(m11.subSites, (m111, ))
-
-        
-
-
-def test_suite():
-    loader=TestLoader()
-    return loader.loadTestsFromTestCase(ServiceManagerTests)
-
-if __name__=='__main__':
-    TextTestRunner().run(test_suite())

Deleted: Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py
===================================================================
--- Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/site/tests/test_serviceregistration.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,139 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Service Registration tests.
-
-$Id$
-"""
-
-from unittest import TestCase, main, makeSuite
-
-from zope.interface import Interface, implements
-
-from zope.app.traversing.api import traverse, getPath
-from zope.app.site.service import ServiceRegistration
-from zope.app.site.tests.placefulsetup import PlacefulSetup
-from zope.component.service import defineService
-from zope.app.site.interfaces import IBindingAware
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.registration.interfaces import RegisteredStatus
-from zope.app.registration.interfaces import IRegistered
-from zope.app.site.interfaces import ISimpleService
-
-from zope.app.dependable.interfaces import IDependable, DependencyError
-
-class ITestService(Interface):
-    pass
-
-class TestServiceBase(object):
-    __name__ = __parent__ = None
-    implements(ITestService, IBindingAware, IDependable)
-
-    _bound = _unbound = ()
-
-    def bound(self, name):
-        self._bound += (name, )
-
-    def unbound(self, name):
-        self._unbound += (name, )
-
-    _dependents = ()
-
-    def addDependent(self, location):
-        self._dependents = tuple(
-            [d for d in self._dependents if d != location]
-            +
-            [location]
-            )
-
-    def removeDependent(self, location):
-        self._dependents = tuple(
-            [d for d in self._dependents if d != location]
-            )
-
-    def dependents(self):
-        return self._dependents
-
-class TestService(TestServiceBase):
-    implements(ISimpleService)
-
-class Event(object):
-
-    def __init__(self, object):
-        self.object = object
-
-class Test(PlacefulSetup, TestCase):
-
-    def setUp(self):
-        PlacefulSetup.setUp(self, site=True)
-
-        defineService('test_service', ITestService)
-
-        default = traverse(self.rootFolder,
-                           '++etc++site/default')
-        self.__default = default
-
-        default['c'] = TestService()
-
-        registration = ServiceRegistration(
-            'test_service', default['c'])
-
-        self.__c = traverse(default, 'c')
-        self.__cm = default.getRegistrationManager()
-
-        self.__registration_name = self.__cm.addRegistration(registration)
-
-        self.__config = traverse(self.__cm, self.__registration_name)
-        self.__configpath = getPath(self.__config)
-
-    def test_handleActivated(self):
-        old = self.__c._bound
-        event = Event(self.__config)
-        from zope.app.site.service import bindOnActivated
-        bindOnActivated(self.__config.component, event)
-        self.assertEqual(self.__c._bound, old+('test_service',))
-
-    def test_deactivated(self):
-        old = self.__c._unbound
-        event = Event(self.__config)
-        from zope.app.site.service import unbindOnDeactivated
-        unbindOnDeactivated(self.__config.component, event)
-        self.assertEqual(self.__c._unbound, old+('test_service',))
-
-    def test_getInterface(self):
-        self.assertEquals(self.__config.getInterface(), ITestService)
-
-    # The following tests check the same things as
-    # zope.app.services.tests.testregistrations, but in a different way
-
-    def test_getComponent(self):
-        self.assertEqual(self.__config.component, self.__c)
-
-    def test_not_a_local_service(self):
-        defineService('test_service_2', ITestService)
-        self.__default['c2'] = TestServiceBase()
-
-        self.assertRaises(
-            TypeError,
-            ServiceRegistration,
-            'test_service',
-            self.__default['c2'],
-            self.__default
-            )
-
-
-def test_suite():
-    return makeSuite(Test)
-
-if __name__=='__main__':
-    main(defaultTest='test_suite')

Modified: Zope3/trunk/src/zope/app/sqlexpr/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlexpr/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/sqlexpr/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/sqlscript/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/sqlscript/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.sqlscript.sqlscript import SQLScript
 from xml.sax.saxutils import escape
 

Modified: Zope3/trunk/src/zope/app/sqlscript/browser/sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/browser/sqlscript.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/sqlscript/browser/sqlscript.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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):
@@ -127,7 +127,7 @@
             name = self.context.contentName
             container = self.context.context
             obj = container[name]
-            url = zapi.getView(obj, 'absolute_url', self.request)()
+            url = zapi.absoluteURL(obj, self.request)
             url = '%s/test.html' % url
             return url
         else:

Modified: Zope3/trunk/src/zope/app/sqlscript/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/sqlscript/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,11 +1,11 @@
 <configure
-    xmlns='http://namespaces.zope.org/zope'
-    i18n_domain='zope'
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zope"
     >
 
   <vocabulary
       name="Connection Names"
-      factory="zope.app.utility.vocabulary.UtilityVocabulary"
+      factory="zope.app.component.vocabulary.UtilityVocabulary"
       interface="zope.app.rdb.interfaces.IZopeDatabaseAdapter" 
       nameOnly="True" />
 

Modified: Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/sqlscript/tests/test_sqlscript.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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):

Copied: Zope3/trunk/src/zope/app/testing (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/app/testing)

Modified: Zope3/trunk/src/zope/app/testing/test.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/testing/test.py	2005-02-14 16:23:10 UTC (rev 29141)
+++ Zope3/trunk/src/zope/app/testing/test.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -988,7 +988,7 @@
 
 
     try:
-        opts, args = getopt.getopt(argv[1:],
+        opts, args = getopt.gnu_getopt(argv[1:],
                                    "a:bBcdDfFg:G:hkl:LmMPprs:tTuUvN:1",
                                    ["all", "help", "libdir=", "times=",
                                     "keepbytecode", "dir=", "build",

Modified: Zope3/trunk/src/zope/app/tests/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,2 +1,32 @@
 #
 # This file is necessary to make this directory a package.
+
+##############################################################################
+# BBB: backward-comptibility; 12/18/2004
+
+import sys
+from zope.deprecation.deprecation import DeprecationProxy
+import zope.app
+
+def deprecate(module):
+    depmodule = DeprecationProxy(module)
+    depmodule.deprecate(module.__dict__.keys(),
+                        'The testing support code moved from zope.app.tests '
+                        'to zope.app.testing. This reference go away in Zope '
+                        'X3.3.')
+    return depmodule
+
+
+from zope.app.testing import placelesssetup
+sys.modules['zope.app.tests.placelesssetup'] = deprecate(placelesssetup)
+from zope.app.testing import setup
+sys.modules['zope.app.tests.setup'] = deprecate(setup)
+from zope.app.testing import dochttp
+sys.modules['zope.app.tests.dochttp'] = deprecate(dochttp)
+from zope.app.testing import functional
+sys.modules['zope.app.tests.functional'] = deprecate(functional)
+from zope.app.testing import test
+sys.modules['zope.app.tests.test'] = deprecate(test)
+from zope.app.testing import ztapi
+sys.modules['zope.app.tests.ztapi'] = deprecate(ztapi)
+#############################################################################

Deleted: Zope3/trunk/src/zope/app/tests/dochttp.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/dochttp.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/dochttp.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,226 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (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.
-#
-##############################################################################
-"""Convert an http tcpwatch session to a doctest
-
-$Id$
-"""
-
-import errno
-import optparse
-import os
-import re
-import rfc822
-import sys
-
-usage = """usage: %prog <options> directory
-
-Convert an http tcpwatch recorded sesssion to a doctest file, which is
-written to standard output.
-
-"""
-
-parser = optparse.OptionParser(usage)
-parser.add_option("-p", "--prefix", default="watch",
-                  help="Prefix for recorded tcpwatch session files")
-parser.add_option("-U", "--skip-url", action="append",
-                  help="Regular expression for URLs to skip")
-parser.add_option("-E", "--skip-extension", action="append",
-                  help="URL file-extension to skip")
-parser.add_option("-e", "--extension", action="append",
-                  help="URL file-extension to include")
-parser.add_option("-I", "--skip-request-header", action="append",
-                  help="Request header to skip")
-parser.add_option("-O", "--skip-response-header", action="append",
-                  help="Response header to skip")
-parser.add_option("-r", "--clean-redirects", action="store_true",
-                  help="Strip content from redirect responses",
-                  default=False)
-
-default_options = [
-    '-e', 'html',
-
-    '-I', 'Accept-Charset', '-I', 'Accept-Encoding', '-I', 'Accept-Language',
-    '-I', 'Accept', '-I', 'Connection', '-I', 'Host', '-I', 'Keep-Alive',
-    '-I', 'User-Agent', '-I', 'Content-Length',
-
-    '-O', 'Date', '-O', 'Server', '-O', 'X-Content-Type-Warning',
-    '-O', 'X-Powered-By',
-
-    ]
-
-def dochttp(args=sys.argv[1:], default=None):
-    """Convert a tcpwatch recorded sesssion to a doctest file"""
-    if default is None:
-        default = default_options
-
-    options, args = parser.parse_args(default+args)
-    try:
-        directory, = args
-    except:
-        parser.print_help()
-        sys.exit(1)
-
-    skip_extensions = options.skip_extension or ()
-    extensions = [ext for ext in (options.extension or ())
-                  if ext not in skip_extensions]
-    skip_urls = [re.compile(pattern) for pattern in (options.skip_url or ())]
-
-    names = [name[:-len(".request")]
-             for name in os.listdir(directory)
-             if name.startswith(options.prefix) and name.endswith('.request')
-             ]
-    names.sort()
-
-    extre = re.compile("[.](\w+)$")
-
-    for name in names:
-        requests =  Requests(
-                        open(os.path.join(directory, name + ".request"), 'rb'),
-                        options.skip_request_header,
-                        )
-        responses = Responses(
-                        open(os.path.join(directory, name + ".response"), 'rb'),
-                        options.skip_response_header,
-                        )
-
-        # We use map so as *not* to truncate at shortest input.
-        # We want an error if the number of requests and responses
-        # is different.
-        for request, response in map(None, requests, responses):
-            assert (request and response) or not (request or response)
-
-            path = request.path
-            ext = extre.search(path)
-            if ext:
-                ext = ext.group(1)
-                if extensions:
-                    if ext not in extensions:
-                        continue
-                else:
-                    if ext in skip_extensions:
-                        continue
-            
-            for skip_url in skip_urls:
-                if skip_url.search(request.path):
-                    break
-            else:
-                try:
-                    output_test(request, response, options.clean_redirects)
-                except IOError, e:
-                    if e.errno == errno.EPIPE:
-                        return
-                    raise
-    
-
-def output_test(request, response, clean_redirects=False):
-    print
-    print
-    print '  >>> print http(r"""'
-    print '  ...', '\n  ... '.join(request.lines())+'""")'
-    if response.code in (301, 302, 303) and clean_redirects:
-        if response.headers:
-            for i in range(len(response.headers)):
-                h, v = response.headers[i]
-                if h == "Content-Length":
-                    response.headers[i] = (h, "...")
-        lines = response.header_lines()
-        if lines:
-            lines.append("...")
-    else:
-        lines = response.lines()
-    print ' ', '\n  '.join([line.rstrip() and line or '<BLANKLINE>'
-                             for line in lines])
-
-class Message:
-
-    start = ''
-
-    def __init__(self, file, skip_headers):
-        start = file.readline().rstrip()
-        if start:
-            self.start = start
-            if start.startswith("HTTP/"):
-                # This is a response; extract the response code:
-                self.code = int(start.split()[1])
-            headers = [split_header(header)
-                       for header in rfc822.Message(file).headers
-                       ]
-            headers = [
-                ('-'.join([s.capitalize() for s in name.split('-')]),
-                 v.rstrip()
-                 )
-                for (name, v) in headers
-            ]
-            content_length = int(dict(headers).get('Content-Length', '0'))
-            if content_length:
-                self.body = file.read(content_length).split('\n')
-            else:
-                self.body = []
-            headers = [(name, v) for (name, v) in headers
-                       if name.lower() not in skip_headers
-                       ]
-            self.headers = headers
-
-    def __nonzero__(self):
-        return bool(self.start)
-
-    def lines(self):
-        output = self.header_lines()
-        if output:
-            output.extend(self.body)
-        return output
-
-    def header_lines(self):
-        if self.start:
-            output = [self.start]
-            headers = ["%s: %s" % (name, v) for (name, v) in self.headers]
-            headers.sort()
-            output.extend(headers)
-            output.append('')
-        else:
-            output = []
-        return output
-
-headerre = re.compile('(\S+): (.+)$')
-def split_header(header):
-    return headerre.match(header).group(1, 2)
-
-def messages(cls, file, skip_headers):
-    skip_headers = [name.lower() for name in (skip_headers or ())]
-    while 1:
-        message = cls(file, skip_headers)
-        if message:
-            yield message
-        else:
-            break
-        
-class Request(Message):
-
-    path = ''
-    
-    def __init__(self, file, skip_headers):
-        Message.__init__(self, file, skip_headers)
-        if self.start:
-            self.command, self.path, self.protocol = self.start.split()
-    
-def Requests(file, skip_headers):
-    return messages(Request, file, skip_headers)
-    
-def Responses(file, skip_headers):
-    return messages(Message, file, skip_headers)
-
-main = dochttp
-
-if __name__ == '__main__':
-    main()

Deleted: Zope3/trunk/src/zope/app/tests/dochttp.txt
===================================================================
--- Zope3/trunk/src/zope/app/tests/dochttp.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/dochttp.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,31 +0,0 @@
-Steps to get started:
-
-0. Use a clean/missing Data.fs
-
-1. Create a manager with the name "mgr", password "mgrpw", and grant
-   the zope.Manager role.
-
-2. Install tcpwatch.
-
-3. Create a temporary directory to record tcpwatch output.
-
-4. Run tcpwatch using:
-   tcpwatch.py -L 8081:8080 -s -r tmpdir
-   (the ports are the listening port and forwarded-to port; the
-   second need to match the Zope configuration)
-
-5. In a browser, connect to the listening port and do whatever needs
-   to be recorded.
-
-6. Shut down tcpwatch.
-
-7. Run the script src/zope/app/tests/dochttp.py:
-   python2.3 src/zope/app/tests/dochttp.py tmpdir > somefile.txt
-
-8. Edit the generated text file to add explanations and elide
-   uninteresting portions of the output.
-
-9. In a functional test module (usually ftests.py), import
-   FunctionalDocFileSuite from zope.app.tests.functional and
-   instantiate it, passing the name of the text file containing the
-   test.

Deleted: Zope3/trunk/src/zope/app/tests/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/functional.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/functional.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,663 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Functional testing framework for Zope 3.
-
-There should be a file 'ftesting.zcml' in the current directory.
-
-$Id$
-"""
-import logging
-import re
-import rfc822
-import sys
-import traceback
-import unittest
-import urllib
-
-from StringIO import StringIO
-from Cookie import SimpleCookie
-
-from transaction import abort, commit
-from ZODB.DB import DB
-from ZODB.DemoStorage import DemoStorage
-
-from zope import interface, component
-from zope.publisher.browser import BrowserRequest
-from zope.publisher.http import HTTPRequest
-from zope.publisher.publish import publish
-from zope.publisher.xmlrpc import XMLRPCRequest
-from zope.security.interfaces import Forbidden, Unauthorized
-from zope.security.management import endInteraction
-import zope.publisher.interfaces.http
-from zope.testing import doctest
-
-import zope.app.pluggableauth
-import zope.app.tests.setup
-
-from zope.app import zapi
-from zope.app.debug import Debugger
-from zope.app.publication.http import HTTPPublication
-from zope.app.publication.browser import BrowserPublication
-from zope.app.publication.xmlrpc import XMLRPCPublication
-from zope.app.publication.soap import SOAPPublication
-from zope.app.publication.interfaces import ISOAPRequestFactory
-from zope.app.publication.zopepublication import ZopePublication
-from zope.app.publication.http import HTTPPublication
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from zope.publisher.interfaces.browser import IDefaultSkin
-from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.app.component.hooks import setSite, getSite
-
-HTTPTaskStub = StringIO
-
-
-class ResponseWrapper(object):
-    """A wrapper that adds several introspective methods to a response."""
-
-    def __init__(self, response, outstream, path):
-        self._response = response
-        self._outstream = outstream
-        self._path = path
-
-    def getOutput(self):
-        """Returns the full HTTP output (headers + body)"""
-        return self._outstream.getvalue()
-
-    def getBody(self):
-        """Returns the response body"""
-        output = self._outstream.getvalue()
-        idx = output.find('\r\n\r\n')
-        if idx == -1:
-            return None
-        else:
-            return output[idx+4:]
-
-    def getPath(self):
-        """Returns the path of the request"""
-        return self._path
-
-    def __getattr__(self, attr):
-        return getattr(self._response, attr)
-
-
-def _getDefaultSkin():
-    """Returns the current default skin as an interface."""
-    adapters = zapi.getService(zapi.servicenames.Adapters)
-    skin = adapters.lookup((IBrowserRequest,), IDefaultSkin, '')
-    return skin or IDefaultBrowserLayer
-
-
-class IManagerSetup(interface.Interface):
-    """Utility for enabling up a functional testing manager with needed grants
-
-    XXX This is an interim solution.  It tries to break the dependence
-    on a particular security policy, however, we need a much better
-    way of managing functional-testing configurations.
-    
-    """
-
-    def setUpManager():
-        """Set up the manager, zope.mgr
-        """
-
-class FunctionalTestSetup(object):
-    """Keeps shared state across several functional test cases."""
-
-    __shared_state = { '_init': False }
-
-    def __init__(self, config_file=None):
-        """Initializes Zope 3 framework.
-
-        Creates a volatile memory storage.  Parses Zope3 configuration files.
-        """
-        self.__dict__ = self.__shared_state
-
-        if not self._init:
-
-            # Make sure unit tests are cleaned up
-            zope.app.tests.setup.placefulSetUp()
-            zope.app.tests.setup.placefulTearDown()
-
-            if not config_file:
-                config_file = 'ftesting.zcml'
-            self.log = StringIO()
-            # Make it silent but keep the log available for debugging
-            logging.root.addHandler(logging.StreamHandler(self.log))
-            self.base_storage = DemoStorage("Memory Storage")
-            self.db = DB(self.base_storage)
-            self.app = Debugger(self.db, config_file)
-            self.connection = None
-            self._config_file = config_file
-            self._init = True
-
-            # Make a local grant for the test user
-            setup = component.queryUtility(IManagerSetup)
-            if setup is not None:
-                setup.setUpManager()
-            
-            FunctionalTestSetup().connection = None
-            
-        elif config_file and config_file != self._config_file:
-            # Running different tests with different configurations is not
-            # supported at the moment
-            raise NotImplementedError('Already configured'
-                                      ' with a different config file')
-
-    def setUp(self):
-        """Prepares for a functional test case."""
-        # Tear down the old demo storage (if any) and create a fresh one
-        abort()
-        self.db.close()
-        storage = DemoStorage("Demo Storage", self.base_storage)
-        self.db = self.app.db = DB(storage)
-        self.connection = None
-
-    def tearDown(self):
-        """Cleans up after a functional test case."""
-        abort()
-        if self.connection:
-            self.connection.close()
-            self.connection = None
-        self.db.close()
-
-    def getRootFolder(self):
-        """Returns the Zope root folder."""
-        if not self.connection:
-            self.connection = self.db.open()
-        root = self.connection.root()
-        return root[ZopePublication.root_name]
-
-    def getApplication(self):
-        """Returns the Zope application instance."""
-        return self.app
-
-
-class FunctionalTestCase(unittest.TestCase):
-    """Functional test case."""
-
-    def setUp(self):
-        """Prepares for a functional test case."""
-        super(FunctionalTestCase, self).setUp()
-        FunctionalTestSetup().setUp()
-
-    def tearDown(self):
-        """Cleans up after a functional test case."""
-
-        FunctionalTestSetup().tearDown()
-        super(FunctionalTestCase, self).tearDown()
-
-    def getRootFolder(self):
-        """Returns the Zope root folder."""
-        return FunctionalTestSetup().getRootFolder()
-
-    def commit(self):
-        commit()
-
-    def abort(self):
-        abort()
-
-
-class CookieHandler(object):
-
-    def __init__(self, *args, **kw):
-        # Somewhere to store cookies between consecutive requests
-        self.cookies = SimpleCookie()
-        super(CookieHandler, self).__init__(*args, **kw)
-
-    def httpCookie(self, path):
-        """Return self.cookies as an HTTP_COOKIE environment value."""
-        l = [m.OutputString() for m in self.cookies.values()
-             if path.startswith(m['path'])]
-        return '; '.join(l)
-
-    def loadCookies(self, envstring):
-        self.cookies.load(envstring)
-
-    def saveCookies(self, response):
-        """Save cookies from the response."""
-        # Urgh - need to play with the response's privates to extract
-        # cookies that have been set
-        for k,v in response._cookies.items():
-            k = k.encode('utf8')
-            self.cookies[k] = v['value'].encode('utf8')
-            if self.cookies[k].has_key('Path'):
-                self.cookies[k]['Path'] = v['Path']
-
-
-class BrowserTestCase(CookieHandler, FunctionalTestCase):
-    """Functional test case for Browser requests."""
-
-    def tearDown(self):
-        self.setSite(None)
-        super(BrowserTestCase, self).tearDown()
-
-    def setSite(self, site):
-        """Set the site which will be used to look up local services"""
-        setSite(site)
-
-    def getSite(self):
-        """Returns the site which is used to look up local services"""
-        return getSite()
-
-    def makeRequest(self, path='', basic=None, form=None, env={},
-                    outstream=None):
-        """Creates a new request object.
-
-        Arguments:
-          path   -- the path to be traversed (e.g. "/folder1/index.html")
-          basic  -- basic HTTP authentication credentials ("user:password")
-          form   -- a dictionary emulating a form submission
-                    (Note that field values should be Unicode strings)
-          env    -- a dictionary of additional environment variables
-                    (You can emulate HTTP request header
-                       X-Header: foo
-                     by adding 'HTTP_X_HEADER': 'foo' to env)
-          outstream -- a stream where the HTTP response will be written
-        """
-        if outstream is None:
-            outstream = HTTPTaskStub()
-        environment = {"HTTP_HOST": 'localhost',
-                       "HTTP_REFERER": 'localhost',
-                       "HTTP_COOKIE": self.httpCookie(path)}
-        environment.update(env)
-        app = FunctionalTestSetup().getApplication()
-        request = app._request(path, '', outstream,
-                               environment=environment,
-                               basic=basic, form=form,
-                               request=BrowserRequest)
-        interface.directlyProvides(request, _getDefaultSkin())
-        return request
-
-    def publish(self, path, basic=None, form=None, env={},
-                handle_errors=False):
-        """Renders an object at a given location.
-
-        Arguments are the same as in makeRequest with the following exception:
-          handle_errors  -- if False (default), exceptions will not be caught
-                            if True, exceptions will return a formatted error
-                            page.
-
-        Returns the response object enhanced with the following methods:
-          getOutput()    -- returns the full HTTP output as a string
-          getBody()      -- returns the full response body as a string
-          getPath()      -- returns the path used in the request
-        """
-        outstream = HTTPTaskStub()
-        old_site = self.getSite()
-        self.setSite(None)
-        # A cookie header has been sent - ensure that future requests
-        # in this test also send the cookie, as this is what browsers do.
-        # We pull it apart and reassemble the header to block cookies
-        # with invalid paths going through, which may or may not be correct
-        if env.has_key('HTTP_COOKIE'):
-            self.loadCookies(env['HTTP_COOKIE'])
-            del env['HTTP_COOKIE'] # Added again in makeRequest
-
-        request = self.makeRequest(path, basic=basic, form=form, env=env,
-                                   outstream=outstream)
-        response = ResponseWrapper(request.response, outstream, path)
-        if env.has_key('HTTP_COOKIE'):
-            self.loadCookies(env['HTTP_COOKIE'])
-        publish(request, handle_errors=handle_errors)
-        self.saveCookies(response)
-        self.setSite(old_site)
-        return response
-
-    def checkForBrokenLinks(self, body, path, basic=None):
-        """Looks for broken links in a page by trying to traverse relative
-        URIs.
-        """
-        if not body: return
-
-        old_site = self.getSite()
-        self.setSite(None)
-
-        from htmllib import HTMLParser
-        from formatter import NullFormatter
-        class SimpleHTMLParser(HTMLParser):
-            def __init__(self, fmt, base):
-                HTMLParser.__init__(self, fmt)
-                self.base = base
-            def do_base(self, attrs):
-                self.base = dict(attrs).get('href', self.base)
-
-        parser = SimpleHTMLParser(NullFormatter(), path)
-        parser.feed(body)
-        parser.close()
-        base = parser.base
-        while not base.endswith('/'):
-            base = base[:-1]
-        if base.startswith('http://localhost/'):
-            base = base[len('http://localhost/') - 1:]
-
-        errors = []
-        for a in parser.anchorlist:
-            if a.startswith('http://localhost/'):
-                a = a[len('http://localhost/') - 1:]
-            elif a.find(':') != -1:
-                # Assume it is an external link
-                continue
-            elif not a.startswith('/'):
-                a = base + a
-            if a.find('#') != -1:
-                a = a[:a.index('#') - 1]
-            # XXX what about queries (/path/to/foo?bar=baz&etc)?
-            request = None
-            try:
-                try:
-                    request = self.makeRequest(a, basic=basic)
-                    publication = request.publication
-                    request.processInputs()
-                    publication.beforeTraversal(request)
-                    object = publication.getApplication(request)
-                    object = request.traverse(object)
-                    publication.afterTraversal(request, object)
-                except (KeyError, NameError, AttributeError, Unauthorized, Forbidden):
-                    e = traceback.format_exception_only(*sys.exc_info()[:2])[-1]
-                    errors.append((a, e.strip()))
-            finally:
-                publication.endRequest(request, object)
-                self.setSite(old_site)
-                # Bad Things(TM) related to garbage collection and special
-                # __del__ methods happen if request.close() is not called here
-                if request:
-                    request.close()
-        if errors:
-            self.fail("%s contains broken links:\n" % path
-                      + "\n".join(["  %s:\t%s" % (a, e) for a, e in errors]))
-
-
-class HTTPTestCase(FunctionalTestCase):
-    """Functional test case for HTTP requests."""
-
-    def makeRequest(self, path='', basic=None, form=None, env={},
-                    instream=None, outstream=None):
-        """Creates a new request object.
-
-        Arguments:
-          path   -- the path to be traversed (e.g. "/folder1/index.html")
-          basic  -- basic HTTP authentication credentials ("user:password")
-          form   -- a dictionary emulating a form submission
-                    (Note that field values should be Unicode strings)
-          env    -- a dictionary of additional environment variables
-                    (You can emulate HTTP request header
-                       X-Header: foo
-                     by adding 'HTTP_X_HEADER': 'foo' to env)
-          instream  -- a stream from where the HTTP request will be read
-          outstream -- a stream where the HTTP response will be written
-        """
-        if outstream is None:
-            outstream = HTTPTaskStub()
-        if instream is None:
-            instream = ''
-        environment = {"HTTP_HOST": 'localhost',
-                       "HTTP_REFERER": 'localhost'}
-        environment.update(env)
-        app = FunctionalTestSetup().getApplication()
-        request = app._request(path, instream, outstream,
-                               environment=environment,
-                               basic=basic, form=form,
-                               request=HTTPRequest, publication=HTTPPublication)
-        return request
-
-    def publish(self, path, basic=None, form=None, env={},
-                handle_errors=False, request_body=''):
-        """Renders an object at a given location.
-
-        Arguments are the same as in makeRequest with the following exception:
-          handle_errors  -- if False (default), exceptions will not be caught
-                            if True, exceptions will return a formatted error
-                            page.
-
-        Returns the response object enhanced with the following methods:
-          getOutput()    -- returns the full HTTP output as a string
-          getBody()      -- returns the full response body as a string
-          getPath()      -- returns the path used in the request
-        """
-        outstream = HTTPTaskStub()
-        request = self.makeRequest(path, basic=basic, form=form, env=env,
-                                   instream=request_body, outstream=outstream)
-        response = ResponseWrapper(request.response, outstream, path)
-        publish(request, handle_errors=handle_errors)
-        return response
-
-
-class HTTPHeaderOutput:
-
-    interface.implements(zope.publisher.interfaces.http.IHeaderOutput)
-
-    def __init__(self, protocol, omit):
-        self.headers = {}
-        self.headersl = []
-        self.protocol = protocol
-        self.omit = omit
-    
-    def setResponseStatus(self, status, reason):
-        self.status, self.reason = status, reason
-
-    def setResponseHeaders(self, mapping):
-        self.headers.update(dict(
-            [('-'.join([s.capitalize() for s in name.split('-')]), v)
-             for name, v in mapping.items()
-             if name.lower() not in self.omit]
-        ))
-
-    def appendResponseHeaders(self, lst):
-        headers = [split_header(header) for header in lst]
-        self.headersl.extend(
-            [('-'.join([s.capitalize() for s in name.split('-')]), v)
-             for name, v in headers
-             if name.lower() not in self.omit]
-        )
-
-    def __str__(self):
-        out = ["%s: %s" % header for header in self.headers.items()]
-        out.extend(["%s: %s" % header for header in self.headersl])
-        out.sort()
-        out.insert(0, "%s %s %s" % (self.protocol, self.status, self.reason))
-        return '\n'.join(out)
-
-class DocResponseWrapper(ResponseWrapper):
-    """Response Wrapper for use in doc tests
-    """
-
-    def __init__(self, response, outstream, path, header_output):
-        ResponseWrapper.__init__(self, response, outstream, path)
-        self.header_output = header_output
-
-    def __str__(self):
-        body = self.getOutput()
-        if body:
-            return "%s\n\n%s" % (self.header_output, body)
-        return "%s\n" % (self.header_output)
-
-    def getBody(self):
-        return self.getOutput()
-
-
-headerre = re.compile(r'(\S+): (.+)$')
-def split_header(header):
-    return headerre.match(header).group(1, 2)
-
-basicre = re.compile('Basic (.+)?:(.+)?$')
-def auth_header(header):
-    match = basicre.match(header)
-    if match:
-        import base64
-        u, p = match.group(1, 2)
-        if u is None:
-            u = ''
-        if p is None:
-            p = ''
-        auth = base64.encodestring('%s:%s' % (u, p))
-        return 'Basic %s' % auth[:-1]
-    return header
-
-def getRootFolder():
-    return FunctionalTestSetup().getRootFolder()
-
-def sync():
-    getRootFolder()._p_jar.sync()
-
-#
-# Sample functional test case
-#
-
-class SampleFunctionalTest(BrowserTestCase):
-
-    def testRootPage(self):
-        response = self.publish('/')
-        self.assertEquals(response.getStatus(), 200)
-
-    def testRootPage_preferred_languages(self):
-        response = self.publish('/', env={'HTTP_ACCEPT_LANGUAGE': 'en'})
-        self.assertEquals(response.getStatus(), 200)
-
-    def testNotExisting(self):
-        response = self.publish('/nosuchthing', handle_errors=True)
-        self.assertEquals(response.getStatus(), 404)
-
-    def testLinks(self):
-        response = self.publish('/')
-        self.assertEquals(response.getStatus(), 200)
-        self.checkForBrokenLinks(response.getBody(), response.getPath())
-
-
-def sample_test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(SampleFunctionalTest))
-    return suite
-
-
-class HTTPCaller(CookieHandler):
-    """Execute an HTTP request string via the publisher"""
-
-    def __call__(self, request_string, handle_errors=True):
-        # Commit work done by previous python code.
-        commit()
-
-        # Discard leading white space to make call layout simpler
-        request_string = request_string.lstrip()
-
-        # split off and parse the command line
-        l = request_string.find('\n')
-        command_line = request_string[:l].rstrip()
-        request_string = request_string[l+1:]
-        method, path, protocol = command_line.split()
-        path = urllib.unquote(path)
-
-        instream = StringIO(request_string)
-        environment = {"HTTP_COOKIE": self.httpCookie(path),
-                       "HTTP_HOST": 'localhost',
-                       "HTTP_REFERER": 'localhost',
-                       "REQUEST_METHOD": method,
-                       "SERVER_PROTOCOL": protocol,
-                       }
-
-        headers = [split_header(header)
-                   for header in rfc822.Message(instream).headers]
-        for name, value in headers:
-            name = ('_'.join(name.upper().split('-')))
-            if name not in ('CONTENT_TYPE', 'CONTENT_LENGTH'):
-                name = 'HTTP_' + name
-            environment[name] = value.rstrip()
-
-        auth_key = 'HTTP_AUTHORIZATION'
-        if environment.has_key(auth_key):
-            environment[auth_key] = auth_header(environment[auth_key])
-
-        outstream = HTTPTaskStub()
-
-        old_site = getSite()
-        setSite(None)
-        app = FunctionalTestSetup().getApplication()
-        header_output = HTTPHeaderOutput(
-            protocol, ('x-content-type-warning', 'x-powered-by'))
-
-        content_type = environment.get('CONTENT_TYPE', '')
-        is_xml = content_type.startswith('text/xml')
-
-        if method in ('GET', 'POST', 'HEAD'):
-            if (method == 'POST' and environment.get('HTTP_SOAPACTION', None)
-                and is_xml):
-                factory = zapi.queryUtility(ISOAPRequestFactory)
-                if factory is not None:
-                    request_cls = factory(StringIO(), StringIO(), {}).__class__
-                    publication_cls = SOAPPublication
-                else:
-                    request_cls = BrowserRequest
-                    publication_cls = BrowserPublication
-            elif (method == 'POST' and is_xml):
-                request_cls = XMLRPCRequest
-                publication_cls = XMLRPCPublication
-            else:
-                request_cls = BrowserRequest
-                publication_cls = BrowserPublication
-            
-        else:
-            request_cls = HTTPRequest
-            publication_cls = HTTPPublication
-
-        request = app._request(
-            path, instream, outstream,
-            environment=environment,
-            request=request_cls, publication=publication_cls)
-        if request_cls is BrowserRequest:
-            # Only browser requests have skins
-            interface.directlyProvides(request, _getDefaultSkin())
-        request.response.setHeaderOutput(header_output)
-        response = DocResponseWrapper(
-            request.response, outstream, path, header_output)
-
-        publish(request, handle_errors=handle_errors)
-        self.saveCookies(response)
-        setSite(old_site)
-
-        # sync Python connection:
-        getRootFolder()._p_jar.sync()
-
-        return response
-
-def FunctionalDocFileSuite(*paths, **kw):
-    globs = kw.setdefault('globs', {})
-    globs['http'] = HTTPCaller()
-    globs['getRootFolder'] = getRootFolder
-    globs['sync'] = sync
-
-    kw['package'] = doctest._normalize_module(kw.get('package'))
-
-    kwsetUp = kw.get('setUp')
-    def setUp(test):
-        FunctionalTestSetup().setUp()
-        
-        if kwsetUp is not None:
-            kwsetUp(test)
-    kw['setUp'] = setUp
-
-    kwtearDown = kw.get('tearDown')
-    def tearDown(test):
-        if kwtearDown is not None:
-            kwtearDown(test)
-        FunctionalTestSetup().tearDown()
-    kw['tearDown'] = tearDown
-
-    if 'optionflags' not in kw:
-        kw['optionflags'] = (doctest.ELLIPSIS
-                             | doctest.REPORT_NDIFF
-                             | doctest.NORMALIZE_WHITESPACE)
-
-    return doctest.DocFileSuite(*paths, **kw)
-
-if __name__ == '__main__':
-    unittest.main()

Deleted: Zope3/trunk/src/zope/app/tests/placelesssetup.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/placelesssetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/placelesssetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,69 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Unit test logic for setting up and tearing down basic infrastructure
-
-$Id$
-"""
-from zope.app.tests import ztapi
-from zope.schema.vocabulary import setVocabularyRegistry
-from zope.component.tests.placelesssetup \
-    import PlacelessSetup as CAPlacelessSetup
-from zope.app.event.tests.placelesssetup \
-    import PlacelessSetup as EventPlacelessSetup
-from zope.app.i18n.tests.placelesssetup \
-    import PlacelessSetup as I18nPlacelessSetup
-from zope.app.container.tests.placelesssetup \
-    import PlacelessSetup as ContainerPlacelessSetup
-from zope.app.security._protections import protect
-from zope.app.traversing.browser.interfaces import IAbsoluteURL
-from zope.app.traversing.browser.absoluteurl import AbsoluteURL
-
-class PlacelessSetup(CAPlacelessSetup,
-                     EventPlacelessSetup,
-                     I18nPlacelessSetup,
-                     ContainerPlacelessSetup
-                     ):
-
-    def setUp(self, doctesttest=None):
-        CAPlacelessSetup.setUp(self)
-        ContainerPlacelessSetup.setUp(self)
-        EventPlacelessSetup.setUp(self)
-        I18nPlacelessSetup.setUp(self)
-        # Register app-specific security declarations
-        protect()
-
-        ztapi.browserView(None, 'absolute_url', AbsoluteURL)
-        ztapi.browserViewProviding(None, AbsoluteURL, IAbsoluteURL)
-
-        from zope.app.security.tests import addCheckerPublic
-        addCheckerPublic()
-
-        from zope.security.management import newInteraction
-        newInteraction()
-
-        setVocabularyRegistry(None)
-
-
-ps = PlacelessSetup()
-setUp = ps.setUp
-
-def tearDown():
-    tearDown_ = ps.tearDown
-    def tearDown(doctesttest=None):
-        tearDown_()
-    return tearDown
-
-tearDown = tearDown()
-
-del ps

Deleted: Zope3/trunk/src/zope/app/tests/setup.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/setup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/setup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,214 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Setting up an environment for testing context-dependent objects
-
-$Id$
-"""
-
-import zope.component
-import zope.interface
-from zope.app import zapi
-from zope.app.tests import ztapi
-from zope.interface import classImplements
-
-#------------------------------------------------------------------------
-# Annotations
-from zope.app.annotation.attribute import AttributeAnnotations
-from zope.app.annotation.interfaces import IAnnotations
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-def setUpAnnotations():
-    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
-                         AttributeAnnotations)
-
-#------------------------------------------------------------------------
-# Dependencies
-from zope.app.dependable import Dependable
-from zope.app.dependable.interfaces import IDependable
-def setUpDependable():
-    ztapi.provideAdapter(IAttributeAnnotatable, IDependable,
-                         Dependable)
-
-#------------------------------------------------------------------------
-# Traversal
-from zope.app.traversing.browser.interfaces import IAbsoluteURL
-from zope.app.traversing.browser import SiteAbsoluteURL, AbsoluteURL
-from zope.app.container.traversal import ContainerTraversable
-from zope.app.container.interfaces import ISimpleReadContainer
-from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.traversing.interfaces import ITraverser, ITraversable
-from zope.app.traversing.adapters import DefaultTraversable
-from zope.app.traversing.adapters import Traverser, RootPhysicallyLocatable
-from zope.app.location.traversing import LocationPhysicallyLocatable
-from zope.app.traversing.namespace import etc
-
-def setUpTraversal():
-    ztapi.provideAdapter(None, ITraverser, Traverser)
-    ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
-
-    ztapi.provideAdapter(
-        ISimpleReadContainer, ITraversable, ContainerTraversable)
-    ztapi.provideAdapter(
-        None, IPhysicallyLocatable, LocationPhysicallyLocatable)
-    ztapi.provideAdapter(
-        IContainmentRoot, IPhysicallyLocatable, RootPhysicallyLocatable)
-
-    # set up etc namespace
-    ztapi.provideAdapter(None, ITraversable, etc, name="etc")
-    ztapi.provideView(None, None, ITraversable, "etc", etc)
-
-    ztapi.browserView(None, "absolute_url", AbsoluteURL)
-    ztapi.browserView(IContainmentRoot, "absolute_url", SiteAbsoluteURL)
-
-    ztapi.browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
-    ztapi.browserView(IContainmentRoot, '', SiteAbsoluteURL,
-                      providing=IAbsoluteURL)
-
-
-#------------------------------------------------------------------------
-# Use registration
-from zope.app.registration.interfaces import IAttributeRegisterable
-from zope.app.registration.interfaces import IRegistered
-from zope.app.registration.interfaces import IComponentRegistration
-from zope.app.registration.interfaces import IRegistrationEvent
-from zope.app.registration.registration import Registered
-from zope.app.registration.registration import componentRegistrationEventNotify
-def setUpRegistered():
-    ztapi.provideAdapter(IAttributeRegisterable, IRegistered,
-                         Registered)
-    ztapi.subscribe((IComponentRegistration, IRegistrationEvent), None,
-                     componentRegistrationEventNotify)
-
-#------------------------------------------------------------------------
-# Service service lookup
-from zope.app.component.localservice import serviceServiceAdapter
-from zope.app.registration.interfaces import IRegistrationActivatedEvent
-from zope.app.registration.interfaces import IRegistrationDeactivatedEvent
-from zope.app.site.interfaces import IBindingAware
-from zope.app.site.service import bindOnActivated, unbindOnDeactivated
-from zope.component.interfaces import IServiceService
-from zope.interface import Interface
-def setUpServiceService():
-    ztapi.subscribe((IBindingAware, IRegistrationActivatedEvent), None,
-                     bindOnActivated)
-    ztapi.subscribe((IBindingAware, IRegistrationDeactivatedEvent), None,
-                     unbindOnDeactivated)
-    ztapi.provideAdapter(Interface, IServiceService, serviceServiceAdapter)
-
-#------------------------------------------------------------------------
-# Placeful setup
-import zope.app.component.hooks
-from zope.app.tests.placelesssetup import setUp as placelessSetUp
-from zope.app.tests.placelesssetup import tearDown as placelessTearDown
-def placefulSetUp(site=False):
-    placelessSetUp()
-    zope.app.component.hooks.setHooks()
-    setUpAnnotations()
-    setUpDependable()
-    setUpTraversal()
-    setUpRegistered()
-    setUpServiceService()
-
-    if site:
-        site = rootFolder()
-        createServiceManager(site, setsite=True)
-        return site
-
-from zope.app.component.hooks import setSite
-def placefulTearDown():
-    placelessTearDown()
-    zope.app.component.hooks.resetHooks()
-    setSite()
-
-
-from zope.app.folder import Folder, rootFolder
-
-def buildSampleFolderTree():
-    # set up a reasonably complex folder structure
-    #
-    #     ____________ rootFolder ____________
-    #    /                                    \
-    # folder1 __________________            folder2
-    #   |                       \             |
-    # folder1_1 ____           folder1_2    folder2_1
-    #   |           \            |            |
-    # folder1_1_1 folder1_1_2  folder1_2_1  folder2_1_1
-
-    root = rootFolder()
-    root['folder1'] = Folder()
-    root['folder1']['folder1_1'] = Folder()
-    root['folder1']['folder1_1']['folder1_1_1'] = Folder()
-    root['folder1']['folder1_1']['folder1_1_2'] = Folder()
-    root['folder1']['folder1_2'] = Folder()
-    root['folder1']['folder1_2']['folder1_2_1'] = Folder()
-    root['folder2'] = Folder()
-    root['folder2']['folder2_1'] = Folder()
-    root['folder2']['folder2_1']['folder2_1_1'] = Folder()
-
-    return root
-
-
-from zope.app.site.service import ServiceManager
-from zope.app.site.interfaces import ISite
-def createServiceManager(folder, setsite=False):
-    if not ISite.providedBy(folder):
-        folder.setSiteManager(ServiceManager(folder))
-    if setsite:
-        setSite(folder)
-    return zapi.traverse(folder, "++etc++site")
-
-from zope.app.site.service import ServiceRegistration
-from zope.app.site.interfaces import ISimpleService
-from zope.app.registration.interfaces import ActiveStatus
-
-def addService(servicemanager, name, service, suffix=''):
-    """Add a service to a service manager
-
-    This utility is useful for tests that need to set up services.
-    """
-    # Most local services implement ISimpleService in ZCML; therefore make
-    # sure we got it here as well.
-    zope.interface.directlyProvides(service, ISimpleService)
-
-    default = zapi.traverse(servicemanager, 'default')
-    default[name+suffix] = service
-    registration = ServiceRegistration(name, service, default)
-    key = default.getRegistrationManager().addRegistration(registration)
-    zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
-    return default[name+suffix]
-
-from zope.app.utility import UtilityRegistration
-
-def addUtility(servicemanager, name, iface, utility, suffix=''):
-    """Add a utility to a service manager
-
-    This utility is useful for tests that need to set up utilities.
-    """
-
-    folder_name = (name or (iface.__name__ + 'Utility')) + suffix
-    default = zapi.traverse(servicemanager, 'default')
-    default[folder_name] = utility
-    registration = UtilityRegistration(name, iface, default[folder_name])
-    key = default.getRegistrationManager().addRegistration(registration)
-    zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
-    return default[folder_name]
-
-def createStandardServices(folder):
-    '''Create a bunch of standard placeful services
-
-    Well, uh, 0
-    '''
-    sm = createServiceManager(folder)
-
-

Deleted: Zope3/trunk/src/zope/app/tests/test.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/test.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,1242 +0,0 @@
-#! /usr/bin/env python2.3
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""test.py [-abBcdDfFgGhklLmMPprstTuUv] [modfilter [testfilter...]]
-
-Find and run tests written using the unittest module.
-
-The test runner searches for Python modules that contain test suites.
-It collects those suites, and runs the tests.  There are many options
-for controlling how the tests are run.  There are options for using
-the debugger, reporting code coverage, and checking for refcount problems.
-
-The test runner uses the following rules for finding tests to run.  It
-searches for packages and modules that contain "tests" as a component
-of the name, e.g. "frob.tests.nitz" matches this rule because tests is
-a sub-package of frob.  Within each "tests" package, it looks for
-modules that begin with the name "test."  For each test module, it
-imports the module and calls the module's test_suite() function, which must
-return a unittest TestSuite object.
-
-Options can be specified as command line arguments (see below). However,
-options may also be specified in a file named 'test.config', a Python
-script which, if found, will be executed before the command line
-arguments are processed.
-
-The test.config script should specify options by setting zero or more of the
-global variables: LEVEL, BUILD, and other capitalized variable names found in
-the test runner script (see the list of global variables in process_args().).
-
-
--a level
---at-level level
---all
-    Run the tests at the given level.  Any test at a level at or below
-    this is run, any test at a level above this is not run.  Level 0
-    runs all tests.  The default is to run tests at level 1.  --all is
-    a shortcut for -a 0.
-
--b
---build
-    Run "python setup.py build" before running tests, where "python"
-    is the version of python used to run test.py.  Highly recommended.
-    Tests will be run from the build directory.
-
--B
---build-inplace
-    Run "python setup.py build_ext -i" before running tests.  Tests will be
-    run from the source directory.
-
--c
---pychecker
-    use pychecker
-
--d
---debug
-    Instead of the normal test harness, run a debug version which
-    doesn't catch any exceptions.  This is occasionally handy when the
-    unittest code catching the exception doesn't work right.
-    Unfortunately, the debug harness doesn't print the name of the
-    test, so Use With Care.
-
--D
---debug-inplace
-    Works like -d, except that it loads pdb when an exception occurs.
-
---dir directory
--s directory
-    Option to limit where tests are searched for. This is important
-    when you *really* want to limit the code that gets run.  This can
-    be specified more than once to run tests in two different parts of
-    the source tree.
-    For example, if refactoring interfaces, you don't want to see the way
-    you have broken setups for tests in other packages. You *just* want to
-    run the interface tests.
-
--f
---skip-unit
-    Run functional tests but not unit tests.
-    Note that functional tests will be skipped if the module
-    zope.app.tests.functional cannot be imported.
-    Functional tests also expect to find the file ftesting.zcml,
-    which is used to configure the functional-test run.
-
--F
-    DEPRECATED. Run both unit and functional tests.
-    This option is deprecated, because this is the new default mode.
-    Note that functional tests will be skipped if the module
-    zope.app.tests.functional cannot be imported.
-
--g threshold
---gc-threshold threshold
-    Set the garbage collector generation0 threshold.  This can be used
-    to stress memory and gc correctness.  Some crashes are only
-    reproducible when the threshold is set to 1 (agressive garbage
-    collection).  Do "-g 0" to disable garbage collection altogether.
-
--G gc_option
---gc-option gc_option
-    Set the garbage collection debugging flags.  The argument must be one
-    of the DEBUG_ flags defined bythe Python gc module.  Multiple options
-    can be specified by using "-G OPTION1 -G OPTION2."
-
--k
---keepbytecode
-    Do not delete all stale bytecode before running tests
-
--l test_root
---libdir test_root
-    Search for tests starting in the specified start directory
-    (useful for testing components being developed outside the main
-    "src" or "build" trees).
-
--L
---loop
-    Keep running the selected tests in a loop.  You may experience
-    memory leakage.
-
---module modfilter
-    Provide a module filter (see modfilter below)
-
--N n
---repeat n
-    Run the selected tests n times.
-
--m
--M  minimal GUI. See -U.
-
--P
---profile
-    Run the tests under hotshot and display the top 50 stats, sorted by
-    cumulative time and number of calls.
-
--p
---progress
-    Show running progress.  It can be combined with -v or -vv.
-
--r
---refcount
-    Look for refcount problems.
-    This requires that Python was built --with-pydebug.
-
--1
---report-only-first-doctest-failure
-
-   Report only the first failure in a doctest. (Examples after the
-   failure are still executed, in case they do any cleanup.)
-
--t
---top-fifty
-    Time the individual tests and print a list of the top 50, sorted from
-    longest to shortest.
-
---test testfilter
-    Provide a test filter (see testfilter below)
-
---times n
---times outfile
-    With an integer argument, time the tests and print a list of the top <n>
-    tests, sorted from longest to shortest.
-    With a non-integer argument, specifies a file to which timing information
-    is to be printed.
-
--T
---trace
-    Use the trace module from Python for code coverage.  The current
-    utility writes coverage files to a directory named `coverage' that
-    is parallel to `build'.  It also prints a summary to stdout.
-
--u
---skip-functional
-    CHANGED. Run unit tests but not functional tests.
-    Note that the meaning of -u is changed from its former meaning,
-    which is now specified by -U or --gui.
-
--U
---gui
-    Use the PyUnit GUI instead of output to the command line.  The GUI
-    imports tests on its own, taking care to reload all dependencies
-    on each run.  The debug (-d), verbose (-v), progress (-p), and
-    Loop (-L) options will be ignored.  The testfilter filter is also
-    not applied.
-
--m
--M
---minimal-gui
-    Note: -m is DEPRECATED in favour of -M or --minimal-gui.
-    -m starts the gui minimized.  Double-clicking the progress bar
-    will start the import and run all tests.
-
-
--v
---verbose
-    Verbose output.  With one -v, unittest prints a dot (".") for each
-    test run.  With -vv, unittest prints the name of each test (for
-    some definition of "name" ...).  With no -v, unittest is silent
-    until the end of the run, except when errors occur.
-
-    When -p is also specified, the meaning of -v is slightly
-    different.  With -p and no -v only the percent indicator is
-    displayed.  With -p and -v the test name of the current test is
-    shown to the right of the percent indicator.  With -p and -vv the
-    test name is not truncated to fit into 80 columns and it is not
-    cleared after the test finishes.
-
-
-modfilter
-testfilter...
-    Case-sensitive regexps to limit which tests are run, used in search
-    (not match) mode.
-    In an extension of Python regexp notation, a leading "!" is stripped
-    and causes the sense of the remaining regexp to be negated (so "!bc"
-    matches any string that does not match "bc", and vice versa).
-    By default these act like ".", i.e. nothing is excluded.
-
-    modfilter is applied to a test file's path, starting at "build" and
-    including (OS-dependent) path separators.  Additional modfilters
-    can be specified with the --module option; modules are matched if
-    they match at least one modfilter.
-
-    testfilter is applied to the (method) name of the unittest methods
-    contained in the test files whose paths modfilter matched.
-    Additional testfilters can be specified with the --test option;
-    methods are matched if they match at least one testfilter.
-
-Extreme (yet useful) examples:
-
-    test.py -vvb . "^testWriteClient$"
-
-    Builds the project silently, then runs unittest in verbose mode on all
-    tests whose names are precisely "testWriteClient".  Useful when
-    debugging a specific test.
-
-    test.py -vvb . "!^testWriteClient$"
-
-    As before, but runs all tests whose names aren't precisely
-    "testWriteClient".  Useful to avoid a specific failing test you don't
-    want to deal with just yet.
-
-    test.py -M . "!^testWriteClient$"
-
-    As before, but now opens up a minimized PyUnit GUI window (only showing
-    the progress bar).  Useful for refactoring runs where you continually want
-    to make sure all tests still pass.
-
-$Id$
-"""
-import gc
-import hotshot, hotshot.stats
-import logging
-import os
-import re
-import pdb
-import sys
-import threading    # just to get at Thread objects created by tests
-import time
-import traceback
-import unittest
-import warnings
-
-FTESTING = "ftesting.zcml"
-
-def set_trace_doctest(stdin=sys.stdin, stdout=sys.stdout, trace=pdb.set_trace):
-    sys.stdin = stdin
-    sys.stdout = stdout
-    trace()
-
-pdb.set_trace_doctest = set_trace_doctest
-
-from distutils.util import get_platform
-
-PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
-
-class ImmediateTestResult(unittest._TextTestResult):
-
-    __super_init = unittest._TextTestResult.__init__
-    __super_startTest = unittest._TextTestResult.startTest
-    __super_printErrors = unittest._TextTestResult.printErrors
-
-    def __init__(self, stream, descriptions, verbosity,
-                 count=None, progress=False):
-        self.__super_init(stream, descriptions, verbosity)
-        self._progress = progress
-        self._progressWithNames = False
-        self.count = count
-        self._testtimes = {}
-        if progress and verbosity == 1:
-            self.dots = False
-            self._progressWithNames = True
-            self._lastWidth = 0
-            self._maxWidth = 80
-            try:
-                import curses
-            except ImportError:
-                pass
-            else:
-                curses.setupterm()
-                self._maxWidth = curses.tigetnum('cols')
-            self._maxWidth -= len("xxxx/xxxx (xxx.x%): ") + 1
-
-    def stopTest(self, test):
-        self._testtimes[test] = time.time() - self._testtimes[test]
-        if gc.garbage:
-            print "The following test left garbage:"
-            print test
-            print gc.garbage
-            # XXX Perhaps eat the garbage here, so that the garbage isn't
-            #     printed for every subsequent test.
-
-        # Did the test leave any new threads behind?
-        new_threads = [t for t in threading.enumerate()
-                         if (t.isAlive()
-                             and
-                             t not in self._threads)]
-        if new_threads:
-            print "The following test left new threads behind:"
-            print test
-            print "New thread(s):", new_threads
-
-    def print_times(self, stream, count=None):
-        results = self._testtimes.items()
-        results.sort(lambda x, y: cmp(y[1], x[1]))
-        if count:
-            n = min(count, len(results))
-            if n:
-                print >>stream, "Top %d longest tests:" % n
-        else:
-            n = len(results)
-        if not n:
-            return
-        for i in range(n):
-            print >>stream, "%6dms" % int(results[i][1] * 1000), results[i][0]
-
-    def _print_traceback(self, msg, err, test, errlist):
-        if self.showAll or self.dots or self._progress:
-            self.stream.writeln("\n")
-            self._lastWidth = 0
-
-        tb = "".join(traceback.format_exception(*err))
-        self.stream.writeln(msg)
-        self.stream.writeln(tb)
-        errlist.append((test, tb))
-
-    def startTest(self, test):
-        if self._progress:
-            self.stream.write("\r%4d" % (self.testsRun + 1))
-            if self.count:
-                self.stream.write("/%d (%5.1f%%)" % (self.count,
-                                  (self.testsRun + 1) * 100.0 / self.count))
-            if self.showAll:
-                self.stream.write(": ")
-            elif self._progressWithNames:
-                # XXX will break with multibyte strings
-                name = self.getShortDescription(test)
-                width = len(name)
-                if width < self._lastWidth:
-                    name += " " * (self._lastWidth - width)
-                self.stream.write(": %s" % name)
-                self._lastWidth = width
-            self.stream.flush()
-        self._threads = threading.enumerate()
-
-        self.__super_startTest(test)
-        # the super version can't count. ;)
-        self.testsRun += test.countTestCases() - 1
-
-        self._testtimes[test] = time.time()
-
-
-    def getShortDescription(self, test):
-        s = self.getDescription(test)
-        if len(s) > self._maxWidth:
-            pos = s.find(" (")
-            if pos >= 0:
-                w = self._maxWidth - (pos + 5)
-                if w < 1:
-                    # first portion (test method name) is too long
-                    s = s[:self._maxWidth-3] + "..."
-                else:
-                    pre = s[:pos+2]
-                    post = s[-w:]
-                    s = "%s...%s" % (pre, post)
-        return s[:self._maxWidth]
-
-    def addError(self, test, err):
-        if self._progress:
-            self.stream.write("\r")
-        self._print_traceback("Error in test %s" % test, err,
-                              test, self.errors)
-
-    def addFailure(self, test, err):
-        if self._progress:
-            self.stream.write("\r")
-        self._print_traceback("Failure in test %s" % test, err,
-                              test, self.failures)
-
-    def printErrors(self):
-        if VERBOSE < 2:
-            # We'be output errors as they occured. Outputing them a second
-            # time is just annoying. 
-            return
-
-        if self._progress and not (self.dots or self.showAll):
-            self.stream.writeln()
-        self.__super_printErrors()
-
-    def printErrorList(self, flavor, errors):
-        for test, err in errors:
-            self.stream.writeln(self.separator1)
-            self.stream.writeln("%s: %s" % (flavor, self.getDescription(test)))
-            self.stream.writeln(self.separator2)
-            self.stream.writeln(err)
-
-
-class ImmediateTestRunner(unittest.TextTestRunner):
-
-    __super_init = unittest.TextTestRunner.__init__
-
-    def __init__(self, **kwarg):
-        progress = kwarg.get("progress")
-        if progress is not None:
-            del kwarg["progress"]
-        profile = kwarg.get("profile")
-        if profile is not None:
-            del kwarg["profile"]
-        self.__super_init(**kwarg)
-        self._progress = progress
-        self._profile = profile
-        # Create the test result here, so that we can add errors if
-        # the test suite search process has problems.  The count
-        # attribute must be set in run(), because we won't know the
-        # count until all test suites have been found.
-        self.result = ImmediateTestResult(
-            self.stream, self.descriptions, self.verbosity,
-            progress=self._progress)
-
-    def _makeResult(self):
-        # Needed base class run method.
-        return self.result
-
-    def run(self, test):
-        self.result.count = test.countTestCases()
-        if self._profile:
-            prof = hotshot.Profile("tests_profile.prof")
-            args = (self, test)
-            r = prof.runcall(unittest.TextTestRunner.run, *args)
-            prof.close()
-            stats = hotshot.stats.load("tests_profile.prof")
-            stats.sort_stats('cumulative', 'calls')
-            stats.print_stats(50)
-            return r
-        return unittest.TextTestRunner.run(self, test)
-
-# setup list of directories to put on the path
-class PathInit(object):
-    def __init__(self, build, build_inplace, libdir=None):
-        self.inplace = None
-        # Figure out if we should test in-place or test in-build.  If the -b
-        # or -B option was given, test in the place we were told to build in.
-        # Otherwise, we'll look for a build directory and if we find one,
-        # we'll test there, otherwise we'll test in-place.
-        if build:
-            self.inplace = build_inplace
-        if self.inplace is None:
-            # Need to figure it out
-            if os.path.isdir(os.path.join("build", "lib.%s" % PLAT_SPEC)):
-                self.inplace = False
-            else:
-                self.inplace = True
-        # Calculate which directories we're going to add to sys.path, and cd
-        # to the appropriate working directory
-        self.org_cwd = os.getcwd()
-        if self.inplace:
-            self.libdir = "src"
-        else:
-            self.libdir = "lib.%s" % PLAT_SPEC
-            os.chdir("build")
-        # Hack sys.path
-        self.cwd = os.getcwd()
-        sys.path.insert(0, os.path.join(self.cwd, self.libdir))
-        # Hack again for external products.
-        kind = functional and "FUNCTIONAL" or "UNIT"
-        if libdir:
-            extra = os.path.join(self.org_cwd, libdir)
-            print "Running %s tests from %s" % (kind, extra)
-            self.libdir = extra
-            sys.path.insert(0, extra)
-        else:
-            print "Running %s tests from %s" % (kind, self.cwd)
-
-def match(rxlist, s):
-    if not rxlist:
-        return True
-    for rx in rxlist:
-        if rx[0] == "!":
-            matched = re.search(rx[1:], s) is None
-        else:
-            matched = re.search(rx, s) is not None
-        if matched:
-            return True
-    return False
-
-class TestFileFinder(object):
-
-    EMPTY_FILE_LISTS = ([], ["{arch}"], ["CVS"], ["_darcs"], [".svn"])
-
-    def __init__(self, prefix):
-        self.files = []
-        self._plen = len(prefix)
-        if not prefix.endswith(os.sep):
-            self._plen += 1
-        if functional:
-            self.dirname = "ftests"
-        else:
-            self.dirname = "tests"
-
-    def visit(self, rx, dir, files):
-        if os.path.basename(dir) != self.dirname:
-            # Allow tests/ftests module rather than package.
-            modfname = self.dirname + '.py'
-            if modfname in files:
-                path = os.path.join(dir, modfname)
-                if match(rx, path):
-                    self.files.append(path)
-                    return
-            return
-        # ignore tests that aren't in packages
-        if "__init__.py" not in files:
-            if files in self.EMPTY_FILE_LISTS:
-                return
-            print "not a package", dir
-            return
-
-        # Put matching files in matches.  If matches is non-empty,
-        # then make sure that the package is importable.
-        matches = []
-        for file in files:
-            if file.startswith('test') and os.path.splitext(file)[-1] == '.py':
-                path = os.path.join(dir, file)
-                if match(rx, path):
-                    matches.append(path)
-
-        # ignore tests when the package can't be imported, possibly due to
-        # dependency failures.
-        pkg = dir[self._plen:].replace(os.sep, '.')
-        try:
-            __import__(pkg)
-        # We specifically do not want to catch ImportError since that's useful
-        # information to know when running the tests.
-        except RuntimeError, e:
-            if VERBOSE:
-                print "skipping %s because: %s" % (pkg, e)
-            return
-        else:
-            self.files.extend(matches)
-
-    def module_from_path(self, path):
-        """Return the Python package name indicated by the filesystem path."""
-        assert path.endswith(".py")
-        path = path[self._plen:-3]
-        mod = path.replace(os.sep, ".")
-        return mod
-
-def walk_with_symlinks(top, func, arg):
-    """Like os.path.walk, but follows symlinks on POSIX systems.
-
-    This could theoreticaly result in an infinite loop, if you create symlink
-    cycles in your Zope sandbox, so don't do that.
-    """
-    try:
-        names = os.listdir(top)
-    except os.error:
-        return
-    exceptions = ('.', '..', '{arch}', '.arch-ids')
-    names = [name for name in names
-             if name not in exceptions
-             if not name.startswith(',,')]
-    func(arg, top, names)
-    for name in names:
-        name = os.path.join(top, name)
-        if os.path.isdir(name):
-            walk_with_symlinks(name, func, arg)
-
-def find_test_dir(dir):
-    if os.path.exists(dir):
-        return dir
-    d = os.path.join(pathinit.libdir, dir)
-    if os.path.exists(d):
-        if os.path.isdir(d):
-            return d
-        raise ValueError("%s does not exist and %s is not a directory"
-                         % (dir, d))
-    raise ValueError("%s does not exist!" % dir)
-
-def find_tests(rx):
-    global finder
-    finder = TestFileFinder(pathinit.libdir)
-
-    if TEST_DIRS:
-        for d in TEST_DIRS:
-            d = find_test_dir(d)
-            walk_with_symlinks(d, finder.visit, rx)
-    else:
-        walk_with_symlinks(pathinit.libdir, finder.visit, rx)
-    return finder.files
-
-def package_import(modname):
-    __import__(modname)
-    return sys.modules[modname]
-
-class PseudoTestCase(object):
-    """Minimal test case objects to create error reports.
-
-    If test.py finds something that looks like it should be a test but
-    can't load it or find its test suite, it will report an error
-    using a PseudoTestCase.
-    """
-
-    def __init__(self, name, descr=None):
-        self.name = name
-        self.descr = descr
-
-    def shortDescription(self):
-        return self.descr
-
-    def __str__(self):
-        return "Invalid Test (%s)" % self.name
-
-def get_suite(file, result=None):
-    modname = finder.module_from_path(file)
-    try:
-        mod = package_import(modname)
-        return mod.test_suite()
-    except:
-        if result is not None:
-            result.addError(PseudoTestCase(modname), sys.exc_info())
-            return None
-        raise
-
-def filter_testcases(s, rx):
-    new = unittest.TestSuite()
-    for test in s._tests:
-        # See if the levels match
-        dolevel = (LEVEL == 0) or LEVEL >= getattr(test, "level", 0)
-        if not dolevel:
-            continue
-        if isinstance(test, unittest.TestCase):
-            name = test.id() # Full test name: package.module.class.method
-            name = name[1 + name.rfind("."):] # extract method name
-            if not rx or match(rx, name):
-                new.addTest(test)
-        else:
-            filtered = filter_testcases(test, rx)
-            if filtered:
-                new.addTest(filtered)
-    return new
-
-def gui_runner(files, test_filter):
-    if BUILD_INPLACE:
-        utildir = os.path.join(os.getcwd(), "utilities")
-    else:
-        utildir = os.path.join(os.getcwd(), "..", "utilities")
-    sys.path.append(utildir)
-    import unittestgui
-    suites = []
-    for file in files:
-        suites.append(finder.module_from_path(file) + ".test_suite")
-
-    suites = ", ".join(suites)
-    minimal = (GUI == "minimal")
-    unittestgui.main(suites, minimal)
-
-class TrackRefs(object):
-    """Object to track reference counts across test runs."""
-
-    def __init__(self):
-        self.type2count = {}
-        self.type2all = {}
-
-    def update(self):
-        obs = sys.getobjects(0)
-        type2count = {}
-        type2all = {}
-        for o in obs:
-            all = sys.getrefcount(o)
-
-            if type(o) is str and o == '<dummy key>':
-                # avoid dictionary madness
-                continue
-            t = type(o)
-            if t in type2count:
-                type2count[t] += 1
-                type2all[t] += all
-            else:
-                type2count[t] = 1
-                type2all[t] = all
-
-        ct = [(type2count[t] - self.type2count.get(t, 0),
-               type2all[t] - self.type2all.get(t, 0),
-               t)
-              for t in type2count.iterkeys()]
-        ct.sort()
-        ct.reverse()
-        printed = False
-        for delta1, delta2, t in ct:
-            if delta1 or delta2:
-                if not printed:
-                    print "%-55s %8s %8s" % ('', 'insts', 'refs')
-                    printed = True
-                print "%-55s %8d %8d" % (t, delta1, delta2)
-
-        self.type2count = type2count
-        self.type2all = type2all
-
-def print_doctest_location(err):
-    # This mimicks pdb's output, which gives way cool results in emacs :)
-    filename = err.test.filename
-    if filename.endswith('.pyc'):
-        filename = filename[:-1]
-    print "> %s(%s)_()" % (filename, err.test.lineno+err.example.lineno+1)
-
-def post_mortem(exc_info):
-    from zope.testing import doctest
-    err = exc_info[1]
-    if isinstance(err, (doctest.UnexpectedException, doctest.DocTestFailure)):
-
-        if isinstance(err, doctest.UnexpectedException):
-            exc_info = err.exc_info
-
-            # Print out location info if the error was in a doctest
-            if exc_info[2].tb_frame.f_code.co_filename == '<string>':
-                print_doctest_location(err)
-            
-        else:
-            print_doctest_location(err)
-            # Hm, we have a DocTestFailure exception.  We need to
-            # generate our own traceback
-            try:
-                exec ('raise ValueError'
-                      '("Expected and actual output are different")'
-                      ) in err.test.globs
-            except:
-                exc_info = sys.exc_info()
-        
-    print "%s:" % (exc_info[0], )
-    print exc_info[1]
-    pdb.post_mortem(exc_info[2])
-    sys.exit()
-
-def run_debug(test_or_suite, verbosity):
-    if isinstance(test_or_suite, unittest.TestCase):
-        # test
-        if verbosity > 1:
-            print test_or_suite
-        elif verbosity > 0:
-            print '.',
-
-        try:
-            test_or_suite.debug()
-        except:
-            if DEBUGGER:
-                post_mortem(sys.exc_info())
-            raise
-        return 1
-
-    else:
-        r = 0
-        for t in test_or_suite._tests: # Ick _tests
-            r += run_debug(t, verbosity)
-        return r
-            
-def runner(files, test_filter, debug):
-
-    if DEBUG:
-        runner = result = None 
-    else:
-        runner = ImmediateTestRunner(verbosity=VERBOSE,
-                                     progress=PROGRESS, profile=PROFILE,
-                                     descriptions=False)
-        result = runner.result
-
-    suite = unittest.TestSuite()
-    for file in files:
-        try:
-            s = get_suite(file, result)
-        except:
-            if DEBUGGER:
-                post_mortem(sys.exc_info())
-            raise
-            
-        # See if the levels match
-        dolevel = (LEVEL == 0) or LEVEL >= getattr(s, "level", 0)
-        if s is not None and dolevel:
-            s = filter_testcases(s, test_filter)
-            suite.addTest(s)
-
-    if DEBUG:
-        print "Ran %s tests in debug mode" % run_debug(suite, VERBOSE)
-        return 0
-
-    r = runner.run(suite)
-    if TIMESFN:
-        r.print_times(open(TIMESFN, "w"))
-        if VERBOSE:
-            print "Wrote timing data to", TIMESFN
-    if TIMETESTS:
-        r.print_times(sys.stdout, TIMETESTS)
-    numbad = len(result.failures) + len(result.errors)
-    return numbad
-
-def remove_stale_bytecode(arg, dirname, names):
-    names = map(os.path.normcase, names)
-    for name in names:
-        if name.endswith(".pyc") or name.endswith(".pyo"):
-            srcname = name[:-1]
-            if srcname not in names:
-                fullname = os.path.join(dirname, name)
-                print "Removing stale bytecode file", fullname
-                os.unlink(fullname)
-
-def main(module_filter, test_filter, libdir):
-    if not KEEP_STALE_BYTECODE:
-        os.path.walk(os.curdir, remove_stale_bytecode, None)
-
-    configure_logging()
-
-    # Initialize the path and cwd
-    global pathinit
-    pathinit = PathInit(BUILD, BUILD_INPLACE, libdir)
-
-    files = find_tests(module_filter)
-    if not files:
-        print ("No %s tests to be run."
-               % (functional and "functional" or "unit"))
-        return
-    files.sort()
-
-    # Make sure functional tests find ftesting.zcml
-    if functional:
-        config_file = FTESTING
-        if not pathinit.inplace:
-            # We chdired into build, so ftesting.zcml is in the
-            # parent directory
-            config_file = os.path.join('..', FTESTING)
-        print "Parsing %s" % config_file
-        from zope.app.tests.functional import FunctionalTestSetup
-        FunctionalTestSetup(config_file)
-
-    numbad = 0
-    if GUI:
-        gui_runner(files, test_filter)
-    elif LOOP:
-        if REFCOUNT:
-            rc = sys.gettotalrefcount()
-            track = TrackRefs()
-
-        n = LOOP
-        i = 1
-        while i <= n:
-            print
-            print "Run %s:" % i
-            i += 1;
-            numbad = runner(files, test_filter, DEBUG)
-            gc.collect()
-            if gc.garbage:
-                print "GARBAGE:", len(gc.garbage), gc.garbage
-                return numbad
-
-            if REFCOUNT:
-                prev = rc
-                rc = sys.gettotalrefcount()
-                print "totalrefcount=%-8d change=%-6d" % (rc, rc - prev)
-                track.update()
-    else:
-        numbad = runner(files, test_filter, DEBUG)
-
-    os.chdir(pathinit.org_cwd)
-    return numbad
-
-
-def configure_logging():
-    """Initialize the logging module."""
-    import logging.config
-
-    # Get the log.ini file from the current directory instead of possibly
-    # buried in the build directory.  XXX This isn't perfect because if
-    # log.ini specifies a log file, it'll be relative to the build directory.
-    # Hmm...
-    logini = os.path.abspath("log.ini")
-
-    if os.path.exists(logini):
-        logging.config.fileConfig(logini)
-    else:
-        # If there's no log.ini, cause the logging package to be
-        # silent during testing.
-        root = logging.getLogger()
-        root.addHandler(NullHandler())
-        logging.basicConfig()
-
-    if os.environ.has_key("LOGGING"):
-        level = int(os.environ["LOGGING"])
-        logging.getLogger().setLevel(level)
-
-
-class NullHandler(logging.Handler):
-    """Logging handler that drops everything on the floor.
-
-    We require silence in the test environment.  Hush.
-    """
-
-    def emit(self, record):
-        pass
-
-
-def process_args(argv=None):
-    import getopt
-    global MODULE_FILTER
-    global TEST_FILTER
-    global VERBOSE
-    global LOOP
-    global GUI
-    global TRACE
-    global REFCOUNT
-    global DEBUG
-    global DEBUGGER
-    global BUILD
-    global LEVEL
-    global LIBDIR
-    global TIMESFN
-    global TIMETESTS
-    global PROGRESS
-    global BUILD_INPLACE
-    global KEEP_STALE_BYTECODE
-    global TEST_DIRS
-    global PROFILE
-    global GC_THRESHOLD
-    global GC_FLAGS
-    global RUN_UNIT
-    global RUN_FUNCTIONAL
-    global PYCHECKER
-    global REPORT_ONLY_FIRST_DOCTEST_FAILURE
-
-    if argv is None:
-        argv = sys.argv
-
-    MODULE_FILTERS = []
-    TEST_FILTERS = []
-    VERBOSE = 0
-    LOOP = 0
-    GUI = False
-    TRACE = False
-    REFCOUNT = False
-    DEBUG = False # Don't collect test results; simply let tests crash
-    DEBUGGER = False
-    BUILD = False
-    BUILD_INPLACE = False
-    GC_THRESHOLD = None
-    gcdebug = 0
-    GC_FLAGS = []
-    LEVEL = 1
-    LIBDIR = None
-    PROGRESS = False
-    TIMESFN = None
-    TIMETESTS = 0
-    KEEP_STALE_BYTECODE = 0
-    RUN_UNIT = True
-    RUN_FUNCTIONAL = True
-    TEST_DIRS = []
-    PROFILE = False
-    PYCHECKER = False
-    REPORT_ONLY_FIRST_DOCTEST_FAILURE = False
-    config_filename = 'test.config'
-
-    # import the config file
-    if os.path.isfile(config_filename):
-        print 'Configuration file found.'
-        execfile(config_filename, globals())
-
-
-    try:
-        opts, args = getopt.gnu_getopt(argv[1:],
-                                   "a:bBcdDfFg:G:hkl:LmMPprs:tTuUvN:1",
-                                   ["all", "help", "libdir=", "times=",
-                                    "keepbytecode", "dir=", "build",
-                                    "build-inplace",
-                                    "at-level=",
-                                    "pychecker", "debug", "pdebug",
-                                    "gc-threshold=", "gc-option=",
-                                    "loop", "gui", "minimal-gui",
-                                    "test=", "module=",
-                                    "profile", "progress", "refcount", "trace",
-                                    "top-fifty", "verbose", "repeat=",
-                                    "report-only-first-doctest-failure",
-                                    ])
-    # fixme: add the long names
-    # fixme: add the extra documentation
-    # fixme: test for functional first!
-    except getopt.error, msg:
-        print msg
-        print "Try `python %s -h' for more information." % argv[0]
-        sys.exit(2)
-
-    for k, v in opts:
-        if k in ("-a", "--at-level"):
-            LEVEL = int(v)
-        elif k == "--all":
-            LEVEL = 0
-            os.environ["COMPLAIN_IF_TESTS_MISSED"]='1'
-        elif k in ("-b", "--build"):
-            BUILD = True
-        elif k in ("-B", "--build-inplace"):
-            BUILD = BUILD_INPLACE = True
-        elif k in("-c", "--pychecker"):
-            PYCHECKER = True
-        elif k in ("-d", "--debug"):
-            DEBUG = True
-        elif k in ("-D", "--pdebug"):
-            DEBUG = True
-            DEBUGGER = True
-        elif k in ("-f", "--skip-unit"):
-            RUN_UNIT = False
-        elif k in ("-u", "--skip-functional"):
-            RUN_FUNCTIONAL = False
-        elif k == "-F":
-            message = 'Unit plus functional is the default behaviour.'
-            warnings.warn(message, DeprecationWarning)
-            RUN_UNIT = True
-            RUN_FUNCTIONAL = True
-        elif k in ("-h", "--help"):
-            print __doc__
-            sys.exit(0)
-        elif k in ("-g", "--gc-threshold"):
-            GC_THRESHOLD = int(v)
-        elif k in ("-G", "--gc-option"):
-            if not v.startswith("DEBUG_"):
-                print "-G argument must be DEBUG_ flag, not", repr(v)
-                sys.exit(1)
-            GC_FLAGS.append(v)
-        elif k in ('-k', '--keepbytecode'):
-            KEEP_STALE_BYTECODE = 1
-        elif k in ('-l', '--libdir'):
-            LIBDIR = v
-        elif k in ("-L", "--loop"):
-            LOOP = 1000000000
-        elif k in ("-N", "--repeat"):
-            LOOP = int(v)
-        elif k == "-m":
-            GUI = "minimal"
-            msg = "Use -M or --minimal-gui instead of -m."
-            warnings.warn(msg, DeprecationWarning)
-        elif k in ("-M", "--minimal-gui"):
-            GUI = "minimal"
-        elif k in ("-P", "--profile"):
-            PROFILE = True
-        elif k in ("-p", "--progress"):
-            PROGRESS = True
-        elif k in ("-r", "--refcount"):
-                REFCOUNT = True
-        elif k in ("-T", "--trace"):
-            TRACE = True
-        elif k in ("-t", "--top-fifty"):
-            if not TIMETESTS:
-                TIMETESTS = 50
-        elif k in ("-U", "--gui"):
-            GUI = 1
-        elif k in ("-1", "--report-only-first-doctest-failure"):
-            REPORT_ONLY_FIRST_DOCTEST_FAILURE = True
-        elif k in ("-v", "--verbose"):
-            VERBOSE += 1
-        elif k == "--times":
-            try:
-                TIMETESTS = int(v)
-            except ValueError:
-                # must be a filename to write
-                TIMESFN = v
-        elif k in ('-s', '--dir'):
-            TEST_DIRS.append(v)
-        elif k == "--test":
-            TEST_FILTERS.append(v)
-        elif k == "--module":
-            MODULE_FILTERS.append(v)
-
-    if PYCHECKER:
-        # make sure you have a recent version of pychecker
-        if not os.environ.get("PYCHECKER"):
-            os.environ["PYCHECKER"] = "-q"
-        import pychecker.checker
-
-    if REFCOUNT and not hasattr(sys, "gettotalrefcount"):
-        print "-r ignored, because it needs a debug build of Python"
-        REFCOUNT = False
-
-    if sys.version_info < ( 2,3,4 ):
-        print """\
-        ERROR: Your python version is not supported by Zope3.
-        Zope3 needs Python 2.3.4 or greater. You are running:""" + sys.version
-        sys.exit(1)
-
-    if REPORT_ONLY_FIRST_DOCTEST_FAILURE:
-        import zope.testing.doctest
-        zope.testing.doctest.set_unittest_reportflags(
-            zope.testing.doctest.REPORT_ONLY_FIRST_FAILURE)
-        import doctest
-        if hasattr(doctest, 'REPORT_ONLY_FIRST_FAILURE'):
-            doctest.set_unittest_reportflags(doctest.REPORT_ONLY_FIRST_FAILURE)
-
-    if GC_THRESHOLD is not None:
-        if GC_THRESHOLD == 0:
-            gc.disable()
-            print "gc disabled"
-        else:
-            gc.set_threshold(GC_THRESHOLD)
-            print "gc threshold:", gc.get_threshold()
-
-    if GC_FLAGS:
-        val = 0
-        for flag in GC_FLAGS:
-            v = getattr(gc, flag, None)
-            if v is None:
-                print "Unknown gc flag", repr(flag)
-                print gc.set_debug.__doc__
-                sys.exit(1)
-            val |= v
-        gcdebug |= v
-
-    if gcdebug:
-        gc.set_debug(gcdebug)
-
-    if BUILD:
-        # Python 2.3 is more sane in its non -q output
-        if sys.hexversion >= 0x02030000:
-            qflag = ""
-        else:
-            qflag = "-q"
-        cmd = sys.executable + " setup.py " + qflag + " build"
-        if BUILD_INPLACE:
-            cmd += "_ext -i"
-        if VERBOSE:
-            print cmd
-        sts = os.system(cmd)
-        if sts:
-            print "Build failed", hex(sts)
-            sys.exit(1)
-
-    k = []
-    if RUN_UNIT:
-        k.append(False)
-    if RUN_FUNCTIONAL:
-        k.append(True)
-
-    global functional
-    numbad = 0
-    for functional in k:
-
-        if VERBOSE:
-            kind = functional and "FUNCTIONAL" or "UNIT"
-            if LEVEL == 0:
-                print "Running %s tests at all levels" % kind
-            else:
-                print "Running %s tests at level %d" % (kind, LEVEL)
-
-# This was to avoid functional tests outside of z3, but this doesn't really
-# work right.
-##         if functional:
-##             try:
-##                 from zope.app.tests.functional import FunctionalTestSetup
-##             except ImportError:
-##                 raise
-##                 print ('Skipping functional tests: could not import '
-##                        'zope.app.tests.functional')
-##                 continue
-
-        # XXX We want to change *visible* warnings into errors.  The next
-        # line changes all warnings into errors, including warnings we
-        # normally never see.  In particular, test_datetime does some
-        # short-integer arithmetic that overflows to long ints, and, by
-        # default, Python doesn't display the overflow warning that can
-        # be enabled when this happens.  The next line turns that into an
-        # error instead.  Guido suggests that a better to get what we're
-        # after is to replace warnings.showwarning() with our own thing
-        # that raises an error.
-        ## warnings.filterwarnings("error")
-        warnings.filterwarnings("ignore", module="logging")
-
-        if args:
-            if len(args) > 1:
-                TEST_FILTERS.extend(args[1:])
-            MODULE_FILTERS.append(args[0])
-        try:
-            if TRACE:
-                # if the trace module is used, then we don't exit with
-                # status if on a false return value from main.
-                coverdir = os.path.join(os.getcwd(), "coverage")
-                import trace
-                ignoremods = ["os", "posixpath", "stat"]
-                tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
-                                     ignoremods=ignoremods,
-                                     trace=False, count=True)
-
-                # we don't get the result from main() from runctx()
-                tracer.runctx("main(MODULE_FILTERS, TEST_FILTERS, LIBDIR)",
-                              globals=globals(), locals=vars())
-                r = tracer.results()
-                path = "/tmp/trace.%s" % os.getpid()
-                import cPickle
-                f = open(path, "wb")
-                cPickle.dump(r, f)
-                f.close()
-                print path
-                r.write_results(show_missing=True,
-                                summary=True, coverdir=coverdir)
-            else:
-                bad = main(MODULE_FILTERS, TEST_FILTERS, LIBDIR)
-                if bad:
-                    numbad += bad
-        except ImportError, err:
-            print err
-            print sys.path
-            raise
-
-    if numbad:
-        sys.exit(1)
-
-
-def test_suite():
-    """Return an empty test suite to avoid complaints about this
-    module not having a 'test_suite' attribute."""
-    return unittest.TestSuite()
-
-
-if __name__ == "__main__":
-    process_args()

Deleted: Zope3/trunk/src/zope/app/tests/test_dochttp.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test_dochttp.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/test_dochttp.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,132 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test tcpdoc
-
-$Id$
-"""
-import os
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-import zope.app.tests
-from zope.app.tests.dochttp import dochttp
-
-directory = os.path.join(os.path.split(zope.app.tests.__file__)[0], 'recorded')
-
-
-expected = r'''
-
-  >>> print http(r"""
-  ... GET /@@contents.html HTTP/1.1
-  ... """)
-  HTTP/1.1 401 Unauthorized
-  Content-Length: 89
-  Content-Type: text/html;charset=utf-8
-  Www-Authenticate: basic realm=zope
-  <BLANKLINE>
-  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
-        lang="en">
-  <BLANKLINE>
-  ...
-  <BLANKLINE>
-  </html>
-  <BLANKLINE>
-  <BLANKLINE>
-
-
-  >>> print http(r"""
-  ... GET /@@contents.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... """)
-  HTTP/1.1 200 Ok
-  Content-Length: 89
-  Content-Type: text/html;charset=utf-8
-  <BLANKLINE>
-  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
-        lang="en">
-  <BLANKLINE>
-  ...
-  <BLANKLINE>
-  </html>
-  <BLANKLINE>
-  <BLANKLINE>
-
-
-  >>> print http(r"""
-  ... GET /++etc++site/@@manage HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Referer: http://localhost:8081/
-  ... """)
-  HTTP/1.1 303 See Other
-  Content-Length: 0
-  Content-Type: text/plain;charset=utf-8
-  Location: @@tasks.html
-  <BLANKLINE>
-
-
-  >>> print http(r"""
-  ... GET / HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... """)
-  HTTP/1.1 200 Ok
-  Content-Length: 89
-  Content-Type: text/html;charset=utf-8
-  <BLANKLINE>
-  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
-        lang="en">
-  <BLANKLINE>
-  ...
-  <BLANKLINE>
-  </html>
-  <BLANKLINE>
-  <BLANKLINE>
-
-
-  >>> print http(r"""
-  ... GET /++etc++site/@@tasks.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Referer: http://localhost:8081/
-  ... """)
-  HTTP/1.1 200 Ok
-  Content-Length: 89
-  Content-Type: text/html;charset=utf-8
-  <BLANKLINE>
-  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
-        lang="en">
-  <BLANKLINE>
-  ...
-  <BLANKLINE>
-  </html>
-  <BLANKLINE>
-  <BLANKLINE>
-'''
-      
-class Test(unittest.TestCase):
-
-    def test_dochttp(self):
-        import sys, StringIO
-        old = sys.stdout
-        sys.stdout = StringIO.StringIO()
-        dochttp(['-p', 'test', directory])
-        got = sys.stdout.getvalue()
-        sys.stdout = old
-        self.assert_(got == expected)
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(Test))
-    return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')
-

Deleted: Zope3/trunk/src/zope/app/tests/test_functional.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test_functional.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/test_functional.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,93 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Tests for zope.app.tests.functional."""
-
-import StringIO
-import unittest
-
-import zope.app.tests.functional
-
-
-HEADERS = """\
-HTTP/1.1 200 Ok
-Content-Type: text/plain
-"""
-
-BODY = """\
-This is the response body.
-"""
-
-class DocResponseWrapperTestCase(unittest.TestCase):
-
-    def setUp(self):
-        self.body_output = StringIO.StringIO()
-        self.path = "/foo/bar/"
-        self.response = object()
-
-        self.wrapper = zope.app.tests.functional.DocResponseWrapper(
-            self.response, self.body_output, self.path, HEADERS)
-
-    def test__str__(self):
-        self.assertEqual(str(self.wrapper),
-                         HEADERS + "\n")
-        self.body_output.write(BODY)
-        self.assertEqual(str(self.wrapper),
-                         "%s\n\n%s" % (HEADERS, BODY))
-
-    def test_getBody(self):
-        self.assertEqual(self.wrapper.getBody(), "")
-        self.body_output.write(BODY)
-        self.assertEqual(self.wrapper.getBody(), BODY)
-
-    def test_getOutput(self):
-        self.assertEqual(self.wrapper.getOutput(), "")
-        self.body_output.write(BODY)
-        self.assertEqual(self.wrapper.getOutput(), BODY)
-
-class AuthHeaderTestCase(unittest.TestCase):
-
-    def test_auth_encoded(self):
-        auth_header = zope.app.tests.functional.auth_header
-        header = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
-        self.assertEquals(auth_header(header), header)
-
-    def test_auth_non_encoded(self):
-        auth_header = zope.app.tests.functional.auth_header
-        header = 'Basic globalmgr:globalmgrpw'
-        expected = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
-        self.assertEquals(auth_header(header), expected)
-
-    def test_auth_non_encoded_empty(self):
-        auth_header = zope.app.tests.functional.auth_header
-        header = 'Basic globalmgr:'
-        expected = 'Basic Z2xvYmFsbWdyOg=='
-        self.assertEquals(auth_header(header), expected)
-        header = 'Basic :pass'
-        expected = 'Basic OnBhc3M='
-        self.assertEquals(auth_header(header), expected)
-
-    def test_auth_non_encoded_colon(self):
-        auth_header = zope.app.tests.functional.auth_header
-        header = 'Basic globalmgr:pass:pass'
-        expected = 'Basic Z2xvYmFsbWdyOnBhc3M6cGFzcw=='
-        self.assertEquals(auth_header(header), expected)
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(DocResponseWrapperTestCase))
-    suite.addTest(unittest.makeSuite(AuthHeaderTestCase))
-    return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Deleted: Zope3/trunk/src/zope/app/tests/ztapi.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/ztapi.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tests/ztapi.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,101 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Testing helper functions
-
-$Id$
-"""
-import zope.interface
-from zope.component.interfaces import IDefaultViewName
-from zope.publisher.browser import IBrowserRequest
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from zope.app import zapi
-from zope.app.traversing.interfaces import ITraversable
-
-def provideView(for_, type, providing, name, factory, layer=None):
-    if layer is None:
-        layer = type
-    provideAdapter(for_, providing, factory, name, (layer,))    
-
-def provideMultiView(for_, type, providing, name, factory, layer=None):
-    if layer is None:
-        layer = type
-    provideAdapter(for_[0], providing, factory, name, tuple(for_[1:])+(layer,))
-
-def browserView(for_, name, factory, layer=IDefaultBrowserLayer,
-                providing=zope.interface.Interface):
-    """Define a global browser view
-    """
-    if isinstance(factory, (list, tuple)):
-        raise ValueError("Factory cannot be a list or tuple")
-    provideAdapter(for_, providing, factory, name, (layer,))
-
-def browserViewProviding(for_, factory, providing, layer=IDefaultBrowserLayer):
-    """Define a view providing a particular interface."""
-    if isinstance(factory, (list, tuple)):
-        raise ValueError("Factory cannot be a list or tuple")
-    return browserView(for_, '', factory, layer, providing)
-
-def browserResource(name, factory, layer=IDefaultBrowserLayer,
-                    providing=zope.interface.Interface):
-    """Define a global browser view
-    """
-    if isinstance(factory, (list, tuple)):
-        raise ValueError("Factory cannot be a list or tuple")
-    provideAdapter((layer,), providing, factory, name)
-
-def setDefaultViewName(for_, name, layer=IDefaultBrowserLayer,
-                       type=IBrowserRequest):
-    if layer is None:
-        layer = type
-    s = zapi.getGlobalServices().getService(zapi.servicenames.Adapters)
-    s.register((for_, layer), IDefaultViewName, '', name)
-
-stypes = list, tuple
-def provideAdapter(required, provided, factory, name='', with=()):
-    if isinstance(factory, (list, tuple)):
-        raise ValueError("Factory cannot be a list or tuple")
-    s = zapi.getGlobalServices().getService(zapi.servicenames.Adapters)
-
-    if with:
-        required = (required, ) + tuple(with)
-    elif not isinstance(required, stypes):
-        required = (required,)
-
-    s.register(required, provided, name, factory)
-
-def subscribe(required, provided, factory):
-    s = zapi.getGlobalServices().getService(zapi.servicenames.Adapters)
-    s.subscribe(required, provided, factory)
-
-def handle(required, handler):
-    subscribe(required, None, handler)
-
-def provideUtility(provided, component, name=''):
-    s = zapi.getGlobalServices().getService(zapi.servicenames.Utilities)
-    s.provideUtility(provided, component, name)
-
-def unprovideUtility(provided, name=''):
-    s = zapi.getGlobalServices().getService(zapi.servicenames.Utilities)
-    s.register((), provided, name, None)
-
-def provideNamespaceHandler(name, handler):
-    provideAdapter(None, ITraversable, handler, name=name)
-    provideView(None, None, ITraversable, name, handler)
-
-def provideService(name, service, interface=None):
-    services = zapi.getGlobalServices()
-    if interface is not None:
-        services.defineService(name, interface)
-    services.provideService(name, service)
-    

Modified: Zope3/trunk/src/zope/app/traversing/browser/absoluteurl.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/browser/absoluteurl.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/browser/absoluteurl.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,14 +16,14 @@
 $Id$
 """
 import urllib
+from zope.interface import implements
+from zope.proxy import sameProxiedObjects
+from zope.publisher.browser import IBrowserRequest
 
+import zope.component as capi
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.component import getViewProviding, getView
 from zope.app.publisher.browser import BrowserView
 from zope.app.traversing.browser.interfaces import IAbsoluteURL
-from zope.interface import implements
-from zope.proxy import sameProxiedObjects
-from zope.publisher.browser import IBrowserRequest
 
 _insufficientContext = _("There isn't enough context to get URL information. "
                        "This is probably due to a bug in setting up location "
@@ -32,7 +32,7 @@
 _safe = '@+' # Characters that we don't want to have quoted
 
 def absoluteURL(ob, request):
-    return str(getViewProviding(ob, IAbsoluteURL, request))
+    return capi.getMultiAdapter((ob, request), IAbsoluteURL)()
 
 class AbsoluteURL(BrowserView):
     implements(IAbsoluteURL)
@@ -54,7 +54,8 @@
         if container is None:
             raise TypeError, _insufficientContext
 
-        url = str(getView(container, 'absolute_url', request))
+        url = str(capi.getMultiAdapter((container, request),
+                                       name='absolute_url'))
         name = self._getContextName(context)
         if name is None:
             raise TypeError, _insufficientContext
@@ -82,7 +83,8 @@
                isinstance(context, Exception):
             return ({'name':'', 'url': self.request.getApplicationURL()}, )
 
-        base = tuple(getView(container, 'absolute_url', request).breadcrumbs())
+        base = tuple(capi.getMultiAdapter((container, request),
+                                          name='absolute_url').breadcrumbs())
 
         name = getattr(context, '__name__', None)
         if name is None:

Modified: Zope3/trunk/src/zope/app/traversing/browser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/browser/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/browser/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,12 +16,13 @@
 $Id$
 """
 from unittest import TestCase, main, makeSuite
+
+from zope.app import zapi
 from zope.app.container.contained import contained
-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.traversing.browser.absoluteurl import absoluteURL
 from zope.app.traversing.browser.interfaces import IAbsoluteURL
-from zope.component import getService, getView
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.interface import Interface, implements
 from zope.interface.verify import verifyObject
@@ -52,19 +53,19 @@
     def test_interface(self):
         request = TestRequest()
         content = contained(TrivialContent(), Root(), name='a')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         
         verifyObject(IAbsoluteURL, view)
 
     def testBadObject(self):
         request = TestRequest()
-        view = getView(42, 'absolute_url', request)
+        view = zapi.getMultiAdapter((42, request), name='absolute_url')
         self.assertRaises(TypeError, view.__str__)
         self.assertRaises(TypeError, absoluteURL, 42, request)
 
     def testNoContext(self):
         request = TestRequest()
-        view = getView(Root(), 'absolute_url', request)
+        view = zapi.getMultiAdapter((Root(), request), name='absolute_url')
         self.assertEqual(str(view), 'http://127.0.0.1')
         self.assertEqual(absoluteURL(Root(), request), 'http://127.0.0.1')
 
@@ -74,7 +75,7 @@
         content = contained(TrivialContent(), Root(), name='a')
         content = contained(TrivialContent(), content, name='b')
         content = contained(TrivialContent(), content, name='c')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         self.assertEqual(str(view), 'http://127.0.0.1/a/b/c')
         self.assertEqual(absoluteURL(content, request),
                          'http://127.0.0.1/a/b/c')
@@ -96,7 +97,7 @@
         content = contained(TrivialContent(), root, name=u'\u0442')
         content = contained(TrivialContent(), content, name=u'\u0435')
         content = contained(TrivialContent(), content, name=u'\u0441')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         self.assertEqual(str(view),
                          'http://127.0.0.1/%D0%B9/%D1%82/%D0%B5/%D1%81')
         self.assertEqual(view(),
@@ -127,7 +128,7 @@
         content = contained(TrivialContent(), Root(), name='a')
         content = contained(TrivialContent(), content, name='b')
         content = contained(TrivialContent(), content, name='c')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         base = 'http://127.0.0.1/++skin++test'
         self.assertEqual(str(view), base + '/a/b/c')
 
@@ -148,7 +149,7 @@
         request._vh_root = content
         content = contained(TrivialContent(), content, name='b')
         content = contained(TrivialContent(), content, name='c')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         self.assertEqual(str(view), 'http://127.0.0.1/b/c')
 
         breadcrumbs = view.breadcrumbs()
@@ -166,7 +167,7 @@
         request._vh_root = content
         content = contained(TrivialContent(), content, name='b')
         content = contained(TrivialContent(), content, name='c')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         self.assertEqual(str(view), 'http://127.0.0.1/b/c')
 
         breadcrumbs = view.breadcrumbs()
@@ -185,7 +186,7 @@
         content = contained(TrivialContent(), content, name='a')
         content = contained(TrivialContent(), content, name='b')
         content = contained(TrivialContent(), content, name='c')
-        view = getView(content, 'absolute_url', request)
+        view = zapi.getMultiAdapter((content, request), name='absolute_url')
         self.assertEqual(str(view), 'http://127.0.0.1/a/b/c')
 
         breadcrumbs = view.breadcrumbs()

Modified: Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +16,7 @@
 $Id$
 """
 import unittest
-from zope.app.tests import ztapi
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing import ztapi, functional
 from zope.app.folder import Folder
 from transaction import get_transaction
 from zope.app.publisher.browser.resource import Resource
@@ -32,7 +31,7 @@
 
 defineChecker(MyObj, NoProxy)
 
-class TestVirtualHosting(BrowserTestCase):
+class TestVirtualHosting(functional.BrowserTestCase):
 
     def test_request_url(self):
         self.addPage('/pt', u'<span tal:replace="request/URL"/>')

Modified: Zope3/trunk/src/zope/app/traversing/namespace.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/namespace.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/namespace.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,16 +17,16 @@
 """
 import re
 
+import zope.component as capi
+import zope.interface
 from zope.component.exceptions import ComponentLookupError
-import zope.interface
 from zope.interface import providedBy, directlyProvides, directlyProvidedBy
-from zope import component
-from zope.app.traversing.interfaces import TraversalError
 from zope.publisher.interfaces.browser import ISkin
 from zope.security.proxy import removeSecurityProxy
 
 from zope.app.publisher.browser import applySkin
 from zope.app.traversing.interfaces import ITraversable, IPathAdapter
+from zope.app.traversing.interfaces import TraversalError
 
 # BBB Backward Compatibility
 from zope.exceptions import NotFoundError
@@ -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
@@ -81,7 +81,7 @@
 
        We'll get the same thing if we provide a request:
 
-         >>> from zope.publisher.browser import TestRequest
+       >>> from zope.publisher.browser import TestRequest
          >>> request = TestRequest()
          >>> namespaceLookup('foo', 'bar', C(), request)
          Traceback (most recent call last):
@@ -104,10 +104,10 @@
        """
 
     if request is not None:
-        traverser = component.queryView(object, ns, request,
-                                        providing=ITraversable)
+        traverser = capi.queryMultiAdapter((object, request), 
+                                           ITraversable, ns)
     else:
-        traverser = component.queryAdapter(object, ITraversable, ns)
+        traverser = capi.queryAdapter(object, ITraversable, ns)
 
     if traverser is None:
         raise TraversalError("++%s++%s" % (ns, name))
@@ -167,7 +167,7 @@
     return resource
 
 def queryResource(site, name, request, default=None):
-    resource = component.queryResource(name, request)
+    resource = capi.queryAdapter(request, name=name)
     if resource is None:
         return default
 
@@ -314,7 +314,7 @@
 
     def traverse(self, name, ignored):
         # TODO:
-        # This is here now to allow us to get service managers from a
+        # This is here now to allow us to get site managers from a
         # separate namespace from the content. We add and etc
         # namespace to allow us to handle misc objects.  We'll apply
         # YAGNI for now and hard code this. We'll want something more
@@ -330,7 +330,7 @@
             and IContainmentRoot.providedBy(ob)):
             return applicationController
 
-        if name not in ('site', 'Services'):
+        if name not in ('site',):
             raise TraversalError(ob, name)
 
         method_name = "getSiteManager"
@@ -353,7 +353,8 @@
         self.request = request
 
     def traverse(self, name, ignored):
-        view = component.queryView(self.context, name, self.request)
+        view = capi.queryMultiAdapter((self.context, self.request),
+                                           name=name)
         if view is None:
             raise TraversalError(self.context, name)
 
@@ -370,7 +371,7 @@
 
     def traverse(self, name, ignored):
         self.request.shiftNameToApplication()
-        skin = component.getUtility(ISkin, name)
+        skin = capi.getUtility(ISkin, name)
         applySkin(self.request, skin)
         return self.context
 
@@ -418,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):
@@ -447,7 +448,7 @@
              >>> tearDown()
            """
         try:
-            return component.getAdapter(self.context, IPathAdapter, name)
+            return capi.getAdapter(self.context, IPathAdapter, name)
         except ComponentLookupError:
             raise TraversalError(self.context, name)
 
@@ -487,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):
@@ -527,7 +528,7 @@
                     # TODO: I am not sure this is the best solution.  What
                     # if we want to enable tracebacks when also trying to
                     # debug a different skin?
-                    skin = component.getUtility(ISkin, 'Debug')
+                    skin = capi.getUtility(ISkin, 'Debug')
                     directlyProvides(request, providedBy(request)+skin)
                 else:
                     raise ValueError("Unknown debug flag: %s" % flag)

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_conveniencefunctions.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,11 +16,10 @@
 $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
 from zope.app.traversing.adapters import DefaultTraversable
 

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_etc.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_etc.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_etc.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -29,7 +29,7 @@
             etc(applicationControllerRoot).traverse('process', ()),
             applicationController)
 
-    def testServices(self):
+    def testSiteManager(self):
         from zope.app.traversing.namespace import etc
         class C(object):
             def getSiteManager(self): return 42

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_namespacetrversal.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_namespacetrversal.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_namespacetrversal.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/traversing/tests/test_physicallocationadapters.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_physicallocationadapters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_physicallocationadapters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/traversing/tests/test_presentation.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_presentation.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_presentation.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,8 +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.testing import ztapi
+from zope.app.testing.placelesssetup import PlacelessSetup
 from zope.app.traversing.namespace import view, resource
 from zope.interface import Interface, implements
 from zope.publisher.browser import TestRequest

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_skin.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_skin.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_skin.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,8 +19,8 @@
 from zope.interface import Interface, directlyProvides
 
 from zope.publisher.interfaces.browser import ISkin
-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 FauxRequest(object):

Modified: Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/traversing/tests/test_traverser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,7 +17,7 @@
 """
 import unittest
 
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 from zope.interface import directlyProvides
 from zope.interface.verify import verifyClass
 from zope.interface import implementedBy
@@ -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/trunk/src/zope/app/tree/adapters.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/adapters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/adapters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/tree/browser/cookie.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/browser/cookie.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/browser/cookie.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/tree/browser/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/browser/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/browser/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,7 +19,7 @@
 import unittest
 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.tree.utils import TreeStateEncoder
 from zope.app.tree.browser import StatefulTreeView
@@ -55,7 +55,8 @@
 
     def test_cookie_tree_pre_expanded(self):
         request = self.makeRequestWithVar()
-        view = zapi.getView(self.root_obj, 'cookie_tree', request)
+        view = zapi.getMultiAdapter((self.root_obj, request),
+                                    name='cookie_tree')
         cookie_tree = view.cookieTree()
         self.assert_(self.root_node.expanded)
         for node in self.root_node.getFlatNodes():
@@ -63,7 +64,8 @@
 
     def test_cookie_tree_sets_cookie(self):
         request = self.makeRequestWithVar()
-        view = zapi.getView(self.root_obj, 'cookie_tree', request)
+        view = zapi.getMultiAdapter((self.root_obj, request),
+                                    name='cookie_tree')
         cookie_tree = view.cookieTree()
         self.failIf(request.response.getCookie(view.request_variable) is None)
 

Modified: Zope3/trunk/src/zope/app/tree/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/tree/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -42,7 +42,7 @@
 
   <adapter
       provides=".interfaces.IChildObjects"
-      for="zope.app.site.interfaces.ISite"
+      for="zope.app.component.interfaces.ISite"
       factory=".adapters.ContainerSiteChildObjects"
       />
 

Modified: Zope3/trunk/src/zope/app/tree/tests/basetest.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/tests/basetest.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/tests/basetest.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/tree/tests/test_adapters.py
===================================================================
--- Zope3/trunk/src/zope/app/tree/tests/test_adapters.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/tree/tests/test_adapters.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/undo/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/undo/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,7 +21,6 @@
 
 from zope.app import zapi
 from zope.app.undo.interfaces import IUndoManager, UndoError
-from zope.app.servicenames import Utilities
 from zope.app.traversing.interfaces import IPhysicallyLocatable
 from zope.app.security.principalregistry import principalRegistry
 from zope.app.security.interfaces import IPrincipal
@@ -32,8 +31,8 @@
 
 def undoSetup(event):
     # setup undo functionality
-    svc = zapi.getGlobalService(Utilities)
-    svc.provideUtility(IUndoManager, ZODBUndoManager(event.database))
+    sm = zapi.getGlobalSiteManager()
+    sm.provideUtility(IUndoManager, ZODBUndoManager(event.database))
 
 class Prefix(str):
     """A prefix is equal to any string it is a prefix of.

Modified: Zope3/trunk/src/zope/app/undo/tests/test_undoview.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/tests/test_undoview.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/undo/tests/test_undoview.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/undo/tests/test_zodbundomanager.py
===================================================================
--- Zope3/trunk/src/zope/app/undo/tests/test_zodbundomanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/undo/tests/test_zodbundomanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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

Deleted: Zope3/trunk/src/zope/app/utility/PACKAGE.cfg
===================================================================
--- Zope3/trunk/src/zope/app/utility/PACKAGE.cfg	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/PACKAGE.cfg	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,5 +0,0 @@
-# The fssync sub-package is a separate component.
-
-<collection>
-  fssync -
-</collection>

Modified: Zope3/trunk/src/zope/app/utility/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,12 @@
 ##############################################################################
 """Local utility service implementation.
 
-$Id$
+$Id: __init__.py 25177 2004-06-02 13:17:31Z jim $
 """
+import zope.deprecation
 
-from utility import UtilityRegistration, LocalUtilityService
+zope.deprecation.__show__.off()
+from utility import LocalUtilityService
+zope.deprecation.__show__.on()
+
+from zope.app.component.site import UtilityRegistration


Property changes on: Zope3/trunk/src/zope/app/utility/__init__.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.5
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/utility/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/utility/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,29 +0,0 @@
-<configure 
-  xmlns="http://namespaces.zope.org/zope">
-
-  <localService class=".LocalUtilityService">
-    
-    <factory id="zope.app.services.UtilityService" />
-    
-    <require
-      permission="zope.ManageServices"
-      attributes="queryRegistrations"
-      interface="zope.app.registration.interfaces.IRegistry" />
-      
-  </localService>
-
-  <content class=".UtilityRegistration">
-    
-    <require
-      permission="zope.ManageServices"
-      attributes="required with provided factory"
-      interface="zope.app.utility.interfaces.IUtilityRegistration"
-      set_schema="zope.app.utility.interfaces.IUtilityRegistration" />
-      
-   </content>
-
-  <vocabulary
-    name="Utility Component Interfaces"
-    factory=".vocabulary.UtilityComponentInterfacesVocabulary" />
-
-</configure>

Modified: Zope3/trunk/src/zope/app/utility/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -13,53 +13,24 @@
 ##############################################################################
 """Interfaces pertaining to local utilities.
 
-$Id$
+$Id: interfaces.py 28582 2004-12-08 00:46:02Z srichter $
 """
-from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.registration.interfaces import IComponentRegistration
-from zope.app.registration.interfaces import IRegisterable
-from zope.app.registration.interfaces import IRegistry
-from zope.app.registration.interfaces import ComponentPath
-from zope.schema import TextLine, Choice
 import zope.component.interfaces
+from zope.deprecation import deprecated
 
+from zope.app.component.interfaces import IUtilityRegistration, ILocalUtility
+from zope.app.component.interfaces.registration import IRegistry
+
+deprecated(('IUtilityRegistration', 'ILocalUtility'),
+           'This interface has been moved to zope.app.component.site. '
+           'The reference will be gone in X3.3.')
+
 class ILocalUtilityService(
         zope.component.interfaces.IUtilityService,
         IRegistry,
         ):
     """Local Utility Service."""
 
-class IUtilityRegistration(IComponentRegistration):
-    """Utility registration object.
-
-    This is keyed off name (which may be empty) and interface. It inherits the
-    `component` property.
-    """
-
-    name = TextLine(
-        title=_("Register As"),
-        description=_("The name that is registered"),
-        readonly=True,
-        required=True,
-        )
-
-    interface = Choice(
-        title=_("Provided interface"),
-        description=_("The interface provided by the utility"),
-        vocabulary="Utility Component Interfaces",
-        readonly=True,
-        required=True,
-        )
-
-
-class ILocalUtility(IRegisterable):
-    """Local utility marker.
-
-    A marker interface that indicates that a component can be used as
-    a local utility.
-
-    Utilities should usually also declare they implement
-    IAttributeAnnotatable, so that the standard adapter to
-    IRegistered can be used; otherwise, they must provide
-    another way to be adaptable to IRegistered.
-    """
+deprecated('ILocalUtilityService',
+           'The concept of services has been removed. Use site manager API. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/utility/interfaces.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.6
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Deleted: Zope3/trunk/src/zope/app/utility/meta.zcml
===================================================================
--- Zope3/trunk/src/zope/app/utility/meta.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/meta.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,36 +0,0 @@
-<configure
-    xmlns:meta="http://namespaces.zope.org/meta">
-
-  <meta:directives namespace="http://namespaces.zope.org/zope">
-
-    <meta:complexDirective
-        name="localUtility"
-        schema="zope.app.component.metadirectives.IClassDirective"
-        handler=".metaconfigure.LocalUtilityDirective"
-        >
-
-      <meta:subdirective
-          name="implements"
-          schema="zope.app.component.metadirectives.IImplementsSubdirective"
-          />
-
-      <meta:subdirective
-          name="require"
-          schema="zope.app.component.metadirectives.IRequireSubdirective"
-          />
-
-      <meta:subdirective
-          name="allow"
-          schema="zope.app.component.metadirectives.IAllowSubdirective"
-          />
-
-      <meta:subdirective
-          name="factory"
-          schema="zope.app.component.metadirectives.IFactorySubdirective"
-          />
-
-    </meta:complexDirective>
-
-  </meta:directives>
-
-</configure>

Deleted: Zope3/trunk/src/zope/app/utility/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,83 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Local Utility Directive
-
-$Id$
-"""
-__docformat__ = "reStructuredText"
-from persistent.interfaces import IPersistent
-from zope.configuration.exceptions import ConfigurationError
-from zope.interface import classImplements
-
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.component.contentdirective import ContentDirective
-from zope.app.location.interfaces import ILocation
-
-from interfaces import ILocalUtility
-
-
-class LocalUtilityDirective(ContentDirective):
-    r"""localUtility directive handler.
-
-    Examples:
-
-      >>> from zope.interface import implements
-      >>> class LU1(object):
-      ...     pass
-
-      >>> class LU2(LU1):
-      ...     implements(ILocation)
-
-      >>> class LU3(LU1):
-      ...     __parent__ = None
-
-      >>> class LU4(LU2):
-      ...     implements(IPersistent)
-
-      >>> dir = LocalUtilityDirective(None, LU4)
-      >>> IAttributeAnnotatable.implementedBy(LU4)
-      True
-      >>> ILocalUtility.implementedBy(LU4)
-      True
-
-      >>> LocalUtilityDirective(None, LU3)
-      Traceback (most recent call last):
-      ...
-      ConfigurationError: Class `LU3` does not implement `IPersistent`.
-
-      >>> LocalUtilityDirective(None, LU2)
-      Traceback (most recent call last):
-      ...
-      ConfigurationError: Class `LU2` does not implement `IPersistent`.
-
-      >>> LocalUtilityDirective(None, LU1)
-      Traceback (most recent call last):
-      ...
-      ConfigurationError: Class `LU1` does not implement `ILocation`.
-    """
-
-    def __init__(self, _context, class_):
-        if not ILocation.implementedBy(class_) and \
-               not hasattr(class_, '__parent__'):
-            raise ConfigurationError, \
-                  'Class `%s` does not implement `ILocation`.' %class_.__name__
-
-        if not IPersistent.implementedBy(class_):
-            raise ConfigurationError, \
-                 'Class `%s` does not implement `IPersistent`.' %class_.__name__
-
-        classImplements(class_, IAttributeAnnotatable)
-        classImplements(class_, ILocalUtility)
-
-        super(LocalUtilityDirective, self).__init__(_context, class_)

Deleted: Zope3/trunk/src/zope/app/utility/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,272 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Utility service tests
-
-$Id$
-"""
-import unittest
-from StringIO import StringIO
-from persistent.interfaces import IPersistent
-
-from zope.component import getService
-from zope.component.exceptions import ComponentLookupError
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-from zope.interface import Interface, implements
-from zope.testing.doctestunit import DocTestSuite
-
-import zope.app.security
-import zope.app.utility
-from zope.app.tests import setup
-from zope.app import utility, zapi
-from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.dependable.interfaces import IDependable
-from zope.app.location.interfaces import ILocation
-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.site.tests import placefulsetup
-from zope.app.tests import setup
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.utility.interfaces import ILocalUtility
-
-
-def configfile(s):
-    return StringIO("""<configure
-      xmlns='http://namespaces.zope.org/zope'
-      i18n_domain='zope'>
-      %s
-      </configure>
-      """ % s)
-
-class IFo(Interface): pass
-
-class IFoo(IFo):
-    def foo(self): pass
-
-class IBar(Interface): pass
-
-
-class Foo(object):
-    # We implement IRegistered and IDependable directly to
-    # depend as little  as possible on other infrastructure.
-    __name__ = __parent__ = None
-    implements(IFoo, ILocalUtility, IRegistered, IDependable)
-    
-    def __init__(self, name):
-        self.name = name
-        self._usages = []
-        self._dependents = []
-
-    def foo(self):
-        return 'foo ' + self.name
-
-    def addUsage(self, location):
-        "See zope.app.registration.interfaces.IRegistered"
-        if location not in self._usages:
-            self._usages.append(location)
-
-    def removeUsage(self, location):
-        "See zope.app.registration.interfaces.IRegistered"
-        self._usages.remove(location)
-
-    def usages(self):
-        "See zope.app.registration.interfaces.IRegistered"
-        return self._usages
-
-    def addDependent(self, location):
-        "See zope.app.dependable.interfaces.IDependable"
-        if location not in self._dependents:
-            self._dependents.append(location)
-
-    def removeDependent(self, location):
-        "See zope.app.dependable.interfaces.IDependable"
-        self._dependents.remove(location)
-
-    def dependents(self):
-        "See zope.app.dependable.interfaces.IDependable"
-        return self._dependents
-
-
-class UtilityStub(object):
-    implements(ILocation, IPersistent)
-
-
-class TestUtilityService(placefulsetup.PlacefulSetup, unittest.TestCase):
-
-    def setUp(self):
-        sm = placefulsetup.PlacefulSetup.setUp(self, site=True)
-        setup.addService(sm, zapi.servicenames.Utilities,
-                         utility.LocalUtilityService())
-
-    def test_queryUtility_delegates_to_global(self):
-        utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
-        utilityService.provideUtility(IFoo, Foo("global"))
-        utilityService.provideUtility(IFoo, Foo("global bob"),
-                                            name="bob")
-
-        utility_service = getService("Utilities", self.rootFolder)
-
-        # We changed the root (base) service. This doesn't normally
-        # occur.  We have to notify the local service that the base
-        # has changes:
-        utility_service.baseChanged()
-        
-        self.assert_(utility_service != utilityService)
-
-        self.assertEqual(utility_service.queryUtility(IFoo).foo(),
-                         "foo global")
-        self.assertEqual(utility_service.queryUtility(IFoo, "bob").foo(),
-                         "foo global bob")
-        self.assertEqual(utility_service.queryUtility(IFo).foo(),
-                         "foo global")
-        self.assertEqual(utility_service.queryUtility(IFo, "bob").foo(),
-                         "foo global bob")
-
-        self.assertEqual(utility_service.queryUtility(IBar), None)
-        self.assertEqual(utility_service.queryUtility(IBar, "bob"), None)
-        self.assertEqual(utility_service.queryUtility(IFoo, "rob"), None)
-
-    def test_getUtility_delegates_to_global(self):
-        utilityService = zapi.getGlobalService(zapi.servicenames.Utilities)
-        utilityService.provideUtility(IFoo, Foo("global"))
-        utilityService.provideUtility(IFoo, Foo("global bob"),
-                                            name="bob")
-
-        utility_service = getService("Utilities", self.rootFolder)
-        self.assert_(utility_service != utilityService)
-
-        self.assertEqual(utility_service.getUtility(IFoo).foo(),
-                         "foo global")
-        self.assertEqual(utility_service.getUtility(IFoo, "bob").foo(),
-                         "foo global bob")
-        self.assertEqual(utility_service.getUtility(IFo).foo(),
-                         "foo global")
-        self.assertEqual(utility_service.getUtility(IFo, "bob").foo(),
-                         "foo global bob")
-
-
-        self.assertRaises(ComponentLookupError,
-                          utility_service.getUtility, IBar)
-        self.assertRaises(ComponentLookupError,
-                          utility_service.getUtility, IBar, 'bob')
-        self.assertRaises(ComponentLookupError,
-                          utility_service.getUtility, IFoo, 'rob')
-
-
-    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, IFoo, 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(IFoo, Foo("global"))
-        utilityService.provideUtility(IFoo, Foo("global bob"),
-                                            name="bob")
-
-        utilities = getService("Utilities", self.rootFolder)
-
-        # We changed the root (base) service. This doesn't normally
-        # occur.  We have to notify the local service that the base
-        # has changes:
-        utilities.baseChanged()
-
-        default = traverse(self.rootFolder, "++etc++site/default")
-        default['foo'] = Foo("local")
-        foo = default['foo']
-        cm = default.getRegistrationManager()
-
-        for name in ('', 'bob'):
-            registration = utility.UtilityRegistration(name, IFoo, foo)
-            cname = cm.addRegistration(registration)
-            registration = traverse(cm, cname)
-
-            gout = name and "foo global "+name or "foo global"
-
-            self.assertEqual(utilities.getUtility(IFoo, name).foo(), gout)
-
-            registration.status = ActiveStatus
-
-            self.assertEqual(utilities.getUtility(IFoo, name).foo(),
-                             "foo local")
-
-            registration.status = RegisteredStatus
-
-            self.assertEqual(utilities.getUtility(IFoo, name).foo(), gout)
-
-
-    def test_local_overrides(self):
-        # Make sure that a local utility service can override another
-        sm1 = zapi.traverse(self.rootFolder, "++etc++site")
-        setup.addUtility(sm1, 'u1', IFoo, Foo('u1'))
-        setup.addUtility(sm1, 'u2', IFoo, Foo('u2'))
-        sm2 = self.makeSite('folder1')
-        setup.addService(sm2, zapi.servicenames.Utilities,
-                         utility.LocalUtilityService())
-        setup.addUtility(sm2, 'u2', IFoo, Foo('u22'))
-
-        # Make sure we acquire:
-        self.assertEqual(zapi.getUtility(IFoo, 'u1', sm2).name, 'u1')
-
-        # Make sure we override:
-        self.assertEqual(zapi.getUtility(IFoo, 'u2', sm2).name, 'u22')
-
-
-class TestLocalUtilityDirective(PlacelessSetup, unittest.TestCase):
-
-    def setUp(self):
-        super(TestLocalUtilityDirective, self).setUp()
-        XMLConfig('meta.zcml', zope.app.component)()
-        XMLConfig('meta.zcml', zope.app.utility)()
-
-    def testDirective(self):
-        f = configfile('''
-        <localUtility
-            class="zope.app.utility.tests.UtilityStub">
-        </localUtility>
-        ''')
-        xmlconfig(f)
-        self.assert_(ILocalUtility.implementedBy(UtilityStub))
-        self.assert_(IAttributeAnnotatable.implementedBy(UtilityStub))
-    
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite(TestUtilityService),
-        unittest.makeSuite(TestLocalUtilityDirective),
-        DocTestSuite('zope.app.utility.metaconfigure'),
-        DocTestSuite('zope.app.utility.utility',
-                     setUp=setup.placelessSetUp,
-                     tearDown=setup.placelessTearDown),
-        DocTestSuite('zope.app.utility.vocabulary',
-                     setUp=setup.placelessSetUp,
-                     tearDown=setup.placelessTearDown)
-        ))
-
-if __name__ == '__main__':
-    unittest.main(default='test_suite')

Modified: Zope3/trunk/src/zope/app/utility/utility.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/utility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/utility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -14,250 +14,33 @@
 Besides being functional, this module also serves as an example of
 creating a local service; see README.txt.
 
-$Id$
+$Id: utility.py 28662 2004-12-21 03:29:21Z srichter $
 """
-from persistent.interfaces import IPersistent
-import zope.interface
-import zope.interface.adapter
-from zope.component.utility import UtilityService, GlobalUtilityService
-from zope.security.proxy import removeSecurityProxy
+from persistent import Persistent
+from zope.deprecation import deprecated
 
-import zope.app.site.interfaces
-from zope.app import zapi
-from zope.app.adapter.adapter import LocalAdapterService
-from zope.app.component.localservice import queryNextService
-from zope.app.registration.registration import ComponentRegistration
-from zope.app.utility.interfaces import ILocalUtilityService
-from zope.app.utility.interfaces import IUtilityRegistration
+from zope.app.component import getNextUtility, queryNextUtility
+from zope.app.component.testing import testingNextUtility
+from zope.app.component.site import UtilityRegistration
+from zope.app.container.contained import Contained
 
-class LocalUtilityService(UtilityService, LocalAdapterService):
-    """Local Utility Service
-    """
+deprecated(('getNextUtility', 'queryNextUtility'),
+           'This function has been moved to zope.app.component. '
+           'The reference will be gone in X3.3.')
 
-    serviceType = zapi.servicenames.Utilities
+deprecated('testingNextUtility',
+           'This function has been moved to zope.app.component.testing. '
+           'The reference will be gone in X3.3.')
 
-    zope.interface.implementsOnly(
-        ILocalUtilityService,
-        zope.app.site.interfaces.ISimpleService,
-        zope.app.site.interfaces.IBindingAware,
-        IPersistent # used for IKeyReference adaption
-        )
+deprecated('UtilityRegistration',
+           'This class has been moved to zope.app.component.site. '
+           'The reference will be gone in X3.3.')
 
 
-    def queryRegistrations(self, name, interface):
-        return self.queryRegistrationsFor(
-            UtilityRegistration(name, interface, None)
-            )
+class LocalUtilityService(Persistent, Contained):
+    # I really hope noone noone is using this class manually! 
+    pass
 
-    def getLocalUtilitiesFor(self, interface):
-        # This method is deprecated and is temporarily provided for
-        # backward compatability
-        from zope.app import zapi
-        from zope.app.component.localservice import getNextService
-        next = getNextService(self, zapi.servicenames.Utilities)
-        next_utils = dict(next.getUtilitiesFor(interface))
-        for name, util in self.getUtilitiesFor(interface):
-            if next_utils.get(name) != util:
-                yield name, util
-
-
-    def _updateAdaptersFromLocalData(self, adapters):
-        LocalAdapterService._updateAdaptersFromLocalData(self, adapters)
-        
-        for required, stacks in self.stacks.iteritems():
-            if required is None:
-                required = Default
-            radapters = adapters.get(required)
-
-            for key, stack in stacks.iteritems():
-                registration = stack.active()
-                if registration is not None:
-                    key = True, key[1], '', key[3]
-
-                    # Needs more thought:
-                    # We have to remove the proxy because we're
-                    # 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
-                    
-                    radapters[key] = radapters.get(key, ()) + (
-                        removeSecurityProxy(registration.factory), )
-
-
-
-class UtilityRegistration(ComponentRegistration):
-    """Utility component registration for persistent components
-
-    This registration configures persistent components in packages to
-    be utilities.
-    """
-    zope.interface.implements(IUtilityRegistration)
-
-    serviceType = zapi.servicenames.Utilities
-
-    ############################################################
-    # To make adapter code happy. Are we going too far?
-    #
-    required = zope.interface.adapter.Null
-    with = ()
-    provided = property(lambda self: self.interface)
-    factory = property(lambda self: self.component)
-    #
-    ############################################################
-
-    def __init__(self, name, interface, component, permission=None):
-        super(UtilityRegistration, self).__init__(component, permission)
-        self.name = name
-        self.interface = interface
-
-    def usageSummary(self):
-        # Override IRegistration.usageSummary()
-        s = self.getInterface().getName()
-        if self.name:
-            s += " registered as '%s'" % self.name
-        s += ", implemented by %s" %self.component.__class__.__name__
-        s += " '%s'"%zapi.name(self.component)
-        return s
-
-    def getInterface(self):
-        # ComponentRegistration calls this when you specify a
-        # permission; it needs the interface to create a security
-        # proxy for the interface with the given permission.
-        return self.interface
-
-
-
-_marker = object()
-
-def getNextUtility(context, interface, name=''):
-    """Get the next available utility.
-
-    If no utility was found, a `ComponentLookupError` is raised.
-    """
-    util = queryNextUtility(context, interface, name, _marker)
-    if util is _marker:
-        raise ComponentLookupError, \
-              "No more utilities for %s, '%s' have been found." %(interface,
-                                                                  name)
-    return util
-
-
-def queryNextUtility(context, interface, name='', default=None):
-    """Query for the next available utility.
-
-    Find the next available utility providing `interface` and having the
-    specified name. If no utility was found, return the specified `default`
-    value.
-
-    It is very important that this method really finds the next utility and
-    does not abort, if the utility was not found in the next utility service.
-
-    Let's start out by declaring a utility interface and an implementation:
-
-      >>> from zope.interface import Interface, implements
-      >>> class IAnyUtility(Interface):
-      ...     pass
-      
-      >>> class AnyUtility(object):
-      ...     implements(IAnyUtility)
-      ...     def __init__(self, id):
-      ...         self.id = id
-      
-      >>> any1 = AnyUtility(1)
-      >>> any1next = AnyUtility(2)
-
-    Now that we have the utilities, let's register them:
-
-      >>> testingNextUtility(any1, any1next, IAnyUtility)
-
-    The next utility of `any1` ahould be `any1next`:
-
-      >>> queryNextUtility(any1, IAnyUtility) is any1next
-      True
-
-    But `any1next` does not have a next utility, so the default is returned:
-
-      >>> queryNextUtility(any1next, IAnyUtility) is None
-      True
-
-    """    
-    util = _marker
-    while util is _marker:
-        utilservice = queryNextService(context, zapi.servicenames.Utilities)
-        if utilservice is None:
-            return default
-        util = utilservice.queryUtility(interface, name, _marker)
-        context = utilservice
-        
-    return util
-
-
-def testingNextUtility(utility, nextutility, interface, name='',
-                       service=None, nextservice=None):
-    """Provide a next utility for testing.
-
-    Since utilities must be registered in services, we really provide a next
-    utility service in which we place the next utility. If you do not pass in
-    any services, they will be created for you.
-
-    For a simple usage of this function, see the doc test of
-    `queryNextUtility()`. Here is a demonstration that passes in the services
-    directly and ensures that the `__parent__` attributes are set correctly.
-
-    First, we need to create a utility interface and implementation:
-
-      >>> from zope.interface import Interface, implements
-      >>> class IAnyUtility(Interface):
-      ...     pass
-      
-      >>> class AnyUtility(object):
-      ...     implements(IAnyUtility)
-      ...     def __init__(self, id):
-      ...         self.id = id
-      
-      >>> any1 = AnyUtility(1)
-      >>> any1next = AnyUtility(2)
-
-    Now we create a special utility service that can have a location:
-
-      >>> UtilityService = type('UtilityService', (GlobalUtilityService,),
-      ...                       {'__parent__': None})
-
-    Let's now create one utility service
-
-      >>> utils = UtilityService()
-
-    and pass it in as the original utility service to the function:
-
-      >>> testingNextUtility(any1, any1next, IAnyUtility, service=utils)
-      >>> any1.__parent__ is utils
-      True
-      >>> utilsnext = any1next.__parent__
-      >>> utils.__parent__.next.data['Utilities'] is utilsnext
-      True
-
-    or if we pass the current and the next utility service:
-
-      >>> utils = UtilityService()
-      >>> utilsnext = UtilityService()
-      >>> testingNextUtility(any1, any1next, IAnyUtility,
-      ...                    service=utils, nextservice=utilsnext)
-      >>> any1.__parent__ is utils
-      True
-      >>> any1next.__parent__ is utilsnext
-      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)
-
-    service.provideUtility(interface, utility, name)
-    utility.__parent__ = service
-    nextservice.provideUtility(interface, nextutility, name)
-    nextutility.__parent__ = nextservice
+deprecated('LocalUtilityService',
+           'Services have been removed. Use site manager API. '
+           'The reference will be gone in X3.3.')


Property changes on: Zope3/trunk/src/zope/app/utility/utility.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.3
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/utility/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/vocabulary.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/utility/vocabulary.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,345 +15,14 @@
 
 This vocabulary provides terms for all utilities providing a given interface.
 
-$Id$
+$Id: vocabulary.py 28582 2004-12-08 00:46:02Z srichter $
 """
-from zope.interface import implements, Interface
-from zope.interface.interfaces import IInterface
-from zope.interface.verify import verifyObject
-from zope.schema.interfaces import IVocabulary, IVocabularyTokenized
-from zope.schema.interfaces import ITokenizedTerm
+from zope.deprecation import deprecated
 
-from zope.app import zapi
-from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.interface.vocabulary import ObjectInterfacesVocabulary
+from zope.app.component.vocabulary import *
 
-from interfaces import IUtilityRegistration
-
-
-class UtilityTerm(object):
-    """A term representing a utility.
-
-    The token of the term is the name of the utility. Here is a brief example
-    on how the IVocabulary interface is handled in this term as a utility:
-
-    >>> term = UtilityTerm(IVocabulary, 'zope.schema.interfaces.IVocabulary')
-    >>> verifyObject(ITokenizedTerm, term)
-    True
-
-    >>> term.value
-    <InterfaceClass zope.schema.interfaces.IVocabulary>
-    >>> term.token
-    'zope.schema.interfaces.IVocabulary'
-
-    >>> term
-    <UtiltiyTerm zope.schema.interfaces.IVocabulary, instance of InterfaceClass>
-    """
-    implements(ITokenizedTerm)
-
-    def __init__(self, value, token):
-        """Create a term for value and token."""
-        self.value = value
-        self.token = token
-
-    def __repr__(self):
-        return '<UtiltiyTerm %s, instance of %s>' %(
-            self.token, self.value.__class__.__name__)
-
-
-class UtilityVocabulary(object):
-    """Vocabulary that provides utilities of a specified interface.
-
-    Here is a short example of how the vocabulary should work.
-
-    First we need to create a utility interface and some utilities:
-
-    >>> class IObject(Interface):
-    ...     'Simple interface to mark object utilities.'
-    >>>
-    >>> class Object(object):
-    ...     implements(IObject)
-    ...     def __init__(self, name):
-    ...         self.name = name
-    ...     def __repr__(self):
-    ...         return '<Object %s>' %self.name
-
-    Now we register some utilities for IObject
-
-    >>> from zope.app.tests import ztapi
-    >>> object1 = Object('object1')
-    >>> ztapi.provideUtility(IObject, object1, 'object1')
-    >>> object2 = Object('object2')
-    >>> ztapi.provideUtility(IObject, object2, 'object2')
-    >>> object3 = Object('object3')
-    >>> ztapi.provideUtility(IObject, object3, 'object3')
-    >>> object4 = Object('object4')
-
-    We are now ready to create a vocabulary that we can use; in our case
-    everything is global, so the context is None.
-
-    >>> vocab = UtilityVocabulary(None, IObject)
-    >>> import pprint
-    >>> pprint.pprint(vocab._terms.items())
-    [(u'object1', <UtiltiyTerm object1, instance of Object>),
-     (u'object2', <UtiltiyTerm object2, instance of Object>),
-     (u'object3', <UtiltiyTerm object3, instance of Object>)]
-
-    Now let's see how the other methods behave in this context. First we can
-    just use the 'in' opreator to test whether a value is available.
-
-    >>> object1 in vocab
-    True
-    >>> object4 in vocab
-    False
-
-    We can also create a lazy iterator. Note that the utility terms might
-    appear in a different order than the utilities were registered.
-
-    >>> iterator = iter(vocab)
-    >>> terms = list(iterator)
-    >>> names = [term.token for term in terms]
-    >>> names.sort()
-    >>> names
-    [u'object1', u'object2', u'object3']
-
-    Determining the amount of utilities available via the vocabulary is also
-    possible.
-
-    >>> len(vocab)
-    3
-
-    Next we are looking at some of the more vocabulary-characteristic API
-    methods.
-    
-    One can get a term for a given value using getTerm():
-
-    >>> vocab.getTerm(object1)
-    <UtiltiyTerm object1, instance of Object>
-    >>> vocab.getTerm(object4)
-    Traceback (most recent call last):
-    ...
-    LookupError: <Object object4>
-
-    On the other hand, if you want to get a term by the token, then you do
-    that with:
-
-    >>> vocab.getTermByToken('object1')
-    <UtiltiyTerm object1, instance of Object>
-    >>> vocab.getTermByToken('object4')
-    Traceback (most recent call last):
-    ...
-    LookupError: object4
-
-    That's it. It is all pretty straight forward, but it allows us to easily
-    create a vocabulary for any utility. In fact, to make it easy to register
-    such a vocabulary via ZCML, the 'interface' argument to the constructor
-    can be a string that is resolved via the utility registry. The ZCML looks
-    like this:
-
-    <zope:vocabulary
-        name='IObjects'
-        factory='zope.app.utility.vocabulary.UtilityVocabulary'
-        interface='zope.app.utility.vocabulary.IObject' />
-
-    >>> ztapi.provideUtility(IInterface, IObject,
-    ...                      'zope.app.utility.vocabulary.IObject')
-    >>> vocab = UtilityVocabulary(None, 'zope.app.utility.vocabulary.IObject')
-    >>> pprint.pprint(vocab._terms.items())
-    [(u'object1', <UtiltiyTerm object1, instance of Object>),
-     (u'object2', <UtiltiyTerm object2, instance of Object>),
-     (u'object3', <UtiltiyTerm object3, instance of Object>)]
-
-    Sometimes it is desirable to only select the name of a utility. For
-    this purpose a 'nameOnly' argument was added to the constructor, in which
-    case the UtilityTerm's value is not the utility itself but the name of the
-    utility.
-
-    >>> vocab = UtilityVocabulary(None, IObject, nameOnly=True)
-    >>> pprint.pprint([term.value for term in vocab])
-    [u'object1', u'object2', u'object3']
-    """
-
-    implements(IVocabularyTokenized)
-
-    def __init__(self, context, interface, nameOnly=False):
-        if nameOnly is not False:
-            nameOnly = True
-        if isinstance(interface, (str, unicode)):
-            interface = zapi.getUtility(IInterface, interface)
-        self.interface = interface
-        utils = zapi.getUtilitiesFor(interface, context)
-        self._terms = dict([(name, UtilityTerm(nameOnly and name or util, name))
-                            for name, util in utils])
-
-    def __contains__(self, value):
-        """See zope.schema.interfaces.IBaseVocabulary"""
-        return value in [term.value for term in self._terms.values()]
-
-    def getTerm(self, value):
-        """See zope.schema.interfaces.IBaseVocabulary"""
-        try:
-            return [term for name, term in self._terms.items()
-                    if term.value == value][0]
-        except IndexError:
-            raise LookupError, value
-
-    def getTermByToken(self, token):
-        """See zope.schema.interfaces.IVocabularyTokenized"""
-        try:
-            return self._terms[token]
-        except KeyError:
-            raise LookupError, token
-
-    def __iter__(self):
-        """See zope.schema.interfaces.IIterableVocabulary"""
-        # Sort the terms by the token (utility name)
-        values = self._terms.values()
-        values.sort(lambda x, y: cmp(x.token, y.token))
-        return iter(values)
-
-    def __len__(self):
-        """See zope.schema.interfaces.IIterableVocabulary"""
-        return len(self._terms)
-
-
-class UtilityComponentInterfacesVocabulary(ObjectInterfacesVocabulary):
-
-    def __init__(self, context):
-        if IUtilityRegistration.providedBy(context):
-            context = context.component
-        super(UtilityComponentInterfacesVocabulary, self).__init__(
-            context)
-
-
-class UtilityNameTerm:
-    r"""Simple term that provides a utility name as a value.
-
-    >>> t1 = UtilityNameTerm('abc')
-    >>> t2 = UtilityNameTerm(u'\xC0\xDF\xC7')
-    >>> t1.value
-    u'abc'
-    >>> t2.value
-    u'\xc0\xdf\xc7'
-    >>> t1.title()
-    u'abc'
-    >>> repr(t2.title())
-    "u'\\xc0\\xdf\\xc7'"
-
-    The tokens used for form values are Base-64 encodings of the
-    names, with the letter 't' prepended to ensure the unnamed utility
-    is supported:
-
-    >>> t1.token()
-    'tYWJj'
-    >>> t2.token()
-    'tw4DDn8OH'
-
-
-    The unnamed utility is given an artificial title for use in user
-    interfaces:
-
-    >>> t3 = UtilityNameTerm(u'')
-    >>> t3.title()
-    u'(unnamed utility)'
-
-    """
-
-    implements(ITokenizedTerm)
-
-    def __init__(self, value):
-        self.value = unicode(value)
-
-    def token(self):
-        # Return our value as a token.  This is required to be 7-bit
-        # printable ascii. We'll use base64 generated from the UTF-8
-        # representation.  (The default encoding rules should not be
-        # allowed to apply.)
-        return "t" + self.value.encode('utf-8').encode('base64')[:-1]
-
-    def title(self):
-        return self.value or _("(unnamed utility)")
-
-
-class UtilityNames:
-    """Vocabulary with utility names for a single interface as values.
-
-    >>> class IMyUtility(Interface):
-    ...     pass
-
-    >>> class MyUtility(object):
-    ...     implements(IMyUtility)
-
-    >>> vocab = UtilityNames(IMyUtility)
-
-    >>> IVocabulary.providedBy(vocab)
-    True
-    >>> IVocabularyTokenized.providedBy(vocab)
-    True
-
-    >>> from zope.app.tests import placelesssetup
-    >>> from zope.app.tests import ztapi
-    >>> placelesssetup.setUp()
-
-    >>> ztapi.provideUtility(IMyUtility, MyUtility(), 'one')
-    >>> ztapi.provideUtility(IMyUtility, MyUtility(), 'two')
-
-    >>> unames = UtilityNames(IMyUtility)
-    >>> len(list(unames))
-    2
-    >>> L = [t.value for t in unames]
-    >>> L.sort()
-    >>> L
-    [u'one', u'two']
-
-    >>> u'one' in vocab
-    True
-    >>> u'three' in vocab
-    False
-    >>> ztapi.provideUtility(IMyUtility, MyUtility(), 'three')
-    >>> u'three' in vocab
-    True
-
-    >>> ztapi.provideUtility(IMyUtility, MyUtility())
-    >>> u'' in vocab
-    True
-    >>> term1 = vocab.getTerm(u'')
-    >>> term2 = vocab.getTermByToken(term1.token())
-    >>> term2.value
-    u''
-
-    >>> placelesssetup.tearDown()
-
-    """
-
-    implements(IVocabularyTokenized)
-
-    def __init__(self, interface):
-        self.interface = interface
-
-    def __contains__(self, value):
-        return zapi.queryUtility(self.interface, value) is not None
-
-    def getTerm(self, value):
-        if value in self:
-            return UtilityNameTerm(value)
-        raise ValueError(value)
-
-    def getTermByToken(self, token):
-        for name, ut in zapi.getUtilitiesFor(self.interface):
-            name = unicode(name)
-            if token == "t":
-                if not name:
-                    break
-            elif name.encode('utf-8').encode('base64')[:-1] == token:
-                break
-        else:
-            raise LookupError("no matching token: %r" % token)
-        return self.getTerm(name)
-
-    def __iter__(self):
-        for name, ut in zapi.getUtilitiesFor(self.interface):
-            yield UtilityNameTerm(name)
-
-    def __len__(self):
-        """Return the number of valid terms, or sys.maxint."""
-        return len(list(zapi.getUtilitiesFor(self.interface)))
+deprecated(('UtilityTerm', 'UtilityVocabulary', 'UtilityNameTerm', 
+            'UtilityComponentInterfacesVocabulary', 'UtilityNames'),
+           'This class has been moved to zope.app.component.vocabulary. '
+           'The reference will be gone in X3.3.')
+           


Property changes on: Zope3/trunk/src/zope/app/utility/vocabulary.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.5
Name: svn:keywords
   - Id
Name: svn:eol-style
   - native

Modified: Zope3/trunk/src/zope/app/versioncontrol/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/versioncontrol/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/versioncontrol/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/wfmc/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/wfmc/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/wfmc/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1 +1 @@
-#
+# Make a package.

Modified: Zope3/trunk/src/zope/app/wfmc/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/wfmc/metaconfigure.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/wfmc/metaconfigure.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
 """WFMC metaconfigure
 
 $Id: $
@@ -2,25 +15,12 @@
 """
-
-import zope.interface
-import zope.schema
-import zope.configuration.fields
-import zope.component
-
-from zope.app import zapi
+__docformat__ = "reStructuredText"
 from zope import wfmc
 from zope.wfmc import xpdl
+from zope.app.component.metaconfigure import utility
 
-def createUtility(file, process, id):
+def defineXpdl(_context, file, process, id):
     package = xpdl.read(open(file))
     definition = package[process]
     definition.id = id
 
-    zapi.getGlobalService('Utilities').provideUtility(
-            wfmc.interfaces.IProcessDefinition, definition, id)
-
-def defineXpdl(_context, file, process, id):
-    _context.action(
-        discriminator=('intranet:xpdl', id),
-        callable=createUtility, 
-        args=(file, process, id),
-        )
+    utility(_context, wfmc.interfaces.IProcessDefinition, definition, name=id)

Modified: Zope3/trunk/src/zope/app/wfmc/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/wfmc/metadirectives.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/wfmc/metadirectives.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
 """ZCML directives for defining privileges.
 
 $Id: $
@@ -2,3 +15,3 @@
 """
-
+__docformat__ = "reStructuredText"
 import zope.interface

Modified: Zope3/trunk/src/zope/app/wfmc/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/wfmc/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/wfmc/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,16 +1,32 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""WFMC Tests Setup
+
+$Id$
 """
-$Id: $
-"""
+__docformat__ = "reStructuredText"
 import os
 import unittest
 
-import zope
-from zope.app.tests import placelesssetup
 from zope.configuration import xmlconfig
-from zope.app.tests import ztapi
+from zope.testing import module, doctest
+
 import zope.app.annotation.interfaces
 import zope.app.annotation.attribute
-from zope.testing import module
+import zope.app.wfmc
+from zope.app.testing import placelesssetup
+from zope.app.testing import ztapi
 
 def zcml(s):
     context = xmlconfig.file('meta.zcml', package=zope.app.wfmc)
@@ -21,7 +37,6 @@
     placelesssetup.setUp(test)
 
 def test_suite():
-    from zope.testing import doctest
     return doctest.DocFileSuite(
                 'zcml.txt', globs={'zcml': zcml},
                 setUp=setUp,
@@ -31,4 +46,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/trunk/src/zope/app/workflow/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/workflow/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -45,7 +45,7 @@
       name="contents.html" />  
 
   <!-- ProcessInstanceContainerAdaptable 
-       XXX Commented Out .. is just a demo
+       Note: Commented Out ... it is just a demo
   <pages
       for="zope.app.workflow.interfaces.IProcessInstanceContainerAdaptable"
       permission="zope.workflow.UseProcessInstances"

Modified: Zope3/trunk/src/zope/app/workflow/browser/definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/browser/definition.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/browser/definition.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,9 +15,8 @@
 
 $Id$
 """
-
 from zope.app.traversing.api import traverse
-from zope.app.registration.interfaces import IRegistered
+from zope.app.component.interfaces.registration import IRegistered
 from zope.app.workflow.interfaces import IProcessDefinitionImportHandler
 from zope.app.workflow.interfaces import IProcessDefinitionExportHandler
 

Modified: Zope3/trunk/src/zope/app/workflow/definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/definition.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/definition.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,7 +25,6 @@
 
 from zope.app import zapi
 from zope.app.container.contained import Contained, setitem, uncontained
-from zope.app.servicenames import Utilities
 from zope.app.workflow.interfaces import IProcessDefinitionElementContainer
 from zope.app.workflow.interfaces import IProcessDefinition
 
@@ -110,11 +109,11 @@
     implements(IVocabularyTokenized)
 
     def __init__(self, context):
-        self.utilities = zapi.getService(Utilities, context)
+        self.sm = zapi.getSiteManager(context)
 
     def __names(self):
-        return [name for name, util in self.utilities.getUtilitiesFor(
-                                            IProcessDefinition)]
+        return [name
+                for name, util in self.sm.getUtilitiesFor(IProcessDefinition)]
 
     def __contains__(self, value):
         """See zope.schema.interfaces.IVocabulary"""

Modified: Zope3/trunk/src/zope/app/workflow/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/instance.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/instance.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/interfaces/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/interfaces/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/interfaces/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -11,7 +11,7 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Interfaces for workflow service, definition and instance.
+"""Interfaces for workflow components, definition and instance.
 
 $Id$
 """

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/configure.zcml	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/configure.zcml	2005-02-14 22:43:16 UTC (rev 29143)
@@ -160,7 +160,7 @@
       factory=".filteradapter.FilterAdapter"
       provides=".interfaces.IContentFilterAdapter"
       for="zope.app.annotation.interfaces.IAttributeAnnotatable"
-      permission="zope.View" /> <!-- XXX is this permission right? -->
+      permission="zope.View" /> <!-- TODO: is this permission right? -->
 
   <!--include file="testobject.zcml"/-->
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/contentworkflow.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/contentworkflow.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/contentworkflow.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,7 +20,6 @@
 from zope.app.component.interface import nameToInterface
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.form.utility import setUpWidgets
-from zope.app.servicenames import Utilities
 from zope.app.form.interfaces import IInputWidget
 from zope.interface import Interface
 from zope.app.publisher.browser import BrowserView

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_contentworkflowsmanager.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -23,11 +23,10 @@
 from zope.interface import Interface
 from zope.app.component.interface import nameToInterface
 from zope.app import zapi
-from zope.app.tests.functional import BrowserTestCase
-from zope.app.tests.setup import addUtility
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.utility.utility import LocalUtilityService
-from zope.app.utility.utility import UtilityRegistration
+from zope.app.testing.functional import BrowserTestCase
+from zope.app.testing.setup import addUtility
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.site import UtilityRegistration
 
 from zope.app.workflow.stateful.definition import StatefulProcessDefinition
 from zope.app.workflow.stateful.interfaces import IStatefulProcessDefinition,\
@@ -59,7 +58,7 @@
 
         root = self.getRootFolder()
         default = zapi.traverse(root, '/++etc++site/default')
-        rm = default.getRegistrationManager()
+        rm = default.registrationManager
         registration = UtilityRegistration(
             'cwm', IContentWorkflowsManager,
             zapi.traverse(root, self.basepath+'/mgr'))

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,7 +19,7 @@
 import re
 
 from zope.app import zapi
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.workflow.stateful.definition import StatefulProcessDefinition
 
 xml=u"""<?xml version="1.0"?>

Modified: Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/browser/instance.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -26,7 +26,6 @@
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.publisher.browser import BrowserView
-from zope.app.servicenames import Utilities
 
 from zope.app.workflow.interfaces import IProcessDefinition
 from zope.app.workflow.interfaces import IProcessInstanceContainer
@@ -123,8 +122,7 @@
 
 
     def _getProcessDefinition(self, processInstance):
-        utils = zapi.getService(Utilities)
-        return utils.getUtility(IProcessDefinition,
+        return zapi.getUtility(IProcessDefinition,
                                 processInstance.processDefinitionName)
 
 

Modified: Zope3/trunk/src/zope/app/workflow/stateful/instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/instance.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,8 +18,10 @@
 from persistent import Persistent
 from persistent.dict import PersistentDict
 
+from zope.event import notify
+
 from zope.app import zapi
-from zope.event import notify
+from zope.app.module import resolve
 from zope.app.workflow.interfaces import IProcessDefinition
 from zope.app.workflow.stateful.interfaces import AUTOMATIC
 from zope.app.workflow.stateful.interfaces import IAfterTransitionEvent
@@ -215,7 +217,7 @@
         self._checkAndFireAuto(clean_pd)
 
     def getProcessDefinition(self):
-        """Get the ProcessDefinition object from WorkflowService."""
+        """Get the ProcessDefinition object from Workflow Utility."""
         return zapi.getUtility(IProcessDefinition, self.processDefinitionName)
 
     def _getContext(self):
@@ -273,8 +275,8 @@
         if not script:
             return True
         if isinstance(script, (str, unicode)):
-            sm = zapi.getServices(self)
-            script = sm.resolve(script)
+            # XXX: not tested!
+            script = resolve(script)
         return script(contexts)
 
     def _outgoingTransitions(self, clean_pd):

Modified: Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_contentworkflow.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/stateful/tests/test_definition.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_definition.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_definition.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/stateful/tests/test_instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_instance.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/tests/test_instance.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/tests/test_instance.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/tests/test_instance.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/workflow/tests/workflowsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/workflow/tests/workflowsetup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,26 +16,22 @@
 $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.component.testing import PlacefulSetup
+from zope.app.testing import setup
 from zope.app.utility import LocalUtilityService
 
 
 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/trunk/src/zope/app/zapi/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/zapi/README.txt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zapi/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -29,7 +29,7 @@
   ...     zope.interface.implements(IAuthentication)
   >>> fake = FakeAuthenticationUtility()
   
-  >>> from zope.app.tests import ztapi
+  >>> from zope.app.testing import ztapi
   >>> ztapi.provideUtility(IAuthentication, fake)
 
 Then we should be able to get the service back when we ask for the

Modified: Zope3/trunk/src/zope/app/zapi/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/zapi/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zapi/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,13 +17,11 @@
 
 $Id$
 """
-
 from interfaces import IZAPI
 from zope.interface import moduleProvides
 
 from zope.security.proxy import isinstance
 
-from zope.app import servicenames
 from zope.app.interface import queryType
 
 moduleProvides(IZAPI)
@@ -31,6 +29,8 @@
 
 from zope.component import *
 
+from zope.app.publisher.browser import getDefaultViewName
+from zope.app.publisher.browser import queryDefaultViewName
 from zope.app.traversing.api import *
 from zope.app.traversing.browser.absoluteurl import absoluteURL
 from zope.app.exception.interfaces import UserError
@@ -41,3 +41,10 @@
     from zope.app.security.interfaces import IAuthentication
     return getUtility(IAuthentication)
 
+# BBB: Gone in 3.3.
+from zope.deprecation import deprecated
+from zope.app import servicenames
+
+deprecated('servicenames',
+           'The concept of services has been removed. Please use utilities '
+           'instead. This reference will be removed in Zope X3.3.')

Modified: Zope3/trunk/src/zope/app/zapi/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/zapi/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zapi/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,12 +17,14 @@
 """
 from zope.interface import Attribute
 from zope.component.interfaces import IComponentArchitecture
+from zope.app.publisher.browser import IDefaultViewNameAPI 
 from zope.app.traversing.interfaces import ITraversalAPI
 from zope.app.traversing.browser.interfaces import IAbsoluteURLAPI
 
 class IZAPI(
     IComponentArchitecture,
     ITraversalAPI, IAbsoluteURLAPI,
+    IDefaultViewNameAPI
     ):
     """Convenience API for use with Zope applications.
     """
@@ -68,8 +70,6 @@
         which would return IImage.
         """
         
-    servicenames = Attribute("Service Names")
-
     def isinstance(object, cls):
         """Test whether an object is an instance of the given type
 
@@ -82,6 +82,9 @@
         """
 
     def principals():
-        """Return the authentication service (someday utility)
+        """Return the authentication utility
         """
         
+    # BBB: Deprecated. Gone in X3.3.
+    servicenames = Attribute("Service Names")
+

Modified: Zope3/trunk/src/zope/app/zapi/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/zapi/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zapi/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -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/trunk/src/zope/app/zopeappgenerations/evolve1.py
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,20 +16,28 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
+import zope.deprecation
+
 from zope.app import zapi
+from zope.app.component.interfaces.registration import IRegistrationManager
+from zope.app.component.interfaces.registration import IRegisterableContainer
 from zope.app.error.error import ErrorReportingUtility
-from zope.app.error.interfaces import IErrorReportingService
 from zope.app.error.interfaces import IErrorReportingUtility
-from zope.app.generations.utility import findObjectsProviding
 from zope.app.principalannotation import PrincipalAnnotationUtility
 from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-from zope.app.principalannotation.interfaces import IPrincipalAnnotationService
-from zope.app.registration.interfaces import IComponentRegistration
-from zope.app.registration.interfaces import ActiveStatus, UnregisteredStatus
+from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.component.interfaces.registration import InactiveStatus 
+from zope.app.zopeappgenerations import getRootFolder
+
+# Imports that are only available via backward-compatibility
+zope.deprecation.__show__.off()
+from zope.component.bbb.service import IService
 from zope.app.site.interfaces import ISite, IServiceRegistration
 from zope.app.utility import UtilityRegistration
-from zope.app.zopeappgenerations import getRootFolder
+zope.deprecation.__show__.on()
 
+from zope.app.generations.utility import findObjectsProviding
+
 generation = 1
 
 def evolve(context):
@@ -46,83 +54,145 @@
     - Component-based registrations used to keep track of their components via
       the component's path. Now it stores the component directly. All
       registrations are updated to this new format.
+
+    - Conerts all service registrations to utility registrations providing
+      IService, which is the method used to simulate the old service API.
+
+    - Remove 'RegistrationManager' object from all site management folders.
+
+    - Remove all local adapter and utility service instances. 
     """
     root = getRootFolder(context)
 
-    # Fix up Principal Annotation Service --> Utility 
-    # We do this by simply removing old Principal Annotation Services and their
-    # registrations and then add a new Principal Annotation utility.
     for site in findObjectsProviding(root, ISite):
-        for reg in findObjectsProviding(site.getSiteManager(),
-                                        IServiceRegistration):
-        
-            if reg.name == 'PrincipalAnnotation':
-                ann = reg.component
-                # Set the registration to unregistered and then delete it
-                reg.status = UnregisteredStatus
-                del zapi.getParent(reg)[zapi.name(reg)]
-                # Get the instance dictionary from the old principal
-                # annotation service and then delete the service
-                props = ann.__dict__
-                name = zapi.name(ann)
-                folder = zapi.getParent(ann)
-                del folder[name]
+        sm = site.getSiteManager()
 
+        # Remove old registration manager instances
+        for rm in findObjectsProviding(sm, IRegistrationManager):
+            # Make sure that we called the new registration manager
+            # which will retrieve the old one, if necessary
+            zapi.getParent(rm).registrationManager = rm
 
-                # Only add a new principal annotation utility, if there is none.
-                utils = [obj for obj in folder.values()
-                         if isinstance(obj, PrincipalAnnotationUtility)]
-                if len(utils) == 0:
-                    # Create the principal annotation utility and set its
-                    # properties
-                    utility = PrincipalAnnotationUtility()
-                    utility.__dict__.update(props)
-                    folder[name] = utility
-                    # Register the utility and set the registration active
-                    reg = UtilityRegistration('', IPrincipalAnnotationUtility,
-                                              utility)
-                    reg_manager = folder.getRegistrationManager() 
-                    key = reg_manager.addRegistration(reg)
-                    reg_manager[key].status = ActiveStatus
+            # Do a hard core delete, because I want no whining and complaining
+            container = zapi.getParent(rm)
+            del container._SampleContainer__data[zapi.getName(rm)]
 
+            # Make sure the new registration manager has the correct name:
+            rm.__name__ = '++registrations++'
+            rm.__parent__ = container
 
+        for reg_container in findObjectsProviding(sm, IRegisterableContainer):
+            manager = reg_container.registrationManager
+
+            # Iterate through each registration and fix it up.
+            for reg in tuple(manager.values()):
+
+                # Regardless of registration type, we want to convert the
+                # component path to component  
+                if ('_BBB_componentPath' in reg.__dict__ and
+                    reg._BBB_componentPath is not None):
+
+                    reg.component = reg.getComponent()
+                    del reg.__dict__['_BBB_componentPath']
+
+                # Fixup and convert service registrations
+                if IServiceRegistration.providedBy(reg):
+                    if reg.name == 'ErrorLogging':
+                        fixupErrorLogging(reg_container, reg)
+
+                    elif reg.name == 'PrincipalAnnotation':
+                        fixupPrincipalAnnotation(reg_container, reg)
+
+                    elif reg.name in ('Utilities', 'Adapters'):
+                        # Delete the registration
+                        reg.status = InactiveStatus
+                        del manager[zapi.name(reg)]
+                        # Delete the component
+                        c = reg.component
+                        del zapi.getParent(c)[zapi.name(c)]
+
+                    else:
+                        # Handle all outstanding service registrations
+                        # Create a new utility registration
+                        new_reg = UtilityRegistration(reg.name, IService,
+                                                      reg.component)
+                        manager.addRegistration(new_reg)
+                        new_reg.status = ActiveStatus
+                        # Delete the old registration
+                        reg.status = InactiveStatus
+                        del manager[zapi.getName(reg)]
+
+                # Fixup utility registrations
+                else:
+                    # Getting the provided interface converts the utility
+                    # registration automatically from 'interface' -> 'provided'
+                    reg.provided
+                    # Now let's reactivate the utility, so it will be
+                    # available within the new framework
+                    orig = reg.status
+                    reg.status = InactiveStatus
+                    reg.status = orig
+                    
+
+def fixupErrorLogging(reg_container, reg):
     # Fix up Error Reporting Service --> Utility 
     # We do this by simply removing old Error Reporting Services and their
     # registrations and then add a new error reporting utility.
-    for site in findObjectsProviding(root, ISite):
-        for reg in findObjectsProviding(site.getSiteManager(),
-                                        IServiceRegistration):
-        
-            if reg.name == 'ErrorLogging':
-                errors = reg.component
-                # Set the registration to unregistered and then delete it
-                reg.status = UnregisteredStatus
-                del zapi.getParent(reg)[zapi.name(reg)]
-                # Get the properties from the old error reporting service and
-                # delete it
-                props = errors.getProperties()
-                folder = zapi.getParent(errors)
-                del folder[zapi.name(errors)]
 
-                # Only add a new error reporting utility, if there is none.
-                if 'ErrorReporting' not in folder:
-                    # Create the error reporting utility and set its properties
-                    utility = ErrorReportingUtility()
-                    utility.setProperties(**props)
-                    folder['ErrorReporting'] = utility
-                    # Register the utility and set the registration active
-                    reg = UtilityRegistration('', IErrorReportingUtility,
-                                              utility)
-                    reg_manager = folder.getRegistrationManager() 
-                    key = reg_manager.addRegistration(reg)
-                    reg_manager[key].status = ActiveStatus
+    errors = reg.component
+    # Set the registration to unregistered and then delete it
+    reg.status = InactiveStatus
+    del zapi.getParent(reg)[zapi.name(reg)]
+    # Get the properties from the old error reporting service and
+    # delete it
+    props = errors.getProperties()
+    folder = zapi.getParent(errors)
+    del folder._SampleContainer__data[zapi.name(errors)]
+    
+    # Only add a new error reporting utility, if there is none.
+    if 'ErrorReporting' not in folder:
+        # Create the error reporting utility and set its properties
+        utility = ErrorReportingUtility()
+        utility.setProperties(**props)
+        folder['ErrorReporting'] = utility
+        # Register the utility and set the registration active
+        reg = UtilityRegistration('', IErrorReportingUtility, utility)
+        reg_manager = folder.registrationManager
+        key = reg_manager.addRegistration(reg)
+        reg_manager[key].status = ActiveStatus
+    else:
+        # If there is one, then at least move the data
+        folder['ErrorReporting'].__dict__.update(props)
 
 
-    # Fix up registration `componentPath` --> `component`
-    sites = findObjectsProviding(root, ISite)
-    for site in sites:
-        registrations = findObjectsProviding(site.getSiteManager(),
-                                             IComponentRegistration)
-        for reg in registrations:
-            if reg._BBB_componentPath is not None:
-                reg.component = reg.getComponent()
+def fixupPrincipalAnnotation(reg_container, reg):
+    # Fix up Principal Annotation Service --> Utility 
+    ann = reg.component
+    # Set the registration to inactive and then delete it
+    reg.status = InactiveStatus
+    del zapi.getParent(reg)[zapi.name(reg)]
+    # Get the instance dictionary from the old principal
+    # annotation service and then delete the service
+    props = ann.__dict__
+    name = zapi.name(ann)
+    folder = zapi.getParent(ann)
+    del folder._SampleContainer__data[name]
+    
+    # Only add a new principal annotation utility, if there is none.
+    utils = [obj for obj in folder.values()
+             if IPrincipalAnnotationUtility.providedBy(obj)]
+    if len(utils) == 0:
+        # Create the principal annotation utility and set its
+        # properties
+        utility = PrincipalAnnotationUtility()
+        utility.__dict__.update(props)
+        folder[name] = utility
+        # Register the utility and set the registration active
+        reg = UtilityRegistration('', IPrincipalAnnotationUtility,
+                                  utility)
+        reg_manager = folder.getRegistrationManager() 
+        key = reg_manager.addRegistration(reg)
+        reg_manager[key].status = ActiveStatus
+    else:
+        # If there is one, then at least move the data
+        utils[0].__dict__.update(props)

Modified: Zope3/trunk/src/zope/app/zopetop/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/zopetop/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zopetop/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 __docformat__ = 'restructuredtext'
 import unittest
 
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 
 class ZopeTopSkinTests(BrowserTestCase):
     """Funcional tests for ZopeTop skin."""

Modified: Zope3/trunk/src/zope/app/zopetop/widget_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/zopetop/widget_macros.pt	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zopetop/widget_macros.pt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -50,8 +50,8 @@
       </div>
     </div>
 
-    <div class="box" metal:define-macro="services_box">
-      <h5 i18n:translate="">Services</h5>
+    <div class="box" metal:define-macro="rools_box">
+      <h5 i18n:translate="">Tools</h5>
       <div class="body">
         <div class="content even">
           <img src="user_accounts.gif" width="22" height="28"

Modified: Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/ftests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zptpage/browser/ftests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,7 +16,7 @@
 $Id: ftests.py 25177 2004-06-02 13:17:31Z jim $
 """
 import unittest
-from zope.app.tests.functional import BrowserTestCase
+from zope.app.testing.functional import BrowserTestCase
 from zope.app.zptpage.zptpage import ZPTPage
 from xml.sax.saxutils import escape
 
@@ -174,7 +174,7 @@
 
 
 def test_suite():
-    from zope.app.tests.functional import FunctionalDocFileSuite
+    from zope.app.testing.functional import FunctionalDocFileSuite
     return unittest.TestSuite((
         unittest.makeSuite(ZPTPageTest),
         FunctionalDocFileSuite('collector266.txt', 'collector269.txt'),

Modified: Zope3/trunk/src/zope/app/zptpage/tests/test_zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/tests/test_zptpage.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zptpage/tests/test_zptpage.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,18 +22,17 @@
 from zope.interface.verify import verifyClass
 from zope.security.interfaces import Forbidden
 
-from zope.app.tests import ztapi
-from zope.component import getView
+from zope.app import zapi
+from zope.app.testing import ztapi
 from zope.publisher.browser import TestRequest
 from zope.app.publisher.browser import BrowserView
 
 # Wow, this is a lot of work. :(
-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.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
@@ -228,7 +227,7 @@
         page.setSource(html, content_type='text/plain')
         request = TestRequest()
 
-        view = getView(page, 'source.html', request)
+        view = zapi.getMultiAdapter((page, request), name='source.html')
 
         self.assertEqual(str(view), html)
         self.assertEqual(view(), html)

Modified: Zope3/trunk/src/zope/app/zptpage/textindex/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/textindex/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zptpage/textindex/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -17,8 +17,8 @@
 """
 
 from zope.index.text.interfaces import ISearchableText
-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.zptpage.interfaces import IZPTPage
 from zope.app.zptpage.textindex.zptpage import SearchableText
 from zope.app.zptpage.zptpage import ZPTPage

Modified: Zope3/trunk/src/zope/app/zptpage/zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/zptpage.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/app/zptpage/zptpage.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -152,12 +152,9 @@
         page.setSource(data.decode('UTF-8'), content_type or 'text/html')
         return page
 
-class ZPTSourceView(object):
+from zope.app.publisher.browser import BrowserView
+class ZPTSourceView(BrowserView):
 
-    def __init__(self, context, request):
-        self.context = context
-        self.request = request
-
     def __str__(self):
         return self.context.getSource()
 

Modified: Zope3/trunk/src/zope/component/__init__.py
===================================================================
--- Zope3/trunk/src/zope/component/__init__.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/__init__.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,18 +16,58 @@
 $Id$
 """
 import sys
-import warnings
 import zope.interface
-from zope.interface import moduleProvides, Interface, providedBy
-from zope.interface.interfaces import IInterface
-from zope.component.interfaces import IComponentArchitecture, IFactory
+from zope.interface import moduleProvides, Interface
+from zope.interface import providedBy, implementedBy
+from zope.component.interfaces import IComponentArchitecture
 from zope.component.interfaces import IComponentRegistrationConvenience
-from zope.component.interfaces import IServiceService
 from zope.component.interfaces import IDefaultViewName
-from zope.component.exceptions import ComponentLookupError
-from zope.component.service import serviceManager
-from zope.component.servicenames import Adapters, Utilities
+from zope.component.interfaces import IFactory
+from zope.component.interfaces import ISiteManager
+from zope.component.interfaces import ComponentLookupError
+from zope.component.site import globalSiteManager
 
+##############################################################################
+# BBB: Import some backward-compatibility; 12/10/2004
+from zope.component.bbb import exceptions
+sys.modules['zope.component.exceptions'] = exceptions
+from zope.component.bbb import service
+sys.modules['zope.component.service'] = service
+from zope.component.bbb import adapter
+sys.modules['zope.component.adapter'] = adapter
+from zope.component.bbb import utility
+sys.modules['zope.component.utility'] = utility
+from zope.component.bbb import servicenames
+sys.modules['zope.component.servicenames'] = servicenames
+from zope.component.bbb import contextdependent
+sys.modules['zope.component.contextdependent'] = contextdependent
+
+from zope.component.bbb import tests as bbb_tests
+bbb_tests.__warn__ = False
+from zope.component.bbb.tests import placelesssetup
+sys.modules['zope.component.tests.placelesssetup'] = placelesssetup
+from zope.component.bbb.tests import request
+sys.modules['zope.component.tests.request'] = request
+from zope.component.bbb.tests import components
+sys.modules['zope.component.tests.components'] = components
+bbb_tests.__warn__ = True
+
+service.__warn__ = False
+service.serviceManager = service.GlobalServiceManager(
+    'serviceManager', __name__, globalSiteManager)
+service.__warn__ = True
+
+from zope.component.bbb import getGlobalServices, getGlobalService
+from zope.component.bbb import getServices, getService
+from zope.component.bbb import getServiceDefinitions
+from zope.component.bbb import getView, queryView
+from zope.component.bbb import getMultiView, queryMultiView
+from zope.component.bbb import getViewProviding, queryViewProviding
+from zope.component.bbb import getDefaultViewName, queryDefaultViewName
+from zope.component.bbb import getResource, queryResource
+##############################################################################
+
+
 # Try to be hookable. Do so in a try/except to avoid a hard dependency.
 try:
     from zope.hookable import hookable
@@ -38,65 +78,27 @@
 moduleProvides(IComponentArchitecture, IComponentRegistrationConvenience)
 __all__ = tuple(IComponentArchitecture)
 
-def warningLevel():
-    """Returns the number of the first stack frame outside of zope.component"""
-    try:
-        level = 2
-        while sys._getframe(level).f_globals['__name__'] == 'zope.component':
-            level += 1
-        return level
-    except ValueError:
-        return 2
+# SiteManager API
 
-def getGlobalServices():
-    return serviceManager
+def getGlobalSiteManager():
+    return globalSiteManager
 
-def getGlobalService(name):
-    return serviceManager.getService(name)
-
-def getServices(context=None):
+def getSiteManager(context=None):
     if context is None:
-        return serviceManager
+        return getGlobalSiteManager()
     else:
-        # Use the global service manager to adapt context to IServiceService
-        # to avoid the recursion implied by using a local getAdapter call.
+        # Use the global site manager to adapt context to `ISiteManager`
+        # to avoid the recursion implied by using a local `getAdapter()` call.
         try:
-            return IServiceService(context)
+            return ISiteManager(context)
         except TypeError, error:
             raise ComponentLookupError(*error.args)
 
-getServices = hookable(getServices)
+getSiteManager = hookable(getSiteManager)
 
-def getService(name, context=None):
-    return getServices(context).getService(name)
 
-def getServiceDefinitions(context=None):
-    return getServices(context).getServiceDefinitions()
+# Adapter API
 
-# Utility service
-
-def getUtility(interface, name='', context=None):
-    return getService(Utilities, context=context).getUtility(interface, name)
-
-def queryUtility(interface, name='', default=None, context=None):
-    return getService(Utilities, context).queryUtility(
-        interface, name, default)
-
-def getUtilitiesFor(interface, context=None):
-    if not IInterface.providedBy(interface):
-        raise TypeError("getUtilitiesFor got nonsense arguments."
-                        " Check that you are updated with the"
-                        " component API change.")
-    return getService(Utilities, context).getUtilitiesFor(interface)
-
-
-def getAllUtilitiesRegisteredFor(interface, context=None):
-    return getService(Utilities, context
-                      ).getAllUtilitiesRegisteredFor(interface)
-
-
-# Adapter service
-
 def getAdapterInContext(object, interface, context):
     adapter = queryAdapterInContext(object, interface, context)
     if adapter is None:
@@ -128,166 +130,54 @@
     if interface.providedBy(object):
         return object
 
-    adapters = getService(Adapters, context)
-    return adapters.queryAdapter(object, interface, '', default)
+    return getSiteManager(context).queryAdapter(object, interface, '', default)
 
-def getAdapter(object, interface, name, context=None):
+def getAdapter(object, interface=Interface, name=u'', context=None):
     adapter = queryAdapter(object, interface, name, None, context)
     if adapter is None:
         raise ComponentLookupError(object, interface, name)
     return adapter
 
-def adapter_hook(interface, object, name='', default=None):
-    try:
-        adapters = getService(Adapters)
-    except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running
-        # from a test
-        return None
-    return adapters.queryAdapter(object, interface, name, default)
-adapter_hook = hookable(adapter_hook)
-
-import zope.interface.interface
-zope.interface.interface.adapter_hooks.append(adapter_hook)
-
-def queryAdapter(object, interface, name, default=None, context=None):
+def queryAdapter(object, interface=Interface, name=u'', default=None,
+                 context=None):
     if context is None:
         return adapter_hook(interface, object, name, default)
-    adapters = getService(Adapters, context)
-    return adapters.queryAdapter(object, interface, name, default)
+    return getSiteManager(context).queryAdapter(object, interface, name,
+                                                default)
 
-def getMultiAdapter(objects, interface, name=u'', context=None):
+def getMultiAdapter(objects, interface=Interface, name=u'', context=None):
     adapter = queryMultiAdapter(objects, interface, name, context=context)
     if adapter is None:
         raise ComponentLookupError(objects, interface, name)
     return adapter
 
-def queryMultiAdapter(objects, interface, name=u'', default=None,
+def queryMultiAdapter(objects, interface=Interface, name=u'', default=None,
                       context=None):
     try:
-        adapters = getService(Adapters, context)
+        sitemanager = getSiteManager(context)
     except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running from a test
+        # Oh blast, no site manager. This should *never* happen!
         return default
 
-    return adapters.queryMultiAdapter(objects, interface, name, default)
+    return sitemanager.queryMultiAdapter(objects, interface, name, default)
 
 def getAdapters(objects, provided, context=None):
     try:
-        adapters = getService(Adapters, context)
+        sitemanager = getSiteManager(context)
     except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running from a test
+        # Oh blast, no site manager. This should *never* happen!
         return []
-    return [(name, adapter(*objects))
-            for name, adapter in adapters.lookupAll(map(providedBy, objects),
-                                                    provided)
-            ]
+    return sitemanager.getAdapters(objects, provided)
 
 def subscribers(objects, interface, context=None):
     try:
-        adapters = getService(Adapters, context=context)
+        sitemanager = getSiteManager(context)
     except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running from a test
+        # Oh blast, no site manager. This should *never* happen!
         return []
-    return adapters.subscribers(objects, interface)
+    return sitemanager.subscribers(objects, interface)
 
-
-# Factories
-
-def createObject(context, name, *args, **kwargs):
-    return getUtility(IFactory, name, context)(*args, **kwargs)
-
-def getFactoryInterfaces(name, context=None):
-    return getUtility(IFactory, name, context).getInterfaces()
-
-def getFactoriesFor(interface, context=None):
-    utils = getService(Utilities, context)
-    for (name, factory) in utils.getUtilitiesFor(IFactory):
-        interfaces = factory.getInterfaces()
-        try:
-            if interfaces.isOrExtends(interface):
-                yield name, factory
-        except AttributeError:
-            for iface in interfaces:
-                if iface.isOrExtends(interface):
-                    yield name, factory
-                    break
-
-
-# Presentation API
-
-def getView(object, name, request, providing=Interface, context=None):
-    view = queryView(object, name, request, context=context,
-                     providing=providing)
-    if view is not None:
-        return view
-
-    raise ComponentLookupError("Couldn't find view",
-                               name, object, context, request, providing)
-
-def queryView(object, name, request,
-              default=None, providing=Interface, context=None):
-    return queryMultiAdapter((object, request), providing, name,
-                             default, context)
-
-queryView = hookable(queryView)
-
-def getMultiView(objects, request, providing=Interface, name='', context=None):
-    view = queryMultiView(objects, request, providing, name, context=context)
-    if view is not None:
-        return view
-
-    raise ComponentLookupError("Couldn't find view",
-                               name, objects, context, request)
-
-def queryMultiView(objects, request, providing=Interface, name='',
-                   default=None, context=None):
-    return queryMultiAdapter(objects+(request,), providing, name,
-                             default, context)
-
-def getViewProviding(object, providing, request, context=None):
-    return getView(object, '', request, providing, context)
-
-def queryViewProviding(object, providing, request, default=None, 
-                       context=None):
-    return queryView(object, '', request, default, providing, context)
-
-def getDefaultViewName(object, request, context=None):
-    view = queryDefaultViewName(object, request, context=context)
-    if view is not None:
-        return view
-
-    raise ComponentLookupError("Couldn't find default view name",
-                               context, request)
-
-def queryDefaultViewName(object, request, default=None, context=None):
-    try:
-        adapters = getService(Adapters, context)
-    except ComponentLookupError:
-        # Oh blast, no adapter service. We're probably just running from a test
-        return default
-
-    name = adapters.lookup(map(providedBy, (object, request)), IDefaultViewName)
-    if name is not None:
-        return name
-    return default
-
-def getResource(name, request, providing=Interface, context=None):
-    view = queryResource(name, request, providing=providing, context=context)
-    if view is not None:
-        return view
-
-    raise ComponentLookupError("Couldn't find resource", name, request)
-
-def queryResource(name, request, default=None, providing=Interface,
-                  context=None):
-    return queryAdapter(request, providing, name, default, context)
-
-
-# The following apis provide registration support for Python code:
-
 class _adapts_descr(object):
-
     def __init__(self, interfaces):
         self.interfaces = interfaces
 
@@ -312,6 +202,70 @@
 
     locals['__component_adapts__'] = _adapts_descr(interfaces)
 
+#############################################################################
+# Register the component architectures adapter hook, with the adapter hook
+# registry of the `zope.inteface` package. This way we will be able to call
+# interfaces to create adapters for objects. For example, `I1(ob)` is
+# equvalent to `getAdapterInContext(I1, ob, '')`.
+def adapter_hook(interface, object, name='', default=None):
+    try:
+        sitemanager = getSiteManager()
+    except ComponentLookupError:
+        # Oh blast, no site manager. This should *never* happen!
+        return None
+    return sitemanager.queryAdapter(object, interface, name, default)
+
+# Make the component architecture's adapter hook hookable 
+adapter_hook = hookable(adapter_hook)
+
+import zope.interface.interface
+zope.interface.interface.adapter_hooks.append(adapter_hook)
+#############################################################################
+
+
+# Utility API
+
+def getUtility(interface, name='', context=None):
+    utility = queryUtility(interface, name, context=context)
+    if utility is not None:
+        return utility
+    raise ComponentLookupError(interface, name)
+
+def queryUtility(interface, name='', default=None, context=None):
+    return getSiteManager(context).queryUtility(interface, name, default)
+
+def getUtilitiesFor(interface, context=None):
+    return getSiteManager(context).getUtilitiesFor(interface)
+
+
+def getAllUtilitiesRegisteredFor(interface, context=None):
+    return getSiteManager(context).getAllUtilitiesRegisteredFor(interface)
+
+
+# Factories
+
+def createObject(context, name, *args, **kwargs):
+    return getUtility(IFactory, name, context)(*args, **kwargs)
+
+def getFactoryInterfaces(name, context=None):
+    return getUtility(IFactory, name, context).getInterfaces()
+
+def getFactoriesFor(interface, context=None):
+    utils = getSiteManager(context)
+    for (name, factory) in utils.getUtilitiesFor(IFactory):
+        interfaces = factory.getInterfaces()
+        try:
+            if interfaces.isOrExtends(interface):
+                yield name, factory
+        except AttributeError:
+            for iface in interfaces:
+                if iface.isOrExtends(interface):
+                    yield name, factory
+                    break
+
+
+# The following APIs provide registration support for Python code:
+
 def provideUtility(component, provides=None, name=u''):
     if provides is None:
         provides = list(providedBy(component))
@@ -320,11 +274,15 @@
         else:
             raise TypeError("Missing 'provides' argument")
 
-    getGlobalService('Utilities').provideUtility(provides, component, name)
+    getGlobalSiteManager().provideUtility(provides, component, name)
 
+
 def provideAdapter(factory, adapts=None, provides=None, name=''):
     if provides is None:
-        provides = list(zope.interface.implementedBy(factory))
+        if IFactory.providedBy(factory):
+            provides = factory.getInterfaces()
+        else:
+            provides = list(implementedBy(factory))
         if len(provides) == 1:
             provides = provides[0]
         else:
@@ -336,6 +294,4 @@
         except AttributeError:
             raise TypeError("Missing 'adapts' argument")
             
-    getGlobalService('Adapters').register(adapts, provides, name, factory)
-    
-    
+    getGlobalSiteManager().provideAdapter(adapts, provides, name, factory)

Deleted: Zope3/trunk/src/zope/component/adapter.py
===================================================================
--- Zope3/trunk/src/zope/component/adapter.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/adapter.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,212 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Global Adapter Service
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-import sys
-import warnings
-from types import ClassType
-
-from zope.component.exceptions import ComponentLookupError
-from zope.component.interfaces import IAdapterService, IRegistry
-from zope.component.service import GlobalService
-from zope.interface.adapter import AdapterRegistry
-from zope.interface import implements, providedBy, Interface, implementedBy
-from zope.interface.interfaces import IInterface
-
-class IGlobalAdapterService(IAdapterService, IRegistry):
-
-    def register(required, provided, name, factory, info=''):
-        """Register an adapter factory
-
-        :Parameters:
-          - `required`: a sequence of specifications for objects to be
-             adapted. 
-          - `provided`: The interface provided by the adapter
-          - `name`: The adapter name
-          - `factory`: The object used to compute the adapter
-          - `info`: Provide some info about this particular adapter.
-        """
-
-    def subscribe(required, provided, factory, info=''):
-        """Register a subscriber factory
-
-        :Parameters:
-          - `required`: a sequence of specifications for objects to be
-             adapted. 
-          - `provided`: The interface provided by the adapter
-          - `name`: The adapter name
-          - `factory`: The object used to compute the subscriber
-          - `info`: Provide some info about this particular adapter.
-        """
-
-class AdapterService(AdapterRegistry):
-    """Base implementation of an adapter service, implementing only the
-    'IAdapterService' interface.
-
-    No write-methods were implemented.
-    """
-
-    implements(IAdapterService)
-
-class GlobalAdapterService(AdapterService, GlobalService):
-    """Global Adapter Service implementation."""
-
-    implements(IGlobalAdapterService)
-
-    def __init__(self):
-        AdapterRegistry.__init__(self)
-        self._registrations = {}
-
-    def register(self, required, provided, name, factory, info=''):
-        """Register an adapter
-
-        >>> registry = GlobalAdapterService()
-        >>> class R1(Interface):
-        ...     pass
-        >>> class R2(R1):
-        ...     pass
-        >>> class P1(Interface):
-        ...     pass
-        >>> class P2(P1):
-        ...     pass
-
-        >>> registry.register((R1, ), P2, 'bob', 'c1', 'd1')
-        >>> registry.register((R1, ), P2,    '', 'c2', 'd2')
-        >>> registry.lookup((R2, ), P1, '')
-        'c2'
-
-        >>> registrations = map(repr, registry.registrations())
-        >>> registrations.sort()
-        >>> for registration in registrations:
-        ...    print registration
-        AdapterRegistration(('R1',), 'P2', '', 'c2', 'd2')
-        AdapterRegistration(('R1',), 'P2', 'bob', 'c1', 'd1')
-
-        Let's make sure that we can also register regular classes for
-        adaptation.
-
-        >>> class O1(object):
-        ...     pass
-        >>> class O2(object):
-        ...     pass
-        >>> class O3(object):
-        ...     def __init__(self, obj1, obj2=None):
-        ...         pass
-
-        >>> registry.register((O1, ), R1, '', O3)
-        >>> registry.queryAdapter(O1(), R1, '').__class__
-        <class 'zope.component.adapter.O3'>
-
-        >>> registry.register((O1, O2), R1, '', O3)
-        >>> registry.queryMultiAdapter((O1(), O2()), R1, '').__class__
-        <class 'zope.component.adapter.O3'>
-        """
-        ifaces = []
-        for iface in required:
-            if not IInterface.providedBy(iface) and iface is not None:
-                if not isinstance(iface, (type, ClassType)):
-                    raise TypeError(iface, IInterface)
-                iface = implementedBy(iface)
-
-            ifaces.append(iface)
-        required = tuple(ifaces)
-
-        self._registrations[(required, provided, name)] = AdapterRegistration(
-            required, provided, name, factory, info)
-
-        AdapterService.register(self, required, provided, name, factory)
-
-    def subscribe(self, required, provided, factory, info=''):
-        """Register a subscriptions adapter
-
-        >>> registry = GlobalAdapterService()
-        >>> class R1(Interface):
-        ...     pass
-        >>> class R2(R1):
-        ...     pass
-        >>> class P1(Interface):
-        ...     pass
-        >>> class P2(P1):
-        ...     pass
-
-        >>> registry.subscribe((R1, ), P2, 'c1', 'd1')
-        >>> registry.subscribe((R1, ), P2, 'c2', 'd2')
-        >>> subscriptions = map(str, registry.subscriptions((R2, ), P1))
-        >>> subscriptions.sort()
-        >>> subscriptions
-        ['c1', 'c2']
-
-        >>> registrations = map(repr, registry.registrations())
-        >>> registrations.sort()
-        >>> for registration in registrations:
-        ...    print registration
-        SubscriptionRegistration(('R1',), 'P2', 'c1', 'd1')
-        SubscriptionRegistration(('R1',), 'P2', 'c2', 'd2')
-
-        """
-        required = tuple(required)
-
-        registration = SubscriptionRegistration(
-            required, provided, factory, info)
-
-        self._registrations[(required, provided)] = (
-            self._registrations.get((required, provided), ())
-            +
-            (registration, )
-            )
-
-        AdapterService.subscribe(self, required, provided, factory)
-
-    def registrations(self):
-        for registration in self._registrations.itervalues():
-            if isinstance(registration, tuple):
-                for r in registration:
-                    yield r
-            else:
-                yield registration
-
-
-class AdapterRegistration(object):
-    """Registration for a simple adapter."""
-
-    def __init__(self, required, provided, name, value, doc=''):
-        (self.required, self.provided, self.name, self.value, self.doc
-         ) = required, provided, name, value, doc
-
-    def __repr__(self):
-        return '%s(%r, %r, %r, %r, %r)' % (
-            self.__class__.__name__,
-            tuple([getattr(r, '__name__', None) for r in self.required]),
-            self.provided.__name__, self.name,
-            self.value, self.doc,
-            )
-
-
-class SubscriptionRegistration(object):
-    """Registration for a subscription adapter."""
-
-    def __init__(self, required, provided, value, doc):
-        (self.required, self.provided, self.value, self.doc
-         ) = required, provided, value, doc
-
-    def __repr__(self):
-        return '%s(%r, %r, %r, %r)' % (
-            self.__class__.__name__,
-            tuple([getattr(r, '__name__', None) for r in self.required]),
-            self.provided.__name__, self.value, self.doc,
-            )

Copied: Zope3/trunk/src/zope/component/bbb (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/bbb)

Deleted: Zope3/trunk/src/zope/component/contextdependent.py
===================================================================
--- Zope3/trunk/src/zope/component/contextdependent.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/contextdependent.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,27 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""A simple mix-in class that implements IContextDependent. 
-
-$Id$
-"""
-from zope.component.interfaces import IContextDependent
-from zope.interface import implements
-
-class ContextDependent(object):
-    """standard boilerplate for context dependent objects"""
-
-    implements(IContextDependent)
-
-    def __init__(self, context):
-        self.context = context

Deleted: Zope3/trunk/src/zope/component/exceptions.py
===================================================================
--- Zope3/trunk/src/zope/component/exceptions.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/exceptions.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Exceptions used by the Component Architecture
-
-$Id$
-"""
-from zope.exceptions import NotFoundError
-
-__all__ = ["ComponentLookupError",
-           "Invalid",
-           "Misused"]
-
-class ComponentLookupError(NotFoundError):
-    """A component could not be found."""
-
-class Invalid(Exception):
-    """A component doesn't satisfy a promise."""
-
-class Misused(Exception):
-    """A component is being used (registered) for the wrong interface."""

Copied: Zope3/trunk/src/zope/component/factory.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/factory.txt)


Property changes on: Zope3/trunk/src/zope/component/factory.txt
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.6
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/component/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/component/interfaces.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/interfaces.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -16,60 +16,47 @@
 $Id$
 """
 from zope.interface import Interface, Attribute
-from zope.component.exceptions import *
+from zope.exceptions import NotFoundError
 
-class IComponentArchitecture(Interface):
-    """The Component Architecture is defined by six key services,
-    all of which are managed by service managers.
-    """
+# BBB: Backward-compatibility; 12/05/2004
+from bbb.interfaces import *
 
-    # basic service manager tools
 
-    def getGlobalServices():
-        """Get the global service manager."""
+class ComponentLookupError(NotFoundError):
+    """A component could not be found."""
 
-    def getGlobalService(name):
-        """Get a global service."""
+class Invalid(Exception):
+    """A component doesn't satisfy a promise."""
 
-    def getServices(context=None):
-        """Get the service manager
+class Misused(Exception):
+    """A component is being used (registered) for the wrong interface."""
 
-        If context is None, an application-defined policy is used to choose
-        an appropriate service manager.
 
-        If 'context' is not None, context is adapted to IServiceService, and
-        this adapter is returned.
-        """
+class IComponentArchitecture(Interface, IBBBComponentArchitecture):
+    """The Component Architecture is defined by two key components: Adapters
+    and Utiltities. Both are managed by site managers. All other components
+    build on top of them.
+    """
+    # Site Manager API
 
-    def getService(name, context=None):
-        """Get a named service.
+    def getGlobalSiteManager():
+        """Return the global site manager.
 
-        Returns the service defined by 'name' from the service manager.
-
-        If context is None, an application-defined policy is used to choose
-        an appropriate service manager.
-
-        If 'context' is not None, context is adapted to IServiceService, and
-        this adapter is returned.
+        This function should never fail and always return an object that
+        provides `IGlobalSiteManager`.
         """
 
-    def getServiceDefinitions(context=None):
-        """Get service definitions
+    def getSiteManager(context=None):
+        """Get the nearest site manager in the given context.
 
-        Returns a dictionary of the service definitions from the service
-        manager in the format {nameString: serviceInterface}.
+        If `context` is `None`, return the global site manager.
 
-        The default behavior of placeful service managers is to include
-        service definitions above them, but this can be overridden.
-
-        If context is None, an application-defined policy is used to choose
-        an appropriate service manager.
-
-        If 'context' is not None, context is adapted to IServiceService, and
-        this adapter is returned.
+        If the `context` is not `None`, it is expected that an adapter from
+        the `context` to `ISiteManager` can be found. If no adapter is found,
+        a `ComponentLookupError` is raised.
         """
 
-    # Utility service
+    # Utility API
 
     def getUtility(interface, name='', context=None):
         """Get the utility that provides interface
@@ -101,9 +88,9 @@
         returned.
         """
 
-    # Adapter service
+    # Adapter API
 
-    def getAdapter(object, interface, name, context=''):
+    def getAdapter(object, interface=Interface, name=u'', context=None):
         """Get a named adapter to an interface for an object
 
         Returns an adapter that can adapt object to interface.  If a matching
@@ -138,7 +125,7 @@
         returned.
         """
 
-    def getMultiAdapter(objects, interface, name='', context=None):
+    def getMultiAdapter(objects, interface=Interface, name='', context=None):
         """Look for a multi-adapter to an interface for an objects
 
         Returns a multi-adapter that can adapt objects to interface.  If a
@@ -155,7 +142,8 @@
         named adapter methods with an empty string for a name.
         """
 
-    def queryAdapter(object, interface, name, default=None, context=None):
+    def queryAdapter(object, interface=Interface, name=u'', default=None,
+                     context=None):
         """Look for a named adapter to an interface for an object
 
         Returns an adapter that can adapt object to interface.  If a matching
@@ -190,7 +178,7 @@
         returned.
         """
 
-    def queryMultiAdapter(objects, interface, name='', default=None,
+    def queryMultiAdapter(objects, interface=Interface, name=u'', default=None,
                           context=None):
         """Look for a multi-adapter to an interface for objects
 
@@ -237,7 +225,14 @@
         and this adapter's 'Adapters' service is used.
         """
 
+    def adapts(*interfaces):
+        """Declare that a class adapts the given interfaces.
 
+        This function can only be used in a class definition.
+
+        (TODO, allow classes to be passed as well as interfaces.)
+        """
+
     # Factory service
 
     # TODO: Hard to make context a keyword, leaving as it is. Maybe we should
@@ -265,126 +260,76 @@
         create objects which implement the given interface.
         """
 
-    # Presentation service
 
-    def getView(object, name, request, providing=Interface, context=None):
-        """Get a named view for a given object.
+class ISiteManager(Interface):
+    """Component Manager for a Site
 
-        The request must implement IPresentationRequest: it provides
-        the view type and the skin name.  The nearest one to the
-        object is found. If a matching view cannot be found, raises
-        ComponentLookupError.
-        """
+    This object manages the components registered at a particular site. The
+    definition of a site is intentionally vague.
+    """
 
-    def queryView(object, name, request,
-                  default=None, providing=Interface, context=None):
-        """Look for a named view for a given object.
+    adapters = Attribute("Adapter Registry to manage all registered "
+                         "adapters.")
 
-        The request must implement IPresentationRequest: it provides
-        the view type and the skin name.  The nearest one to the
-        object is found.  If a matching view cannot be found, returns
-        default.
+    utilities = Attribute("Adapter Registry to manage all registered "
+                          "utilities.")
 
-        If context is not specified, attempts to use object to specify
-        a context.
-        """
+    def queryAdapter(object, interface, name, default=None):
+        """Look for a named adapter to an interface for an object
 
-    def getMultiView(objects, request, providing=Interface, name='',
-                     context=None):
-        """Look for a multi-view for given objects
+        If a matching adapter cannot be found, returns the default.
 
-        The request must implement IPresentationRequest: it provides
-        the view type and the skin name.  The nearest one to the
-        object is found.  If a matching view cannot be found, raises
-        ComponentLookupError.
-
-        If context is not specified, attempts to use the first object
-        to specify a context.
+        The name consisting of an empty string is reserved for unnamed
+        adapters. The unnamed adapter methods will often call the
+        named adapter methods with an empty string for a name.
         """
 
-    def queryMultiView(objects, request, providing=Interface, name='',
-                       default=None, context=None):
-        """Look for a multi-view for given objects
+    def queryMultiAdapter(objects, interface, name, default=None):
+        """Look for a multi-adapter to an interface for an object
 
-        The request must implement IPresentationRequest: it provides
-        the view type and the skin name.  The nearest one to the
-        object is found.  If a matching view cannot be found, returns
-        default.
+        If a matching adapter cannot be found, returns the default.
 
-        If context is not specified, attempts to use the first object
-        to specify a context.
+        The name consisting of an empty string is reserved for unnamed
+        adapters. The unnamed adapter methods will often call the
+        named adapter methods with an empty string for a name.
         """
 
-    def getViewProviding(object, providing, request, context=None):
-        """Look for a view based on the interface it provides.
+    def getAdapters(objects, provided):
+        """Look for all matching adapters to a provided interface for objects
 
-        A call to this method is equivalent to:
-
-            getView(object, '', request, context, providing)
+        Return a list of adapters that match. If an adapter is named, only the
+        most specific adapter of a given name is returned.
         """
 
-    def queryViewProviding(object, providing, request,
-                           default=None, context=None):
-        """Look for a view that provides the specified interface.
+    def subscribers(required, provided):
+        """Get subscribers
 
-        A call to this method is equivalent to:
-
-            queryView(object, '', request, default, context, providing)
+        Subscribers are returned that provide the provided interface
+        and that depend on and are comuted from the sequence of
+        required objects.
         """
 
-    def getDefaultViewName(object, request, context=None):
-        """Get the name of the default view for the object and request.
+    def queryUtility(interface, name='', default=None):
+        """Look up a utility that provides an interface.
 
-        The request must implement IPresentationRequest, and provides the
-        desired view type.  The nearest one to the object is found.
-        If a matching default view name cannot be found, raises
-        ComponentLookupError.
-
-        If context is not specified, attempts to use
-        object to specify a context.
+        If one is not found, returns default.
         """
 
-    def queryDefaultViewName(object, request, default=None, context=None):
-        """Look for the name of the default view for the object and request.
+    def getUtilitiesFor(interface):
+        """Look up the registered utilities that provide an interface.
 
-        The request must implement IPresentationRequest, and provides
-        the desired view type.  The nearest one to the object is
-        found.  If a matching default view name cannot be found,
-        returns the default.
-
-        If context is not specified, attempts to use object to specify
-        a context.
+        Returns an iterable of name-utility pairs.
         """
 
-    def getResource(name, request, providing=Interface, context=None):
-        """Get a named resource for a given request
+    def getAllUtilitiesRegisteredFor(interface):
+        """Return all registered utilities for an interface
 
-        The request must implement IPresentationRequest.
+        This includes overridden utilities.
 
-        The context provides a place to look for placeful resources.
-
-        A ComponentLookupError will be raised if the component can't
-        be found.
+        An iterable of utility instances is returned.  No names are
+        returned.
         """
 
-    def queryResource(name, request, default=None, providing=Interface,
-                      context=None):
-        """Get a named resource for a given request
-
-        The request must implement IPresentationRequest.
-
-        The context provides a place to look for placeful resources.
-
-        If the component can't be found, the default is returned.
-        """
-
-    def adapts(*interfaces):
-        """Declare that a class adapts the given interfaces.
-
-        This function can only be used in a class definition.
-
-        (TODO, allow classes to be passed as well as interfaces.)
-        """
         
 class IComponentRegistrationConvenience(Interface):
     """API for registering components.
@@ -429,7 +374,6 @@
         application-setup code. This api shouldn't be used by regular
         library modules, as component registration is a configuration
         activity. 
-        
         """
 
 class IRegistry(Interface):
@@ -440,27 +384,6 @@
         """Return an iterable of component registrations
         """
 
-
-class IServiceService(Interface):
-    """A service to manage Services."""
-
-    def getServiceDefinitions():
-        """Retrieve all Service Definitions
-
-        Should return a list of tuples (name, interface)
-        """
-
-    def getInterfaceFor(name):
-        """Retrieve the service interface for the given name
-        """
-
-    def getService(name):
-        """Retrieve a service implementation
-
-        Raises ComponentLookupError if the service can't be found.
-        """
-
-
 class IFactory(Interface):
     """A factory is responsible for creating other components."""
 
@@ -479,138 +402,3 @@
         created by this factory will implement. If the callable's Implements
         instance cannot be created, an empty Implements instance is returned.
         """
-
-
-class IUtilityService(Interface):
-    """A service to manage Utilities."""
-
-    def getUtility(interface, name=''):
-        """Look up a utility that provides an interface.
-
-        If one is not found, raises ComponentLookupError.
-        """
-
-    def queryUtility(interface, name='', default=None):
-        """Look up a utility that provides an interface.
-
-        If one is not found, returns default.
-        """
-
-    def getUtilitiesFor(interface):
-        """Look up the registered utilities that provide an interface.
-
-        Returns an iterable of name-utility pairs.
-        """
-
-    def getAllUtilitiesRegisteredFor(interface):
-        """Return all registered utilities for an interface
-
-        This includes overridden utilities.
-
-        An iterable of utility instances is returned.  No names are
-        returned.
-        """
-
-
-class IContextDependent(Interface):
-    """Components implementing this interface must have a context component.
-
-    Usually the context must be one of the arguments of the
-    constructor. Adapters and views are a primary example of context-dependent
-    components.
-    """
-
-    context = Attribute(
-        """The context of the object
-
-        This is the object being adapted, viewed, extended, etc.
-        """)
-
-
-class IAdapterService(Interface):
-    """A service to manage Adapters."""
-
-    def queryAdapter(object, interface, name, default=None):
-        """Look for a named adapter to an interface for an object
-
-        If a matching adapter cannot be found, returns the default.
-
-        The name consisting of an empty string is reserved for unnamed
-        adapters. The unnamed adapter methods will often call the
-        named adapter methods with an empty string for a name.
-        """
-
-    def queryMultiAdapter(objects, interface, name, default=None):
-        """Look for a multi-adapter to an interface for an object
-
-        If a matching adapter cannot be found, returns the default.
-
-        The name consisting of an empty string is reserved for unnamed
-        adapters. The unnamed adapter methods will often call the
-        named adapter methods with an empty string for a name.
-        """
-
-    def subscribers(required, provided):
-        """Get subscribers
-
-        Subscribers are returned that provide the provided interface
-        and that depend on and are computed from the sequence of
-        required objects.
-        """
-
-
-class IPresentation(Interface):
-    """Presentation components provide interfaces to external actors
-
-    The are created for requests, which encapsulate external actors,
-    connections, etc.
-    """
-
-    request = Attribute(
-        """The request
-
-        The request is a surrogate for the user. It also provides the
-        presentation type and skin. It is of type
-        IPresentationRequest.
-        """)
-
-
-class IPresentationRequest(Interface):
-    """An IPresentationRequest provides methods for getting view meta data."""
-
-
-class IResource(IPresentation):
-    """Resources provide data to be used for presentation."""
-
-
-class IResourceFactory(Interface):
-    """A factory to create factories using the request."""
-
-    def __call__(request):
-        """Create a resource for a request
-
-        The request must be an IPresentationRequest.
-        """
-
-
-class IView(IPresentation, IContextDependent):
-    """Views provide a connection between an external actor and an object"""
-
-
-class IViewFactory(Interface):
-    """Objects for creating views"""
-
-    def __call__(context, request):
-        """Create an view (IView) object
-
-        The context aregument is the object displayed by the view. The
-        request argument is an object, such as a web request, that
-        "stands in" for the user.
-        """
-
-class IDefaultViewName(Interface):
-    """A string that contains the default view name
-
-    A default view name is used to select a view when a user hasn't
-    specified one.
-    """

Deleted: Zope3/trunk/src/zope/component/service.py
===================================================================
--- Zope3/trunk/src/zope/component/service.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/service.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,133 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Service Manager implementation
-
-$Id$
-"""
-
-from zope.exceptions import DuplicationError
-from zope.component.interfaces import IServiceService
-from zope.component.exceptions import ComponentLookupError
-from zope.interface import implements
-
-
-class IGlobalServiceManager(IServiceService):
-
-    def defineService(name, interface):
-        """Define a new service of the given name implementing the given
-        interface.  If the name already exists, raises
-        DuplicationError"""
-
-    def provideService(name, component):
-        """Register a service component.
-
-        Provide a service component to do the work of the named
-        service.  If a service component has already been assigned to
-        this name, raise DuplicationError; if the name has not been
-        defined, raises UndefinedService; if the component does not
-        implement the registered interface for the service name,
-        raises InvalidService.
-
-        """
-
-class UndefinedService(Exception):
-    """An attempt to register a service that has not been defined
-    """
-
-class InvalidService(Exception):
-    """An attempt to register a service that doesn't implement
-       the required interface
-    """
-
-class GlobalServiceManager(object):
-    """service manager"""
-
-    implements(IGlobalServiceManager)
-
-    def __init__(self, name=None, module=None):
-        self._clear()
-        self.__name__ = name
-        self.__module__ = module
-
-    def _clear(self):
-        self.__defs     = {'Services': IServiceService}
-        self.__services = {'Services': self}
-
-    def __reduce__(self):
-        # Global service managers are pickled as global objects
-        return self.__name__
-
-    def defineService(self, name, interface):
-        """see IGlobalServiceManager interface"""
-
-        if name in self.__defs:
-            raise DuplicationError(name)
-
-        self.__defs[name] = interface
-
-    def getServiceDefinitions(self):
-        """see IServiceService Interface"""
-        return self.__defs.items()
-
-    def provideService(self, name, component, force=False):
-        """see IGlobalServiceManager interface, above
-
-        The force keyword allows one to replace an existing
-        service.  This is mostly useful in testing scenarios.
-        """
-
-        if not force and name in self.__services:
-            raise DuplicationError(name)
-
-        if name not in self.__defs:
-            raise UndefinedService(name)
-
-        if not self.__defs[name].providedBy(component):
-            raise InvalidService(name, component, self.__defs[name])
-
-        if isinstance(component, GlobalService):
-            component.__parent__ = self
-            component.__name__ = name
-
-        self.__services[name] = component
-
-    def getService(self, name):
-        """see IServiceService interface"""
-        service = self.__services.get(name)
-        if service is None:
-            raise ComponentLookupError(name)
-
-        return service
-
-
-def GS(service_manager, service_name):
-    return service_manager.getService(service_name)
-
-class GlobalService(object):
-
-    def __reduce__(self):
-        return GS, (self.__parent__, self.__name__)
-
-
-
-# the global service manager instance
-serviceManager = GlobalServiceManager('serviceManager', __name__)
-
-defineService = serviceManager.defineService
-
-# Register our cleanup with Testing.CleanUp to make writing unit tests
-# simpler.
-from zope.testing.cleanup import addCleanUp
-addCleanUp(serviceManager._clear)
-del addCleanUp

Deleted: Zope3/trunk/src/zope/component/servicenames.py
===================================================================
--- Zope3/trunk/src/zope/component/servicenames.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/servicenames.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Default service names for CA core services
-
-$Id$
-"""
-Adapters = 'Adapters'
-Utilities = 'Utilities'
-Services = 'Services'

Copied: Zope3/trunk/src/zope/component/site.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/site.py)

Copied: Zope3/trunk/src/zope/component/socketexample.txt (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/socketexample.txt)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/component/socketexample.txt	2005-02-14 16:23:10 UTC (rev 29141)
+++ Zope3/trunk/src/zope/component/socketexample.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -0,0 +1,597 @@
+=================================
+The Zope 3 Component Architecture
+=================================
+
+The component architecture provides an application framework that provides its
+functionality through loosly-connected components. A *component* can be any
+Python object and has a particular purpose associated with it. Thus, in a
+component-based applications you have many small component in contrast to
+classical object-oriented development, where yoiu have a few big objects. 
+
+Components communicate via specific APIs, which are formally defined by
+interfaces, which are provided by the `zope.interface` package. *Interfaces*
+describe the methods and properties that a component is expected to
+provide. They are also used as a primary mean to provide developer-level
+documentation for the components. For more details about interfaces see
+`zope/interface/README.txt`.
+
+The two main types of components are *adapters* and *utilities*. They will be
+discussed in detail later in this document. Both component types are managed
+by the *site manager*, with which you can register and access these
+components. However, most of the site manager's functionality is hidden behind
+the component architecture's public API, which is documented in
+`IComponentArchitecture`.
+
+
+Adapters
+--------
+
+Adapters are a well-established pattern. An *adapter* uses an object providing
+one interface to produce an object that provides another interface. Here an
+example: Imagine that you purchased an electric shaver in the US, and thus
+you require the US socket type. You are now traveling in Germany, where another
+socket style is used. You will need a device, an adapter, that converts from
+the German to the US socket style.
+
+The functionality of adapters is actually natively provided by the
+`zope.interface` package and is thus well decumented there. The `human.txt`
+file provides a gentle introduction to adapters, whereby `adapter.txt` is
+aimed at providing a comprehensive insight into adapters, but is too abstract
+for many as an inital read. Thus, we will only explain adapters in the context
+of the component architecture's API.
+
+So let's say that we have a German socket
+
+  >>> from zope.interface import Interface, implements
+
+  >>> class IGermanSocket(Interface):
+  ...     pass
+
+  >>> class Socket(object):
+  ...     def __repr__(self):
+  ...         return '<instance of %s>' %self.__class__.__name__
+
+  >>> class GermanSocket(Socket):
+  ...     """German wall socket."""
+  ...     implements(IGermanSocket)
+
+and we want to convert it to an US socket
+
+  >>> class IUSSocket(Interface):
+  ...     pass
+
+so that our shaver can be used in Germany. So we go to a German electronics
+store to look for an adapter that we can plug in the wall:
+
+  >>> class GermanToUSSocketAdapter(Socket):
+  ...     implements(IUSSocket)
+  ...     __used_by__ = IGermanSocket
+  ...     
+  ...     def __init__(self, socket):
+  ...         self.context = socket
+
+Note that I could have called the passed in socket any way I like, but
+`context` is the standard name accepted.
+
+
+Single Adapters
++++++++++++++++
+
+Before we can use the adapter, we have to buy it and make it part of our
+inventory. In the component architecture we do this by registering the adapter
+with the framework, more specifically with the global site manager:
+
+  >>> from zope import component as capi
+  >>> gsm = capi.getGlobalSiteManager()
+  
+  >>> gsm.provideAdapter((IGermanSocket,), IUSSocket, '',
+  ...                    GermanToUSSocketAdapter)
+
+`capi` is the component architecture API that is being presented by this
+file. You registered an adapter from `IGermanSocket` to `IUSSocket` having no
+name (thus the empty string).
+
+Anyways, you finally get back to your hotel room and shave, since you have not
+been able to shave in the plane. In the bathroom you discover a socket:
+
+  >>> bathroomDE = GermanSocket()
+  >>> IGermanSocket.providedBy(bathroomDE)
+  True
+
+You now insert the adapter in the German socket
+
+  >>> bathroomUS = capi.getAdapter(bathroomDE, IUSSocket, '')
+
+so that the socket now provides the US version:
+
+  >>> IUSSocket.providedBy(bathroomUS)
+  True
+
+Now you can insert your shaver and get on with your day. 
+
+After a week you travel for a couple of days to the Prague and you notice that
+the Czech have yet another socket type:
+
+  >>> class ICzechSocket(Interface):
+  ...     pass
+
+  >>> class CzechSocket(Socket):
+  ...     implements(ICzechSocket)
+
+  >>> czech = CzechSocket()
+
+You try to find an adapter for your shaver in your bag, but you fail, since
+you do not have one:
+
+  >>> capi.getAdapter(czech, IUSSocket, '') #doctest: +NORMALIZE_WHITESPACE
+  Traceback (most recent call last):
+  ...
+  ComponentLookupError: (<instance of CzechSocket>, 
+                         <InterfaceClass __builtin__.IUSSocket>,
+                         '')
+
+or the more graceful way:
+
+  >>> marker = object()
+  >>> socket = capi.queryAdapter(czech, IUSSocket, '', marker)
+  >>> socket is marker
+  True
+
+In the component architecture API any `get*` method will fail with a specific
+exception, if a query failed, whereby methods starting with `query*` will
+always return a `default` value after a failure.
+
+
+Named Adapters
+++++++++++++++
+
+You are finally back in Germany. You also brought your DVD player and a couple
+DVDs with you, which you would like to watch. Your shaver was able to convert
+automatically from 110 volts to 240 volts, but your DVD player cannot. So you
+have to buy another adapter that also handles converting the voltage and the
+frequency of the AC current:
+
+  >>> class GermanToUSSocketAdapterAndTransformer(object):
+  ...     implements(IUSSocket)
+  ...     __used_by__ = IGermanSocket
+  ...     
+  ...     def __init__(self, socket):
+  ...         self.context = socket
+
+Now, we need a way to keep the two adapters apart. Thus we register them with
+a name:
+
+  >>> gsm.provideAdapter((IGermanSocket,), IUSSocket, 'shaver',
+  ...                    GermanToUSSocketAdapter)
+  >>> gsm.provideAdapter((IGermanSocket,), IUSSocket, 'dvd',
+  ...                    GermanToUSSocketAdapterAndTransformer)
+
+Now we simply look up the adapters using their labels (called *name*):
+
+  >>> socket = capi.getAdapter(bathroomDE, IUSSocket, 'shaver')
+  >>> socket.__class__ is GermanToUSSocketAdapter
+  True
+
+  >>> socket = capi.getAdapter(bathroomDE, IUSSocket, 'dvd')
+  >>> socket.__class__ is GermanToUSSocketAdapterAndTransformer
+  True
+
+Clearly, we do not have an adapter for the MP3 player
+
+  >>> capi.getAdapter(bathroomDE, IUSSocket, 
+  ...                 'mp3') #doctest: +NORMALIZE_WHITESPACE
+  Traceback (most recent call last):
+  ...
+  ComponentLookupError: (<instance of GermanSocket>, 
+                         <InterfaceClass __builtin__.IUSSocket>,
+                         'mp3')
+
+
+but you could use the 'dvd' adapter in this case of course. ;)
+
+Sometimes you want to know all adapters that are available. Let's say you want
+to know about all the adapters that convert a German to a US socket type:
+
+  >>> sockets = capi.getAdapters((bathroomDE,), IUSSocket)
+  >>> len(sockets)
+  3
+  >>> names = [name for name, socket in sockets]
+  >>> names.sort()
+  >>> names
+  [u'', u'dvd', u'shaver']
+
+`capi.getAdapters()` returns a list of tuples. The first entry of the tuple is
+the name of the adapter and the second is the adapter itself.
+
+
+Multi-Adapters
+++++++++++++++
+
+After watching all the DVDs you brought at least twice, you get tired of them
+and you want to listen to some music using your MP3 player. But darn, the MP3
+player plug has a ground pin and all the adapters you have do not support
+that:
+
+  >>> class IUSGroundedSocket(IUSSocket):
+  ...     pass
+
+So you go out another time to buy an adapter. This time, however, you do not
+buy yet another adapter, but a piece that provides the grounding plug:
+
+  >>> class IGrounder(Interface):
+  ...     pass
+
+  >>> class Grounder(object):
+  ...     implements(IGrounder)
+  ...     def __repr__(self):
+  ...         return '<instance of Grounder>'
+
+
+Then together they will provided a grounded us socket:
+
+  >>> class GroundedGermanToUSSocketAdapter(object):
+  ...     implements(IUSGroundedSocket)
+  ...     __used_for__ = (IGermanSocket, IGrounder)
+  ...     def __init__(self, socket, grounder):
+  ...         self.socket, self.grounder = socket, grounder
+
+You now register the combination, so that you know you can create a
+`IUSGroundedSocket`:
+
+  >>> gsm.provideAdapter((IGermanSocket, IGrounder), IUSGroundedSocket, 'mp3',
+  ...                    GroundedGermanToUSSocketAdapter)
+
+Given the grounder
+
+  >>> grounder = Grounder()
+
+and a German socket
+
+  >>> livingroom = GermanSocket()
+
+we can now get a gounded US socket:
+
+  >>> socket = capi.getMultiAdapter((livingroom, grounder), 
+  ...                               IUSGroundedSocket, 'mp3')
+
+  >>> socket.__class__ is GroundedGermanToUSSocketAdapter
+  True
+  >>> socket.socket is livingroom
+  True
+  >>> socket.grounder is grounder
+  True
+
+Of course, you do not have a 'dvd' grounded US socket available:
+
+  >>> capi.getMultiAdapter((livingroom, grounder), IUSGroundedSocket, 
+  ...                      'dvd') #doctest: +NORMALIZE_WHITESPACE
+  Traceback (most recent call last):
+  ...
+  ComponentLookupError: ((<instance of GermanSocket>, 
+                          <instance of Grounder>), 
+                         <InterfaceClass __builtin__.IUSGroundedSocket>,
+                         'dvd')
+
+
+  >>> socket = capi.queryMultiAdapter((livingroom, grounder), 
+  ...                                 IUSGroundedSocket, 'dvd', marker)
+  >>> socket is marker
+  True
+
+Again, you might want to read `adapter.txt` in `zope.interface` for a more
+comprehensive coverage of multi-adapters.
+
+Subscribers
+-----------
+
+While subscribers are directly supported by the adapter registry and are
+adapters for all theoretical purposes, practically it might be better to think
+of them as separate components. Subscribers are particularly useful for
+events.
+
+Let's say one of our adapters overheated and caused a small fire:
+
+  >>> class IFire(Interface):
+  ...     pass
+
+  >>> class Fire(object):
+  ...     implements(IFire)
+
+  >>> fire = Fire()
+
+We want to use all available objects to put out the fire:
+
+  >>> class IFireExtinguisher(Interface):
+  ...     def extinguish():
+  ...         pass
+
+  >>> class FireExtinguisher(object):
+  ...     def __init__(self, fire):
+  ...         pass
+  ...     def extinguish(self):
+  ...         "Place extinguish code here."
+  ...         print 'Used ' + self.__class__.__name__ + '.'
+
+Here some specific methods to put out the fire:
+
+  >>> class PowderExtinguisher(FireExtinguisher):
+  ...     pass
+  >>> gsm.subscribe((IFire,), IFireExtinguisher, PowderExtinguisher)
+
+  >>> class Blanket(FireExtinguisher):
+  ...     pass
+  >>> gsm.subscribe((IFire,), IFireExtinguisher, Blanket)
+
+  >>> class SprinklerSystem(FireExtinguisher):
+  ...     pass
+  >>> gsm.subscribe((IFire,), IFireExtinguisher, SprinklerSystem)
+
+Now let use all these things to put out the fire:
+
+  >>> extinguishers = capi.subscribers((fire,), IFireExtinguisher)
+  >>> extinguishers.sort()
+  >>> for extinguisher in extinguishers:
+  ...     extinguisher.extinguish()
+  Used Blanket.
+  Used PowderExtinguisher.
+  Used SprinklerSystem.
+
+If no subscribers are found for a particular object, then an empty list is
+returned: 
+
+  >>> capi.subscribers((object(),), IFireExtinguisher)
+  []
+
+
+Utilities
+---------
+
+Utilities are the second type of component, the component architecture
+implements. *Utilities* are simply components that provide an interface. When
+you register an utility, you always register an instance (in cotrast to a
+factory for adapters) since the initialization and setup process of a utility
+might be complex and is not well defined. In some ways a utility is much more
+fundamental than an adapter, because an adapter cannot be used without another
+component, but a utility is always self-contained. I like to think of
+utilities as the foundation of your application and adapters as components
+extending beyond this foundation.
+
+Back to our story...
+
+After your vacation is over you fly back home to Tampa, Florida. But it is
+August now, the middle of the Hurrican season. And, believe it or not, you are
+worried that you will not be able to shave when the power goes out for several
+days. (You just hate wet shavers.)
+
+So you decide to go to your favorite hardware store and by a Diesel-powered
+electric generator. The generator provides of course a US-style socket:
+
+  >>> class Generator(object):
+  ...     implements(IUSSocket)
+  ...     def __repr__(self):
+  ...         return '<instance of Generator>'
+
+  >>> generator = Generator()
+
+Like for adapters, we now have to add the newly-acquired generator to our
+inventory by registering it as a utility:
+
+  >>> gsm.provideUtility(IUSSocket, generator)
+
+We can now get the utility using
+
+  >>> utility = capi.getUtility(IUSSocket)
+  >>> utility is generator
+  True
+
+As you can see, it is very simple to register and retrieve utilities. If a
+utility does not exsist for a particular interface, such as the German socket,
+then the lookup fails
+
+  >>> capi.getUtility(IGermanSocket)
+  Traceback (most recent call last):
+  ...
+  ComponentLookupError: (<InterfaceClass __builtin__.IGermanSocket>, '')
+
+or more gracefully when specifying a default value:
+
+  >>> default = object()
+  >>> utility = capi.queryUtility(IGermanSocket, default=default)
+  >>> utility is default
+  True
+
+Note: The only difference between `getUtility()` and `queryUtility()` is the
+fact that you can specify a default value for the latter function, so that it
+will never cause a `ComponentLookupError`.
+
+
+Named Utilities
++++++++++++++++
+
+It is often desirable to have several utilities providing the same interface
+per site. This way you can implement any sort of registry using utilities. For
+this reason, utilities -- like adapters -- can be named.
+
+In the context of our story, we might want to do the following: You really do
+not trust gas stations either. What if the roads are blocked after a hurricane
+and the gas stations run out of oil. So you look for another renewable power
+source. Then you think about solar panels! After a storm there is usually very
+nice weather, so why not? Via the Web you order a set of 110V/120W solar
+panels that provide a regular US-style socket as output:
+
+  >>> class SolarPanel(object):
+  ...     implements(IUSSocket)
+  ...     def __repr__(self):
+  ...         return '<instance of Solar Panel>'
+
+  >>> panel = SolarPanel()
+
+Once it arrives, we add it to our inventory:
+
+  >>> gsm.provideUtility(IUSSocket, panel, 'Solar Panel')
+
+You can now access the solar panel using
+
+  >>> utility = capi.getUtility(IUSSocket, 'Solar Panel')
+  >>> utility is panel
+  True
+
+Of course, if a utility is not available, then the lookup will simply fail
+
+  >>> capi.getUtility(IUSSocket, 'Wind Mill')
+  Traceback (most recent call last):
+  ...
+  ComponentLookupError: (<InterfaceClass __builtin__.IUSSocket>, 'Wind Mill')
+
+or more gracefully when specifying a default value:
+
+  >>> default = object()
+  >>> utility = capi.queryUtility(IUSSocket, 'Wind Mill', default=default)
+  >>> utility is default
+  True
+
+Now you want to look at all the utilities you have for a particular kind. The
+following API function will return a list of name/utility pairs:
+
+  >>> utils = list(capi.getUtilitiesFor(IUSSocket))
+  >>> utils.sort()
+  >>> utils #doctest: +NORMALIZE_WHITESPACE
+  [(u'', <instance of Generator>), 
+   (u'Solar Panel', <instance of Solar Panel>)]
+
+Another method of looking up all utilities is by using
+`getAllUtilitiesRegisteredFor(iface)`. This function will return an iteratable
+of utilities (without names); however, it will also return overridden
+utilities. If you are not using multiple site managers, you will not actually
+need this method.
+
+  >>> utils = list(capi.getAllUtilitiesRegisteredFor(IUSSocket))
+  >>> utils.sort()
+  >>> utils
+  [<instance of Generator>, <instance of Solar Panel>]
+
+
+Factories
++++++++++
+
+A *factory* is a special kind of utility that exists to create other
+components. A factory is always identified by a name. It also provides a title
+and description and is able to tell the developer what interfaces the created
+object will provide. The advantage of using a factory to create an object
+instead of directly isntantiating a class or executing any other callable is
+that we can refer to the factory by name. As long as the name stays fixed, the
+implementation of the callable can be renamed or moved without a breakage in
+code.
+
+Let's say that our solar panel comes in parts and they have to be
+assembled. This assembly would be done by a factory, so let's create one for
+the solar panel. To do this, we can use a standard implementation of the
+`IFactory` interface:
+
+  >>> from zope.component.factory import Factory
+  >>> factory = Factory(SolarPanel, 
+  ...                   'Solar Panel',
+  ...                   'This factory creates a solar panel.')
+
+Optionally, I could have also specifed the interfaces that the created object
+will provide, but the factory class is smart enough to determine the
+implemented interface from the class. We now register the factory:
+
+  >>> from zope.component.interfaces import IFactory
+  >>> gsm.provideUtility(IFactory, factory, 'SolarPanel')
+
+We can now get a list of interfaces the produced object will provide:
+
+  >>> ifaces = capi.getFactoryInterfaces('SolarPanel')
+  >>> IUSSocket in ifaces
+  True
+
+By the way, this is equivalent to
+
+  >>> ifaces2 = factory.getInterfaces()
+  >>> ifaces is ifaces2
+  True
+
+Of course you can also just create an object:
+
+  >>> panel = capi.createObject(None, 'SolarPanel')
+  >>> panel.__class__ is SolarPanel
+  True
+
+Note: Ignore the first argument (`None`) for now; it is the context of the
+utility lookup, which is usually an optional argument, but cannot be in this
+case, since all other arguments beside the `name` are passed in as arguments
+to the specified callable.
+
+Once you register several factories
+
+  >>> gsm.provideUtility(IFactory, Factory(Generator), 'Generator')
+
+you can also determine, which available factories will create objects
+providing a certian interface:
+
+  >>> factories = capi.getFactoriesFor(IUSSocket)
+  >>> factories = [(name, factory.__class__) for name, factory in factories]
+  >>> factories.sort()
+  >>> factories #doctest: +NORMALIZE_WHITESPACE
+  [(u'Generator', <class 'zope.component.factory.Factory'>), 
+   (u'SolarPanel', <class 'zope.component.factory.Factory'>)]
+
+
+Site Managers
+-------------
+
+Why do we need site managers? Why is the component architecture API not
+sufficient? Some applications, including Zope 3, have a concept of
+locations. It is often desireable to have different configurations for these
+location; this can be done by overwriting existing or adding new component
+registrations. Site managers in locations below the root location, should be
+able to delegate requests to their parent locations. The root site manager is
+commonly known as *global site manager*, since it is always available. You can
+always get the global site manager using the API:
+
+  >>> gsm = capi.getGlobalSiteManager()
+
+  >>> from zope.component.site import globalSiteManager
+  >>> gsm is globalSiteManager
+  True
+  >>> from zope.component.interfaces import ISiteManager
+  >>> ISiteManager.providedBy(gsm)
+  True
+  >>> from zope.component.site import IGlobalSiteManager
+  >>> IGlobalSiteManager.providedBy(gsm)
+  True
+
+You can also lookup at site manager in a given context. The only requirement
+is that the context can be adapted to a site manager. So let's create a
+special site manager:
+
+  >>> from zope.component.site import SiteManager
+  >>> sm = SiteManager()
+
+Now we create a context that adapts to the site manager via the `__conform__`
+method as specied in PEP 246.
+
+  >>> class Context(object):
+  ...     def __init__(self, sm):
+  ...         self.sm = sm
+  ...     def __conform__(self, interface):
+  ...         if interface.isOrExtends(ISiteManager):
+  ...             return self.sm
+
+We now instantiate the `Context` with our special site manager:
+
+  >>> context = Context(sm)
+  >>> context.sm is sm
+  True
+
+We can now ask for the site manager of this context:
+
+  >>> lsm = capi.getSiteManager(context)
+  >>> lsm is sm
+  True
+
+The site manager instance `lsm` is formally known as a *local site manager* of
+`context`.
+
+

Copied: Zope3/trunk/src/zope/component/testing.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/testing.py)


Property changes on: Zope3/trunk/src/zope/component/testing.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   + 1.10
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: Zope3/trunk/src/zope/component/tests.py (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/component/tests.py)
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/component/tests.py	2005-02-14 16:23:10 UTC (rev 29141)
+++ Zope3/trunk/src/zope/component/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -0,0 +1,601 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Component Architecture Tests
+
+$Id: test_api.py 28632 2004-12-16 17:42:59Z srichter $
+"""
+import unittest
+
+from zope.interface import Interface, implements
+from zope.interface.verify import verifyObject
+from zope.testing import doctest
+
+from zope import component as capi
+from zope.component.interfaces import ComponentLookupError
+from zope.component.interfaces import IComponentArchitecture
+from zope.component.interfaces import ISiteManager
+from zope.component.testing import setUp, tearDown
+
+class I1(Interface):
+    pass
+class I2(Interface):
+    pass
+class I3(Interface):
+    pass
+
+class Ob(object):
+    implements(I1)
+    def __repr__(self):
+        return '<instance Ob>'
+
+
+ob = Ob()
+
+class Ob2(object):
+    implements(I2)
+    def __repr__(self):
+        return '<instance Ob2>'
+
+class Comp(object):
+    implements(I2)
+    def __init__(self, context):
+        self.context = context
+
+comp = Comp(1)
+
+class Comp2(object):
+    implements(I3)
+    def __init__(self, context):
+        self.context = context
+
+
+class ConformsToISiteManager(object):
+    """This object allows the sitemanager to conform/adapt to `ISiteManager`
+    and thus to itself."""
+
+    def __init__(self, sitemanager):
+        self.sitemanager = sitemanager
+
+    def __conform__(self, interface):
+        """This method is specified by the adapter PEP to do the adaptation."""
+        if interface is ISiteManager:
+            return self.sitemanager
+
+
+def testInterfaces():
+    """Ensure that the component architecture API is provided by
+    `zope.component`.
+    
+    >>> import zope.component
+    >>> verifyObject(IComponentArchitecture, zope.component)
+    True
+    """
+
+def test_getGlobalSiteManager():
+    """One of the most important functions is to get the global site manager.
+    
+      >>> from zope.component.site import IGlobalSiteManager, globalSiteManager
+
+    Get the global site manager via the CA API function:
+
+      >>> gsm = capi.getGlobalSiteManager()
+
+    Make sure that the global site manager implements the correct interface
+    and is the global site manager instance we expect to get.
+    
+      >>> IGlobalSiteManager.providedBy(gsm)
+      True
+      >>> globalSiteManager is gsm
+      True
+
+    Finally, ensure that we always get the same global site manager, otherwise
+    our component registry will always be reset. 
+
+      >>> capi.getGlobalSiteManager() is gsm
+      True
+    """
+
+def test_getSiteManager():
+    """Make sure that `getSiteManager()` always returns the correct site
+    manager instance.
+    
+    We don't know anything about the default service manager, except that it
+    is an `ISiteManager`.
+
+      >>> ISiteManager.providedBy(capi.getSiteManager())
+      True
+
+    Calling `getSiteManager()` with no args is equivalent to calling it with a
+    context of `None`.
+
+      >>> capi.getSiteManager() is capi.getSiteManager(None)
+      True
+      
+    If the context passed to `getSiteManager()` is not `None`, it is adapted
+    to `ISiteManager` and this adapter returned.  So, we create a context that
+    can be adapted to `ISiteManager` using the `__conform__` API.
+
+    Let's create the simplest stub-implementation of a site manager possible:
+
+      >>> sitemanager = object()
+
+    Now create a context that knows how to adapt to our newly created site
+    manager.
+    
+      >>> context = ConformsToISiteManager(sitemanager)
+
+    Now make sure that the `getSiteManager()` API call returns the correct
+    site manager.
+
+      >>> capi.getSiteManager(context) is sitemanager
+      True
+
+    Using a context that is not adaptable to `ISiteManager` should fail.
+
+      >>> capi.getSiteManager(ob) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError: ('Could not adapt', <instance Ob>,
+      <InterfaceClass zope.component.interfaces.ISiteManager>)
+    """
+    
+def testAdapterInContext(self):
+    """The `getAdapterInContext()` and `queryAdapterInContext()` API functions
+    do not only use the site manager to look up the adapter, but first tries
+    to use the `__conform__()` method of the object to find an adapter as
+    specified by PEP 246.
+
+    Let's start by creating a component that support's the PEP 246's
+    `__conform__()` method:
+    
+      >>> class Component(object):
+      ...     implements(I1)
+      ...     def __conform__(self, iface, default=None):
+      ...         if iface == I2:
+      ...             return 42
+      ...     def __repr__(self):
+      ...         return '''<Component implementing 'I1'>'''
+      
+      >>> ob = Component()
+      
+    We also gave the component a custom representation, so it will be easier
+    to use in these tests.
+
+    We now have to create a site manager (other than the default global one)
+    with which we can register adapters for `I1`.
+      
+      >>> from zope.component.site import GlobalSiteManager
+      >>> sitemanager = GlobalSiteManager()
+
+    Now we create a new `context` that knows how to get to our custom site
+    manager.
+    
+      >>> context = ConformsToISiteManager(sitemanager)
+
+    We now register an adapter from `I1` to `I3`:
+      
+      >>> sitemanager.provideAdapter((I1,), I3, '', lambda x: 43)
+
+    If an object implements the interface you want to adapt to,
+    `getAdapterInContext()` should simply return the object.
+
+      >>> capi.getAdapterInContext(ob, I1, context)
+      <Component implementing 'I1'>
+      >>> capi.queryAdapterInContext(ob, I1, context)
+      <Component implementing 'I1'>
+
+    If an object conforms to the interface you want to adapt to,
+    `getAdapterInContext()` should simply return the conformed object.
+
+      >>> capi.getAdapterInContext(ob, I2, context)
+      42
+      >>> capi.queryAdapterInContext(ob, I2, context)
+      42
+
+    If an adapter isn't registered for the given object and interface, and you
+    provide no default, raise ComponentLookupError...
+
+      >>> class I4(Interface):
+      ...     pass
+
+      >>> capi.getAdapterInContext(ob, I4,
+      ...                          context) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError: (<Component implementing 'I1'>,
+                             <InterfaceClass zope.component.tests.I4>)
+
+    ...otherwise, you get the default:
+
+      >>> capi.queryAdapterInContext(ob, I4, context, 44)
+      44
+
+    If you ask for an adapter for which something's registered you get the
+    registered adapter
+
+      >>> capi.getAdapterInContext(ob, I3, context)
+      43
+      >>> capi.queryAdapterInContext(ob, I3, context)
+      43
+    """
+
+def testAdapter():
+    """The `getAdapter()` and `queryAdapter()` API functions are similar to
+    `{get|query}AdapterInContext()` functions, except that they do not care
+    about the `__conform__()` but also handle named adapters. (Actually, the
+    name is a required argument.)
+    
+    If an adapter isn't registered for the given object and interface, and you
+    provide no default, raise `ComponentLookupError`...
+
+      >>> capi.getAdapter(ob, I2, '') #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError: (<instance Ob>,
+                             <InterfaceClass zope.component.tests.I2>,
+                             '')
+
+    ...otherwise, you get the default
+
+      >>> capi.queryAdapter(ob, I2, '', '<default>')
+      '<default>'
+
+    Now get the global site manager and register an adapter from `I1` to `I2`
+    without a name:
+      
+      >>> capi.getGlobalSiteManager().provideAdapter((I1,), I2, '', Comp)
+
+    You can now simply access the adapter using the `getAdapter()` API
+    function:
+
+      >>> adapter = capi.getAdapter(ob, I2, '')
+      >>> adapter.__class__ is Comp
+      True
+      >>> adapter.context is ob
+      True
+    """
+
+def testInterfaceCall():
+    """Here we test the `adapter_hook()` function that we registered with the
+    `zope.interface` adapter hook registry, so that we can call interfaces to
+    do adaptation.
+
+    First, we need to register an adapter:
+    
+      >>> capi.getGlobalSiteManager().provideAdapter([I1], I2, '', Comp)
+
+    Then we try to adapt `ob` to provide an `I2` interface by calling the `I2`
+    interface with the obejct as first argument:
+
+      >>> adapter = I2(ob)
+      >>> adapter.__class__ is Comp
+      True
+      >>> adapter.context is ob
+      True
+
+    If no adapter is found, a `TypeError is raised...
+
+      >>> I1(Ob2()) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      TypeError: ('Could not adapt', <instance Ob2>,
+                  <InterfaceClass zope.component.tests.I1>)
+      
+    ...unless we specify an alternative adapter:
+
+      >>> marker = object()
+      >>> I2(object(), marker) is marker
+      True
+    """
+
+def testNamedAdapter():
+    """Make sure that adapters with names are correctly selected from the
+    registry.
+
+    First we register some named adapter:
+
+      >>> capi.getGlobalSiteManager().provideAdapter([I1], I2, 'foo',
+      ...                                             lambda x: 0)
+
+    If an adapter isn't registered for the given object and interface,
+    and you provide no default, raise `ComponentLookupError`...
+
+      >>> capi.getAdapter(ob, I2, 'bar') #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError: 
+      (<instance Ob>, <InterfaceClass zope.component.tests.I2>, 'bar')
+
+    ...otherwise, you get the default
+
+      >>> capi.queryAdapter(ob, I2, 'bar', '<default>')
+      '<default>'
+
+    But now we register an adapter for the object having the correct name
+
+      >>> capi.getGlobalSiteManager().provideAdapter([I1], I2, 'bar', Comp)
+
+    so that the lookup succeeds:
+    
+      >>> adapter = capi.getAdapter(ob, I2, 'bar')
+      >>> adapter.__class__ is Comp
+      True
+      >>> adapter.context is ob
+      True
+    """
+
+def testMultiAdapter():
+    """Adapting a combination of 2 objects to an interface
+
+    Multi-adapters adapt one or more objects to another interface. To make
+    this demonstration non-trivial, we need to create a second object to be
+    adapted:
+    
+      >>> ob2 = Ob2()
+
+    Like for regular adapters, if an adapter isn't registered for the given
+    objects and interface, and you provide no default, raise
+    `ComponentLookupError`...
+
+      >>> capi.getMultiAdapter((ob, ob2), I3) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError:
+      ((<instance Ob>, <instance Ob2>),
+       <InterfaceClass zope.component.tests.I3>,
+       u'')
+
+    ...otherwise, you get the default
+
+      >>> capi.queryMultiAdapter((ob, ob2), I3, default='<default>')
+      '<default>'
+
+    Note that the name is not a required attribute here.
+
+    To test multi-adapters, we also have to create an adapter class that
+    handles to context objects:
+    
+      >>> class DoubleAdapter(object):
+      ...     implements(I3)
+      ...     def __init__(self, first, second):
+      ...         self.first = first
+      ...         self.second = second
+
+    Now we can register the multi-adapter using
+    
+      >>> capi.getGlobalSiteManager().provideAdapter((I1, I2), I3, '',
+      ...                                        DoubleAdapter)
+
+    Notice how the required interfaces are simply provided by a tuple. Now we
+    can get the adapter:
+
+      >>> adapter = capi.getMultiAdapter((ob, ob2), I3)
+      >>> adapter.__class__ is DoubleAdapter
+      True
+      >>> adapter.first is ob
+      True
+      >>> adapter.second is ob2
+      True
+    """
+
+def testAdapterForInterfaceNone():
+    """Providing an adapter for None says that your adapter can adapt anything
+    to `I2`.
+
+      >>> capi.getGlobalSiteManager().provideAdapter((None,), I2, '', Comp)
+
+      >>> adapter = I2(ob)
+      >>> adapter.__class__ is Comp
+      True
+      >>> adapter.context is ob
+      True
+
+    It can really adapt any arbitrary object:
+
+      >>> something = object()
+      >>> adapter = I2(something)
+      >>> adapter.__class__ is Comp
+      True
+      >>> adapter.context is something
+      True
+    """
+    
+def testGetAdapters():
+    """It is sometimes desireable to get a list of all adapters that are
+    registered for a particular output interface, given a set of
+    objects.
+
+    Let's register some adapters first: 
+    
+      >>> capi.getGlobalSiteManager().provideAdapter([I1], I2, '', Comp)
+      >>> capi.getGlobalSiteManager().provideAdapter([None], I2, 'foo', Comp)
+
+    Now we get all the adapters that are registered for `ob` that provide
+    `I2`:
+    
+      >>> adapters = capi.getAdapters((ob,), I2)
+      >>> adapters.sort()
+      >>> [(name, adapter.__class__.__name__) for name, adapter in adapters]
+      [(u'', 'Comp'), (u'foo', 'Comp')]
+    """
+
+def testUtility():
+    """Utilities are components that simply provide an interface. They are
+    instantiated at the time or before they are registered. Here we test the
+    simple query interface.
+
+    Before we register any utility, there is no utility available, of
+    course. The pure instatiation of an object does not make it a utility. If
+    you do not specify a default, you get a `ComponentLookupError`...
+
+      >>> capi.getUtility(I1) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError: \
+      (<InterfaceClass zope.component.tests.I1>, '')
+
+    ...otherwise, you get the default
+
+      >>> capi.queryUtility(I1, default='<default>')
+      '<default>'
+      >>> capi.queryUtility(I2, default='<default>')
+      '<default>'
+
+    Now we declare `ob` to be the utility providing `I1`
+
+      >>> capi.getGlobalSiteManager().provideUtility(I1, ob)
+
+    so that the component is now available:
+    
+      >>> capi.getUtility(I1) is ob
+      True
+    """
+
+def testNamedUtility():
+    """Like adapters, utilities can be named.
+
+    Just because you register an utility having no name
+    
+      >>> capi.getGlobalSiteManager().provideUtility(I1, ob)
+
+    does not mean that they are available when you specify a name:
+    
+      >>> capi.getUtility(I1, name='foo') #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      ComponentLookupError:
+      (<InterfaceClass zope.component.tests.I1>, 'foo')
+
+
+    ...otherwise, you get the default
+
+      >>> capi.queryUtility(I1, name='foo', default='<default>')
+      '<default>'
+
+    Registering the utility under the correct name 
+
+      >>> capi.getGlobalSiteManager().provideUtility(I1, ob, name='foo')
+
+    really helps:
+
+      >>> capi.getUtility(I1, 'foo') is ob
+      True
+    """
+
+def test_getAllUtilitiesRegisteredFor():
+    """Again, like for adapters, it is often useful to get a list of all
+    utilities that have been registered for a particular interface. Utilities
+    providing a derived interface are also listed.
+
+    Thus, let's create a derivative interface of `I1`:
+    
+      >>> class I11(I1):
+      ...     pass
+
+      >>> class Ob11(Ob):
+      ...     implements(I11)
+    
+      >>> ob11 = Ob11()
+      >>> ob_bob = Ob()
+
+    Now we register the new utilities:
+
+      >>> gsm = capi.getGlobalSiteManager()
+      >>> gsm.provideUtility(I1, ob)
+      >>> gsm.provideUtility(I11, ob11)
+      >>> gsm.provideUtility(I1, ob_bob, name='bob')
+      >>> gsm.provideUtility(I2, Comp(2))
+
+    We can now get all the utilities that provide interface `I1`:
+
+      >>> uts = list(capi.getAllUtilitiesRegisteredFor(I1))
+      >>> uts = [util.__class__.__name__ for util in uts]
+      >>> uts.sort()
+      >>> uts
+      ['Ob', 'Ob', 'Ob11']
+
+    Note that `getAllUtilitiesRegisteredFor()` does not return the names of
+    the utilities.
+    """
+
+def testNotBrokenWhenNoSiteManager():
+    """Make sure that the adapter lookup is not broken, when no site manager
+    is available.
+
+    Both of those things emit `DeprecationWarnings`.
+
+      >>> I2(ob) #doctest: +NORMALIZE_WHITESPACE
+      Traceback (most recent call last):
+      ...
+      TypeError: ('Could not adapt',
+                  <instance Ob>,
+                  <InterfaceClass zope.component.tests.I2>)
+
+
+      >>> I2(ob, 42)
+      42
+    """
+
+
+def testNo__component_adapts__leakage():
+    """
+    We want to make sure that an `adapts()` call in a class definition
+    doesn't affect instances.
+
+      >>> import zope.component
+      >>> class C:
+      ...     zope.component.adapts()
+
+      >>> C.__component_adapts__
+      ()
+      >>> C().__component_adapts__
+      Traceback (most recent call last):
+      ...
+      AttributeError: __component_adapts__
+    """
+
+def test_ability_to_pickle_globalsitemanager():
+    """
+    We need to make sure that it is possible to pickle the global site manager
+    and its two global adapter registries.
+
+      >>> from zope.component import site
+      >>> import cPickle
+      >>> pickle = cPickle.dumps(site.globalSiteManager)
+      >>> sm = cPickle.loads(pickle)
+      >>> sm is site.globalSiteManager
+      True
+
+    Now let's ensure that the registries themselves can be pickled as well:
+
+      >>> pickle = cPickle.dumps(site.globalSiteManager.adapters)
+      >>> adapters = cPickle.loads(pickle)
+      >>> adapters is site.globalSiteManager.adapters
+      True
+    """
+
+def test_suite():
+    return unittest.TestSuite((
+        doctest.DocTestSuite(setUp=setUp, tearDown=tearDown),
+        doctest.DocTestSuite('zope.component.site'),
+        doctest.DocFileSuite('README.txt',
+                             setUp=setUp, tearDown=tearDown),
+        doctest.DocFileSuite('socketexample.txt',
+                             setUp=setUp, tearDown=tearDown),
+        doctest.DocFileSuite('factory.txt',
+                             setUp=setUp, tearDown=tearDown),
+        ))
+
+if __name__ == "__main__":
+    unittest.main(defaultTest='test_suite')

Deleted: Zope3/trunk/src/zope/component/utility.py
===================================================================
--- Zope3/trunk/src/zope/component/utility.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/component/utility.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,102 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""utility service
-
-$Id$
-"""
-from zope.component.exceptions import Invalid, ComponentLookupError
-from zope.component.interfaces import IUtilityService, IRegistry
-from zope.component.service import GlobalService
-from zope.interface.adapter import AdapterRegistry
-import zope.interface
-
-class IGlobalUtilityService(IUtilityService, IRegistry):
-
-    def provideUtility(providedInterface, component, name='', info=''):
-        """Provide a utility
-
-        A utility is a component that provides an interface.
-        """
-
-class UtilityService(AdapterRegistry):
-    """Provide IUtilityService
-
-    Mixin that superimposes utility management on adapter registry
-    implementation
-    """
-
-    def getUtility(self, interface, name=''):
-        """See IUtilityService interface"""
-        c = self.queryUtility(interface, name)
-        if c is not None:
-            return c
-        raise ComponentLookupError(interface, name)
-
-    def queryUtility(self, interface, name='', default=None):
-        """See IUtilityService interface"""
-
-        byname = self._null.get(interface)
-        if byname:
-            return byname.get(name, default)
-        else:
-            return default
-
-    def getUtilitiesFor(self, interface):
-        byname = self._null.get(interface)
-        if byname:
-            for item in byname.iteritems():
-                yield item
-
-    def getAllUtilitiesRegisteredFor(self, interface):
-        return iter(self._null.get(('s', interface)) or ())
-
-class GlobalUtilityService(UtilityService, GlobalService):
-
-    zope.interface.implementsOnly(IGlobalUtilityService)
-
-    def __init__(self):
-        UtilityService.__init__(self)
-        self._registrations = {}
-
-    def provideUtility(self, providedInterface, component, name='', info=''):
-
-        if not providedInterface.providedBy(component):
-            raise Invalid("The registered component doesn't implement "
-                          "the promised interface.")
-
-        self.register((), providedInterface, name, component)
-
-        # Also subscribe to support getAllUtilitiesRegisteredFor:
-        self.subscribe((), providedInterface, component)
-
-        self._registrations[(providedInterface, name)] = UtilityRegistration(
-            providedInterface, name, component, info)
-
-    def registrations(self):
-        return self._registrations.itervalues()
-
-
-class UtilityRegistration(object):
-
-    def __init__(self, provided, name, component, doc):
-        (self.provided, self.name, self.component, self.doc
-         ) = provided, name, component, doc
-
-    def __repr__(self):
-        return '%s(%r, %r, %r, %r)' % (
-            self.__class__.__name__,
-            self.provided.__name__, self.name,
-            getattr(self.component, '__name__', self.component), self.doc,
-            )
-

Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/configuration/config.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -25,6 +25,7 @@
 import zope.schema
 
 from keyword import iskeyword
+import zope.deprecation
 from zope.configuration.exceptions import ConfigurationError
 from zope.configuration.interfaces import IConfigurationContext
 from zope.configuration.interfaces import IGroupingContext
@@ -188,8 +189,12 @@
 
 
         try:
-            return getattr(mod, oname)
+            zope.deprecation.__show__.off()
+            obj = getattr(mod, oname)
+            zope.deprecation.__show__.on()
+            return obj
         except AttributeError:
+            zope.deprecation.__show__.on()
             # No such name, maybe it's a module that we still need to import
             try:
                 return __import__(mname+'.'+oname, *_import_chickens)

Copied: Zope3/trunk/src/zope/deprecation (from rev 29141, Zope3/branches/srichter-blow-services/src/zope/deprecation)

Modified: Zope3/trunk/src/zope/deprecation/README.txt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/deprecation/README.txt	2005-02-14 16:23:10 UTC (rev 29141)
+++ Zope3/trunk/src/zope/deprecation/README.txt	2005-02-14 22:43:16 UTC (rev 29143)
@@ -32,12 +32,14 @@
 
   >>> from zope.deprecation import tests
   >>> tests.demo1
-  <string>:1: DeprecationWarning: demo1: demo1 is no more.
+  /.../README.txt:1: DeprecationWarning: demo1: demo1 is no more.
+  ...
   1
 
   >>> import zope.deprecation.tests
   >>> zope.deprecation.tests.demo2
-  <string>:1: DeprecationWarning: demo2: demo2 is no more.
+  /.../README.txt:1: DeprecationWarning: demo2: demo2 is no more.
+  ...
   2
 
 You can see that merely importing the affected module or one of its parents
@@ -46,7 +48,8 @@
 name directly, the deprecation warning will be raised immediately.
 
   >>> from zope.deprecation.tests import demo3
-  <string>:1: DeprecationWarning: demo3: demo3 is no more.
+  /.../README.txt:1: DeprecationWarning: demo3: demo3 is no more.
+  ...
 
 Also, once a deprecation warning has been displayed, it is not shown again:
 
@@ -78,12 +81,14 @@
 
   >>> my = MyComponent()
   >>> my.foo
-  <string>:1: DeprecationWarning: foo is no more.
+  /.../README.txt:1: DeprecationWarning: foo is no more.
+  ...
   1
   >>> my.bar
   2
   >>> my.blah()
-  <string>:1: DeprecationWarning: blah() is no more.
+  /.../README.txt:1: DeprecationWarning: blah() is no more.
+  ...
   3
   >>> my.splat()
   4
@@ -108,7 +113,8 @@
   >>> foo = Foo()
 
   >>> foo.bar
-  <string>:1: DeprecationWarning: bar is no more.
+  /.../README.txt:1: DeprecationWarning: bar is no more.
+  ...
   1
 
 You can turn off the depraction warnings using

Modified: Zope3/trunk/src/zope/deprecation/tests.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/deprecation/tests.py	2005-02-14 16:23:10 UTC (rev 29141)
+++ Zope3/trunk/src/zope/deprecation/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -47,7 +47,8 @@
 def test_suite():
     return unittest.TestSuite((
         doctest.DocFileSuite('README.txt',
-                             setUp=setUp, tearDown=tearDown),
+                             setUp=setUp, tearDown=tearDown,
+                             optionflags=doctest.ELLIPSIS),
         ))
 
 if __name__ == "__main__":

Modified: Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/i18n/tests/test_itranslationdomain.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,8 +19,7 @@
 from zope.interface.verify import verifyObject
 from zope.interface import implements
 
-from zope.component import getService
-from zope.component.servicenames import Utilities
+import zope.component as capi
 from zope.component.tests.placelesssetup import PlacelessSetup
 
 from zope.i18n.negotiator import negotiator
@@ -48,8 +47,7 @@
         self._domain = self._getTranslationDomain()
 
         # Setup the negotiator utility
-        utilities = getService(Utilities)
-        utilities.provideUtility(INegotiator, negotiator)        
+        capi.provideUtility(negotiator, INegotiator)        
 
     def testInterface(self):
         verifyObject(ITranslationDomain, self._domain)

Modified: Zope3/trunk/src/zope/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/trunk/src/zope/i18n/tests/test_translationdomain.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/i18n/tests/test_translationdomain.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -22,8 +22,7 @@
      TestITranslationDomain, Environment
 from zope.i18n import MessageIDFactory
 from zope.i18n.interfaces import ITranslationDomain
-from zope.component.servicenames import Utilities
-from zope.component import getGlobalServices
+import zope.component as capi
 
 def testdir():
     from zope.i18n import tests
@@ -103,8 +102,7 @@
                                            os.path.join(path, 'en-default.mo'))
         domain.addCatalog(en_catalog)
 
-        s = getGlobalServices().getService(Utilities)
-        s.provideUtility(ITranslationDomain, domain, 'other')
+        capi.provideUtility(domain, ITranslationDomain, 'other')
 
         factory = MessageIDFactory('other')
         msgid = factory(u'short_greeting', 'default')

Modified: Zope3/trunk/src/zope/interface/declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/declarations.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/interface/declarations.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -353,7 +353,8 @@
         spec = Implements(*[implementedBy(c) for c in bases])
         spec.inherit = cls
 
-    spec.__name__ = getattr(cls, '__module__', '?') + '.' + cls.__name__
+    spec.__name__ = (getattr(cls, '__module__', '?') or '?') + \
+                    '.' + cls.__name__
 
     try:
         cls.__implemented__ = spec

Modified: Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py
===================================================================
--- Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/server/http/tests/test_publisherserver.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -20,8 +20,8 @@
 from zope.server.taskthreads import ThreadedTaskDispatcher
 from zope.server.http.publisherhttpserver import PublisherHTTPServer
 
-from zope.component.tests.placelesssetup import PlacelessSetup
-import zope.component
+from zope.component.testing import PlacelessSetup
+import zope.component as capi
 
 from zope.i18n.interfaces import IUserPreferredCharsets
 
@@ -90,8 +90,8 @@
 
     def setUp(self):
         super(Tests, self).setUp()
-        as = zope.component.getService('Adapters')
-        as.register([IHTTPRequest], IUserPreferredCharsets, '', HTTPCharsets)
+        capi.provideAdapter(HTTPCharsets,
+                            [IHTTPRequest], IUserPreferredCharsets, '')
         obj = tested_object()
         obj.folder = tested_object()
         obj.folder.item = tested_object()

Modified: Zope3/trunk/src/zope/testing/cleanup.py
===================================================================
--- Zope3/trunk/src/zope/testing/cleanup.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/testing/cleanup.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -52,7 +52,14 @@
 
     def cleanUp(self):
         """Clean up global data."""
-        for func, args, kw in _cleanups:
-            func(*args, **kw)
+        cleanUp()
 
     setUp = tearDown = cleanUp
+
+
+def cleanUp():
+    """Clean up global data."""
+    for func, args, kw in _cleanups:
+        func(*args, **kw)
+
+setUp = tearDown = cleanUp

Modified: Zope3/trunk/src/zope/wfmc/tests.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/tests.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zope/wfmc/tests.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,22 +18,22 @@
 import os
 import unittest
 import zope.event
-from zope.component.tests import placelesssetup
+from zope.component import testing
 
 def tearDown(test):
-    placelesssetup.tearDown(test)
+    testing.tearDown(test)
     zope.event.subscribers.pop()
 
 def setUp(test):
     test.globs['this_directory'] = os.path.dirname(__file__)
-    placelesssetup.setUp(test)
+    testing.setUp(test)
 
 def test_suite():
     from zope.testing import doctest
     suite = unittest.TestSuite()
     # suite.addTest(doctest.DocTestSuite())
     suite.addTest(doctest.DocFileSuite('README.txt', tearDown=tearDown,
-                                       setUp=placelesssetup.setUp))
+                                       setUp=testing.setUp))
     suite.addTest(doctest.DocFileSuite(
         'xpdl.txt', tearDown=tearDown, setUp=setUp,
         optionflags=doctest.NORMALIZE_WHITESPACE))
@@ -41,4 +41,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/trunk/src/zwiki/browser/wikipage.py
===================================================================
--- Zope3/trunk/src/zwiki/browser/wikipage.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/browser/wikipage.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -126,7 +126,7 @@
     def render(self):
         """Render the wiki page source."""
         source = zapi.createObject(None, self.context.type, self.context.source)
-        view = zapi.getView(removeAllProxies(source), '', self.request)
+        view = zapi.getMultiAdapter((removeAllProxies(source), self.request))
         html = view.render()
         html = self.renderWikiLinks(html)
         return html
@@ -136,7 +136,8 @@
         for name, comment in self.context.items():
             dc = DublinCoreViews(comment, self.request)
             source = zapi.createObject(None, comment.type, comment.source)
-            view = zapi.getView(removeAllProxies(source), '', self.request)
+            view = zapi.getMultiAdapter(
+                (removeAllProxies(source), self.request))
             result.append({
                 'name': name,
                 'title': comment.title,

Modified: Zope3/trunk/src/zwiki/tests/test_docstrings.py
===================================================================
--- Zope3/trunk/src/zwiki/tests/test_docstrings.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/tests/test_docstrings.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -24,7 +24,7 @@
 
 from zope.app import zapi
 from zope.app.dublincore.interfaces import ICMFDublinCore
-from zope.app.tests import placelesssetup, ztapi
+from zope.app.testing import placelesssetup, ztapi
 
 from zwiki.interfaces import IComment
 

Modified: Zope3/trunk/src/zwiki/tests/test_traverser.py
===================================================================
--- Zope3/trunk/src/zwiki/tests/test_traverser.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/tests/test_traverser.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -27,8 +27,8 @@
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.location.interfaces import ILocation
 from zope.app.location.traversing import LocationPhysicallyLocatable
-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.traversing.interfaces import IPhysicallyLocatable
 
 from zwiki.interfaces import IWikiPage, IWikiPageHierarchy

Modified: Zope3/trunk/src/zwiki/tests/test_wikimail.py
===================================================================
--- Zope3/trunk/src/zwiki/tests/test_wikimail.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/tests/test_wikimail.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -19,8 +19,8 @@
 
 from zope.event import subscribers
 from zope.interface import classImplements, 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.app.site.tests.placefulsetup import PlacefulSetup
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.event.objectevent import ObjectModifiedEvent

Modified: Zope3/trunk/src/zwiki/tests/test_wikipagehierarchy.py
===================================================================
--- Zope3/trunk/src/zwiki/tests/test_wikipagehierarchy.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/tests/test_wikipagehierarchy.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -18,7 +18,7 @@
 import unittest
 
 from zope.interface import implements, classImplements
-from zope.app.tests import ztapi
+from zope.app.testing import ztapi
 
 from zope.app.annotation.interfaces import IAnnotations, IAttributeAnnotatable
 from zope.app.traversing.interfaces import IPhysicallyLocatable

Modified: Zope3/trunk/src/zwiki/traversal.py
===================================================================
--- Zope3/trunk/src/zwiki/traversal.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/src/zwiki/traversal.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -15,7 +15,6 @@
 """
 from zope.interface import implements
 from zope.proxy import removeAllProxies
-from zope.component import getDefaultViewName, queryView
 from zope.publisher.interfaces import IPublishTraverse
 from zope.publisher.interfaces import NotFound
 from zope.app.traversing.interfaces import TraversalError
@@ -43,7 +42,7 @@
         if page is None or \
            not zapi.getName(self.context) in IWikiPageHierarchy(page).parents:
 
-            view = queryView(self.context, name, request)
+            view = zapi.queryMultiAdapter((self.context, request), name=name)
             if view is not None:
                 return view
 
@@ -54,7 +53,7 @@
 
     def browserDefault(self, request):
         c = self.context
-        view_name = getDefaultViewName(c, request)
+        view_name = zapi.getDefaultViewName(c, request)
         view_uri = "@@%s" % view_name
         return c, (view_uri,)
 

Modified: Zope3/trunk/test.py
===================================================================
--- Zope3/trunk/test.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/test.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -21,7 +21,7 @@
 here = os.path.dirname(os.path.realpath(__file__))
 sys.path.insert(0, os.path.join(here, 'src'))
 
-import zope.app.tests.test
+import zope.app.testing.test
 
 if __name__ == '__main__':
-    zope.app.tests.test.process_args()
+    zope.app.testing.test.process_args()

Modified: Zope3/trunk/zpl.py
===================================================================
--- Zope3/trunk/zpl.py	2005-02-14 18:50:54 UTC (rev 29142)
+++ Zope3/trunk/zpl.py	2005-02-14 22:43:16 UTC (rev 29143)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,



More information about the Zope3-Checkins mailing list