[Checkins] SVN: Zope/branches/tseaver-fix_wsgi/ Merge 2.12 branch changes.

Tres Seaver tseaver at palladion.com
Fri May 28 16:11:51 EDT 2010


Log message for revision 112816:
  Merge 2.12 branch changes.
  

Changed:
  _U  Zope/branches/tseaver-fix_wsgi/
  A   Zope/branches/tseaver-fix_wsgi/.bzrignore
  A   Zope/branches/tseaver-fix_wsgi/COPYRIGHT.txt
  A   Zope/branches/tseaver-fix_wsgi/LICENSE.txt
  D   Zope/branches/tseaver-fix_wsgi/ZopePublicLicense.txt
  U   Zope/branches/tseaver-fix_wsgi/bootstrap.py
  U   Zope/branches/tseaver-fix_wsgi/buildout.cfg
  D   Zope/branches/tseaver-fix_wsgi/configure
  U   Zope/branches/tseaver-fix_wsgi/doc/CHANGES.rst
  A   Zope/branches/tseaver-fix_wsgi/doc/INSTALL-buildout.rst
  U   Zope/branches/tseaver-fix_wsgi/doc/INSTALL.rst
  U   Zope/branches/tseaver-fix_wsgi/doc/WHATSNEW.rst
  U   Zope/branches/tseaver-fix_wsgi/doc/index.rst
  A   Zope/branches/tseaver-fix_wsgi/doc/operation.rst
  D   Zope/branches/tseaver-fix_wsgi/inst/Makefile.in
  D   Zope/branches/tseaver-fix_wsgi/inst/Makefile.win.in
  D   Zope/branches/tseaver-fix_wsgi/inst/WinBuilders/
  D   Zope/branches/tseaver-fix_wsgi/inst/compilezpy.py
  D   Zope/branches/tseaver-fix_wsgi/inst/configure.py
  D   Zope/branches/tseaver-fix_wsgi/inst/file_from_infile.py
  D   Zope/branches/tseaver-fix_wsgi/inst/generate_index.py
  D   Zope/branches/tseaver-fix_wsgi/inst/install.py
  D   Zope/branches/tseaver-fix_wsgi/inst/make_resource.py
  D   Zope/branches/tseaver-fix_wsgi/inst/tar.py
  D   Zope/branches/tseaver-fix_wsgi/inst/versions.py
  D   Zope/branches/tseaver-fix_wsgi/inst/walkandscrub.py
  U   Zope/branches/tseaver-fix_wsgi/setup.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/AuthEncoding.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/DTML.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplC.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplPython.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/Implementation.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/Owned.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permission.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionMapping.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionRole.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permissions.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/Role.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityInfo.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManagement.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/SimpleObjectPolicies.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/SpecialUsers.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/User.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeGuards.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeSecurityPolicy.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/cAccessControl.c
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/requestmethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/ResultObject.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/SecurityBase.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/framework.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/regressionSecurity.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testAcquisition.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testBindings.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testChownRecursive.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testClassSecurityInfo.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testDeprecatedAPI.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testImplementation.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testModuleSecurity.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testOwned.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPasswordDigest.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPermissionRole.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurity.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurityManager.py
  A   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUser.py
  D   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUserFolder.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeGuards.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeSecurityPolicy.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_requestmethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_safeiter.py
  U   Zope/branches/tseaver-fix_wsgi/src/AccessControl/unauthorized.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/ApplicationManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/CacheManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Common.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/DavLockManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Dialogs.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Extensions.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/FactoryDispatcher.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/FindHomes.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Hotfixes.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/ImageFile.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Management.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Permission.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/PersistentExtra.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Product.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/ProductContext.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/ProductRegistry.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/RefreshFuncs.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/Undo.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/ZApplication.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/class_init.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/config.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/dtml/copyright.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage_tabs.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/App/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/special_dtml.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/tar.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/tests/test_cachemanager.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/tests/test_class_init.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/tests/test_setConfiguration.py
  U   Zope/branches/tseaver-fix_wsgi/src/App/version_txt.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_HTML.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_If.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_In.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_InSV.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Let.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Raise.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Return.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_String.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Try.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_UI.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Util.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Var.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_With.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DTtestExpr.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/_DocumentTemplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/cDocumentTemplate.c
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/pDocumentTemplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/SortEx.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/tests/testSequence.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTML.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTMLUnicode.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Raise.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Var.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testustr.py
  U   Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/ustr.py
  U   Zope/branches/tseaver-fix_wsgi/src/Globals/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/APIHelpTopic.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpSys.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpTopic.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpUtil.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/ObjectRef.py
  U   Zope/branches/tseaver-fix_wsgi/src/HelpSys/__init__.py
  D   Zope/branches/tseaver-fix_wsgi/src/Missing/
  D   Zope/branches/tseaver-fix_wsgi/src/MultiMapping/
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Application.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Cache.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/CopySupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLDocument.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/DefaultObservable.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Document.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/FTPInterface.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/FindSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Folder.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/History.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Image.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Moniker.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/ObjectManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/OrderSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/OrderedFolder.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/PropertyManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/PropertySheets.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/SimpleItem.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Traversable.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/Uninstalled.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/XMLExportImport.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/ZDOM.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/fileEdit.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findFrame.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findResult.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/history.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/importExport.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/main.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/properties.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertyType.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertysheets.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/renameForm.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/event.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/misc_.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/rPickle.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/standard/standard_error_message.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/subscribers.py
  A   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/export.xml
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testAppInitializer.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testCopySupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testFileAndImage.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProductInit.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProperties.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testRanges.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testSimpleItem.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testTraverse.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_DTMLMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_Uninstalled.py
  U   Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_XMLExportImport.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/BTreeFolder2.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/tests/testBTreeFolder2.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/ExternalMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/help/ExternalMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/testExternalMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/TODO.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/bbb.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/absoluteurl.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/adding.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/decode.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/menu.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/metaconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/pagetemplatefile.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/resource.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/aqlegacy.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/classes.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/i18n.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.zcml
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages_ftest.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_ftest.txt
  A   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_subdir/resource.htm
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/skin.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_absoluteurl.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_adding.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_decode.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_defaultview.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_i18n.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_menu.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_metaconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pages.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pagetemplatefile.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_provider.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_recurse.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_resource.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_skin.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_traversable.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_zope3security.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/browser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/tests.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/formlib.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/FiveMiscTutorial/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/module.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/other.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/eventconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/fiveconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/fivedirectives.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/__init__.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/add.pt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/configure.zcml
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/edit.pt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/macros.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/meta.zcml
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/metaconfigure.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.pt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/tests/
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/configure.zcml
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/formbase.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/tests/
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaclass.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/schema.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/security.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/sizeconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/standardmacros.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/demomacros.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/test_standardmacros.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/testbrowser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/adapters.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/boilerplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/classes.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/de/LC_MESSAGES/fivetest.po
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/en/LC_MESSAGES/fivetest.po
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/fivetest.pot
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/metaconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_directives.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_event.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_i18n.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerclass.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerpackage.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_schema.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_security.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_size.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_testbrowser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/fancycontent.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/folder.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/pythonproduct1.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/restricted.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/simplecontent.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/marker.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/tests/test_marker.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/marker.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/manager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/metaconfigure.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/tests.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/viewlet.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Five/zcml.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/MIMETag.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/MailHost.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/SendMailTag.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/decorator.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/help/MailHost.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/mailer.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/testMailHost.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Draft.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Version.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/AuthenticatedUser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLDocument.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DateTime.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/File.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Folder.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Image.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManagerItem.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderedFolder.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertyManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheet.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheets.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Request.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Response.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/sequence.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/DeferExpr.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/Expressions.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplateFile.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZRPythonExpr.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZopePageTemplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/batch.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testDTMLTests.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testExpressions.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testHTMLTests.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testZopePageTemplate.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/util.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/unicodeconflictresolver.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/utils.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/DateIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/FieldIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/PathIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/FilteredSet.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/TopicIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/ResultList.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/UnIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/randid.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_UnIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_util.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/util.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/PythonScript.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/Utility.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/PythonScript.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/Script.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/standard.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/tests/testPythonScript.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/BrowserIdManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionDataManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionInterfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionPermissions.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/common.py
  A   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/stresstests/stresstestMultiThread.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testBrowserIdManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testSessionDataManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/AccessRule.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/COPYRIGHT.txt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/SiteRoot.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/VirtualHostMonster.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/__init__.py
  A   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testAccessRule.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testSiteRoot.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testVirtualHostMonster.py
  D   Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/www/VirtualHostMonsterAdd.dtml
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/SiteErrorLog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/www/main.pt
  U   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/RAMCacheManager.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/__init__.py
  A   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/configure.zcml
  A   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/subscribers.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_AcceleratedHTTPCacheManager.py
  A   Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/LowConflictConnection.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/TemporaryFolder.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/mount.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/patchfs.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Fake.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Transience.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransienceInterfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransientObject.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/help/TransienceInterfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransactionHelper.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObject.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObjectContainer.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/BaseIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/CosineIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/HTMLSplitter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/INBest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElement.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElementFactory.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParseTree.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ISplitter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/Lexicon.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/NBest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/OkapiIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ParseTree.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/PipelineFactory.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/QueryParser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/RiceCode.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/SetOps.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/StopDict.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/WidCode.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ZCTextIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/okascore.c
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/stopper.c
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testLexicon.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testNBest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testParseTree.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testPipelineFactory.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryEngine.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryParser.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testSetOps.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testStopper.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testZCTextIndex.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Catalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogAwareness.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogBrains.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogPathAwareness.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Lazy.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ProgressHandler.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalogIndexes.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/help/ZCatalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/regressiontests/unittest_patched.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testBrains.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testCatalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testLazySequences.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/MountedObject.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/tests/testMountPoint.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/SQL.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/help/ZSQLMethod.py
  U   Zope/branches/tseaver-fix_wsgi/src/Products/__init__.py
  D   Zope/branches/tseaver-fix_wsgi/src/Record/
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Bindings.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/BindingsUI.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Script.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Signature.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Aqueduct.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Connection.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/DA.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/RDB.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Results.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Search.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/THUNK.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/TM.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/dbi_db.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlgroup.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqltest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlvar.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlgroup.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlvar.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/ppml.py
  U   Zope/branches/tseaver-fix_wsgi/src/Shared/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Signals/SignalHandler.py
  U   Zope/branches/tseaver-fix_wsgi/src/Signals/Signals.py
  U   Zope/branches/tseaver-fix_wsgi/src/Signals/WinSignalHandler.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/PortalTestCase.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeLite.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeTestCase.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/base.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/connections.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/functional.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/layer.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/placeless.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/sandbox.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testBaseTestCase.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testFunctional.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testInterfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPlaceless.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPortalTestCase.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPythonScript.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testShoppingCart.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testSkeleton.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testWebserver.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZODBCompat.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZopeTestCase.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/tests.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/threadutils.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/utils.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/warnhook.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/functional.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testWarningsTest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/tests.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/dispatcher.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/makerequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/Testing/tests/test_makerequest.py
  D   Zope/branches/tseaver-fix_wsgi/src/ThreadLock/
  U   Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/TreeTag.py
  U   Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseRequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BeforeTraverse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Client.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Converters.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRangeSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Publish.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Request.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Response.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/TaintedString.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Test.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/mapply.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/maybe_lock.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/pubevents.py
  A   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/exception_handling.txt
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBaseRequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBeforeTraverse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRangeSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testPublish.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testTaintedString.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_Converters.py
  A   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_exception_handling.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_mapply.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testpubevents.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/xmlrpc.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/AccessLogger.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/BaseLogger.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/ClockServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/DebugLogger.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/FCGIServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPRequest.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/ICPServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/PCGIServer.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/Producers.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZEvent.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZRendezvous.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZServerPublisher.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/WebDAVSrcHandler.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/datatypes.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_config.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_responses.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZServer/utils.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Batch.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZTUtils/SimpleTree.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Tree.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Zope.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZTUtils/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/ClassFactory.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/startup.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testDoomedTransaction.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testExceptionHook.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/ClassFactory.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/datatypes.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/handlers.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/TextBlockFormatter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/lock_file.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/zpasswd.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/options.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/run.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/testStarter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_schema.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_warnfilter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/warnfilter.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopectl.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopeschema.xml
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/check_catalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/compilezpy.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/copyzopeskel.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/decompilezpy.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/load_site.py
  D   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzeoinstance.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzopeinstance.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/reindex_catalog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/requestprofiler.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/skel/etc/zope.conf.in
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/tracelog.py
  U   Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/zpasswd.py
  D   Zope/branches/tseaver-fix_wsgi/src/ZopeUndo/
  D   Zope/branches/tseaver-fix_wsgi/src/initgroups/
  U   Zope/branches/tseaver-fix_wsgi/src/nt_svcutils/service.py
  U   Zope/branches/tseaver-fix_wsgi/src/reStructuredText/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/Collection.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/EtagSupport.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/LockItem.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/Lockable.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/NullResource.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/Resource.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/common.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/davcmds.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/interfaces.py
  U   Zope/branches/tseaver-fix_wsgi/src/webdav/xmltools.py
  U   Zope/branches/tseaver-fix_wsgi/src/zExceptions/ExceptionFormatter.py
  U   Zope/branches/tseaver-fix_wsgi/src/zExceptions/ITracebackSupplement.py
  U   Zope/branches/tseaver-fix_wsgi/src/zExceptions/__init__.py
  U   Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/testExceptionFormatter.py
  A   Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/test_unauthorized.py
  U   Zope/branches/tseaver-fix_wsgi/src/zExceptions/unauthorized.py
  U   Zope/branches/tseaver-fix_wsgi/versions.cfg

-=-

Property changes on: Zope/branches/tseaver-fix_wsgi
___________________________________________________________________
Added: svn:mergeinfo
   + /Zope/branches/2.12:106850,106985,107280-107281,107284,107345,107477,107529,107689,107725,108011,108013,108017,108037-108038,108041,108088,108126,108731,109069,109073,109102,109400,109473,109852,109858,109860,109929,110119-110121,110145,110175,110185,110187,110294,110302,110403,110405,110410,110441,110447,110490-110491,110504,110507-110508,110512-110513,110515,110519-110520,110522,110526,110529,110545-110546,110706,110738-110742,110744-110745,110747,110749,110751,110753-110755,110779,110784-110785,110799,110821,110877,110891-110892,110964,110971,110974,110995,111016,111030-111033,111039,111041,111074,111079,111116,111197,111199,111260,111262,111325,111327,111329,111338,111619,111627,111640,111642,111644,111655,111683,111722,111735,111750,111862-111866,111899-111900,112176,112179,112182,112184,112186,112286-112287,112290,112324,112350,112352-112356,112358-112360,112368,112401-112402,112405,112408,112512,112514,112530,112536,112542,112553,112588-112590,112592-112593,112595
 ,112597,112607-112608,112610-112611,112614-112616,112621-112622,112683,112687,112780,112803,112805

Added: svk:merge
   + 62d5b8a3-27da-0310-9561-8e5933582275:/Zope/branches/2.12:112805


Copied: Zope/branches/tseaver-fix_wsgi/.bzrignore (from rev 112805, Zope/branches/2.12/.bzrignore)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/.bzrignore	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/.bzrignore	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,8 @@
+./include/*
+./bin
+./develop-eggs
+./.installed.cfg
+./eggs
+./parts
+./build
+*.egg-info

Copied: Zope/branches/tseaver-fix_wsgi/COPYRIGHT.txt (from rev 112805, Zope/branches/2.12/COPYRIGHT.txt)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/COPYRIGHT.txt	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/COPYRIGHT.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1 @@
+Zope Foundation and Contributors
\ No newline at end of file

Copied: Zope/branches/tseaver-fix_wsgi/LICENSE.txt (from rev 112805, Zope/branches/2.12/LICENSE.txt)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/LICENSE.txt	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/LICENSE.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,44 @@
+Zope Public License (ZPL) Version 2.1
+
+A copyright notice accompanies this license document that identifies the
+copyright holders.
+
+This license has been certified as open source. It has also been designated as
+GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions in source code must retain the accompanying copyright
+notice, this list of conditions, and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying copyright
+notice, this list of conditions, and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to endorse or promote
+products derived from this software without prior written permission from the
+copyright holders.
+
+4. The right to distribute this software or to use it for any purpose does not
+give you the right to use Servicemarks (sm) or Trademarks (tm) of the
+copyright
+holders. Use of them is covered by separate agreement with the copyright
+holders.
+
+5. If any files are modified, you must cause the modified files to carry
+prominent notices stating that you changed the files and the date of any
+change.
+
+Disclaimer
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Deleted: Zope/branches/tseaver-fix_wsgi/ZopePublicLicense.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/ZopePublicLicense.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/ZopePublicLicense.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,54 +0,0 @@
-Zope Public License (ZPL) Version 2.1
--------------------------------------
-
-A copyright notice accompanies this license document that
-identifies the copyright holders.
-
-This license has been certified as open source. It has also
-been designated as GPL compatible by the Free Software
-Foundation (FSF).
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the
-following conditions are met:
-
-1. Redistributions in source code must retain the
-   accompanying copyright notice, this list of conditions,
-   and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the accompanying
-   copyright notice, this list of conditions, and the
-   following disclaimer in the documentation and/or other
-   materials provided with the distribution.
-
-3. Names of the copyright holders must not be used to
-   endorse or promote products derived from this software
-   without prior written permission from the copyright
-   holders.
-
-4. The right to distribute this software or to use it for
-   any purpose does not give you the right to use
-   Servicemarks (sm) or Trademarks (tm) of the copyright
-   holders. Use of them is covered by separate agreement
-   with the copyright holders.
-
-5. If any files are modified, you must cause the modified
-   files to carry prominent notices stating that you changed
-   the files and the date of any change.
-
-Disclaimer
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
-  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
-  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
-  NO EVENT SHALL THE COPYRIGHT HOLDERS BE
-  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-  DAMAGE.

Modified: Zope/branches/tseaver-fix_wsgi/bootstrap.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/bootstrap.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/bootstrap.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/buildout.cfg
===================================================================
--- Zope/branches/tseaver-fix_wsgi/buildout.cfg	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/buildout.cfg	2010-05-28 20:11:49 UTC (rev 112816)
@@ -41,10 +41,17 @@
     Acquisition
     DateTime
     ExtensionClass
+    five.formlib
+    initgroups
+    Missing
+    MultiMapping
     Persistence
+    Record
     RestrictedPython
     tempstorage
+    ThreadLock
     zLOG
+    ZopeUndo
     zope.annotation
     zope.authentication
     zope.broken
@@ -66,7 +73,6 @@
     zope.event
     zope.exceptions
     zope.filerepresentation
-    zope.formlib
     zope.hookable
     zope.i18n
     zope.i18nmessageid

Deleted: Zope/branches/tseaver-fix_wsgi/configure
===================================================================
--- Zope/branches/tseaver-fix_wsgi/configure	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/configure	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,206 +0,0 @@
-#!/bin/sh
-
-# Zope configure script
-# $Id$
-
-#####################################################################
-#                    BEGIN EDITABLE PARAMETERS                      #
-#####################################################################
-
-# Place the optimal target version number for Zope (as returned by sys.version)
-# below
-TARGET="2.5.4"
-
-# Order a list of "acceptable" python version numbers (as returned by
-# sys.version) below in "best" to "worst" order, not including the
-# target version.  Up to six acceptable python versions are allowed.
-# Do not include the target version number in this list!
-ACCEPTABLE="2.6.1"
-
-# provide the executable names for all the acceptable versions
-# (and the target version) below
-EXENAMES="python python2 python2.5 python2.6"
-
-#####################################################################
-#                    END EDITABLE PARAMETERS                        #
-#####################################################################
-
-# where are we?
-HERE=`dirname $0`
-
-# should we be quiet?
-QUIET=""
-
-usage()
-{
-    echo
-    echo "configure [--help] [--quiet] [--with-python=path] [--prefix=path] "
-    echo "          [--build-base=path] [--ignore-largefile] [--ignore-zlib]"
-    echo "          [--optimize]"
-    echo
-    echo " Creates a Makefile suitable for building and installing Zope"
-    echo
-    echo " Options: "
-    echo "  --help              shows usage and quits"
-    echo "  --quiet             suppress nonessential output"
-    echo "  --with-python       specify a path to a Python interpreter to use"
-    echo "  --prefix            specify an installation path for binary data"
-    echo "  --build-base        specify a temporary path for build files"
-    echo "  --ignore-largefile  ignore large file support warnings"
-    echo "  --ignore-expat      ignore warnings about expat/pyexpat"
-    echo "  --ignore-zlib       ignore warnings about zlib"
-    echo "  --optimize          optimize compiled Python bytecode"
-    echo "  --no-compile        Dont compile Python bytecode"
-    echo
-    echo " Given no options, configure will search your PATH for a suitable"
-    echo " Python interpreter and will use '/opt/Zope-<ZOPE_MAJOR_VERSION>'"
-    echo " as a prefix."
-    echo
-}
-
-# bootstrap ourselves by finding a Python interpreter if necessary
-get_python() {
-    OLDIFS="$IFS"
-    IFS=":"
-    FOUND=""
-    VERSION=""
-    FOUNDLIST=""
-    out "Testing for an acceptable Python interpreter..."
-    out ""
-    for DIR in $PATH; do
-        IFS="$OLDIFS"
-        for EXECUTABLE in $EXENAMES; do
-            FULL="$DIR/$EXECUTABLE"
-            if [ -x "$FULL" -a ! -d "$FULL" ]; then
-                CMD="import string,sys;a=string.split(sys.version)[0]"
-		# Strip trailing + from version number
-		CMD="$CMD;a=(a[-1]=='+')and(a[:-1])or(a);print a"
-                VERSION=`"$FULL" -c "$CMD"`
-                out "  Python version $VERSION found at $FULL"
-                if [ "$VERSION" = "$TARGET" ]; then
-                    FOUND="$FULL"
-                    FOUNDVERSION=$VERSION
-                    break 2
-                else
-                    i=1;
-                    for ACC in $ACCEPTABLE; do
-                        i=`expr $i + 1`
-			for SLOT in $FOUNDLIST; do
-                            if [ $SLOT -eq $i ]; then
-                                # slot "i" already populated.  This means we've
-                                # already found this particular version of
-                                # python.  Continue the for ACC in 
-                                # $ACCEPTABLE loop and don't overwrite the
-                                # one we already found (interpreters first
-                                # on the path win).
-                                continue 2
-                            fi
-                        done
-                        if [ "$VERSION" = "$ACC" ]; then
-                            FOUNDLIST="$FOUNDLIST $i"
-                            eval "FOUND$i=$FULL"
-                            eval "FOUNDVERSION$i=$VERSION"
-                        fi
-                    done
-                fi
-            fi
-        done
-    done
-    if [ "$VERSION" = "$TARGET" ]; then
-        out ""
-        out "  The optimum Python version ($TARGET) was found at $FOUND."
-    elif [ -z "$FOUND1" ] && [ -z "$FOUND2" ] && [ -z "$FOUND3" ] &&
-         [ -z "$FOUND4" ] && [ -z "$FOUND5" ] && [ -z "$FOUND6" ] ; then
-        out ""
-        out "  No suitable Python version found.  You should install"
-        out "  Python version $TARGET before continuing."
-        if [ "$ACCEPTABLE" ]; then
-            out "  Versions $ACCEPTABLE also work, but not as optimally."
-        fi
-        exit 1
-    else
-        if   [ -n "$FOUND1" ]; then
-            FOUND=$FOUND1
-            FOUNDVERSION=$FOUNDVERSION1
-        elif [ -n "$FOUND2" ]; then
-            FOUND=$FOUND2
-            FOUNDVERSION=$FOUNDVERSION2
-        elif [ -n "$FOUND3" ]; then
-            FOUND=$FOUND3
-            FOUNDVERSION=$FOUNDVERSION3
-        elif [ -n "$FOUND4" ]; then
-            FOUND=$FOUND4
-            FOUNDVERSION=$FOUNDVERSION4
-        elif [ -n "$FOUND5" ]; then
-            FOUND=$FOUND5
-            FOUNDVERSION=$FOUNDVERSION5
-        elif [ -n "$FOUND6" ]; then
-            FOUND=$FOUND6
-            FOUNDVERSION=$FOUNDVERSION6
-        fi
-        out ""
-        out "  !! WARNING !! "
-        out "  An acceptable, but non-optimal Python version ($FOUNDVERSION) "
-        out "  was found at '$FOUND'."
-        out "  But consider installing version '$TARGET' before running "
-        out "  'make'.  If this isn't the Python version or interpreter "
-        out "  instance you wish to use, you may specify a Python interpreter"
-        out "  manually by rerunning the ./configure script with the "
-        out "  '--with-python' option."
-    fi
-    out ""
-}
-
-out() {
-    
-    if [ -z "$QUIET" ]; then
-        echo $1
-    fi
-}
-
-NEWOPTS=""
-
-for OPT in $@; do
-    case "$OPT" in
-    --h* | -h*)
-        usage
-        exit 0
-        ;;
-    --with-python=*)
-        # pop this argument from the arglist, it is not valid to
-        # pass this along to the Python configurator.
-        shift;
-        FOUND=`echo $OPT | sed -e 's/--with-python\=//'`
-        # use eval to do tilde expansion below
-        eval "FOUND='$FOUND'"
-        out ""
-        out "Using Python interpreter at $FOUND"
-        ;;
-    --with-python)
-	# in case someone passed in a --with-python without a value,
-        # we raise an error instead of passing it along to configure.py
-        # (which would raise an inscrutable error were it to receive this
-        # option).
-        out "--with-python argument requires an option"
-	exit 1
-        ;;
-    --quiet* | -q*)
-        QUIET="true"
-        NEWOPTS="$NEWOPTS $OPT"
-        ;;
-    *)
-        NEWOPTS="$NEWOPTS $OPT"
-        ;;
-    esac
-done
-
-out ""
-out "Configuring Zope installation"
-out ""
-
-if [ -z "$FOUND" ]; then
-    get_python
-fi
-
-# run the Python configurator
-"$FOUND" "$HERE/inst/configure.py" $NEWOPTS

Modified: Zope/branches/tseaver-fix_wsgi/doc/CHANGES.rst
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/CHANGES.rst	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/doc/CHANGES.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -2,17 +2,275 @@
 =========
 
 This file contains change information for the current Zope release.
-Change information for previous versions of Zope can be found in the
-file HISTORY.txt.
+Change information for previous versions of Zope can be found at
+http://docs.zope.org/zope2/releases/.
 
-Zope 2.12.2 (unreleased)
-------------------------
+2.12.7 (unreleased)
+-------------------
 
+Bugs Fixed
+++++++++++
+
+- Five's processInputs() would stomp on :list or :tuple values that contained
+  ints or other non-strings, would clear out :records entirely, and would not
+  do anything for :record fields.
+
+- LP #143261: The (very old-fashioned) Zope2.debug interactive request
+  debugger still referred to the toplevel module ``Zope``, which was 
+  renamed to ``Zope2`` a long time ago.
+
+- LP #142874: Naming objects ``URL`` or ``URL1`` broke several ZMI
+  views.
+
+- LP #142878: Remove URL-based suppression of access rules and site root
+  objects.   Suppression using ``os.environ`` still works.
+
+- LP #143144: Fix documentation for the zope.conf ``mount-point``
+  directive.
+
+- LP #142410: Do not index documents in a KeywordIndex if the document
+  is missing the indexed attribute, if determining the value raises
+  AttributeError, or of the indexed attribute is empty.
+
+- LP #142590: The ``DTMLMethod`` and ``DTMLDocument`` ``manage_edit``
+  methods could not deal with ``TaintedString`` instances. Removed the
+  entirely redundant ``DTMLDocument.manage_edit`` method at the same time.
+
+- LP #142451: If non-recursive ownership changes are made using 
+  ``changeOwnership``, do not touch any children.
+
+- LP #142750 and LP #142481: To prevent confusion when choosing an Id and
+  to avoid issues when creating two VirtualHostMonsters in the same 
+  container the VirtualHostMoster now has a default Id. It can no longer
+  be selected, and the intermediary Add view is gone.
+
 Features Added
 ++++++++++++++
 
+- Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.
+
+- LP #142226: Added an extra keyword argument to the HTTPResponse
+  setCookie method to suppress enclosing the cookie value field
+  in double quotes.
+
+2.12.6 (2010-05-17)
+-------------------
+
+Restructuring
++++++++++++++
+
+- Removed Zope2's own mkzeoinstance script in favor of the version from the
+  new zope.mkzeoinstance package.
+
+Features Added
+++++++++++++++
+
 - Updated packages:
 
+  - DateTime = 2.12.2
+  - distribute = 0.6.12
+  - ExtensionClass = 2.13.1
+  - initgroups = 2.13.0
+  - Missing = 2.13.0
+  - MultiMapping = 2.13.0
+  - Persistence = 2.13.1
+  - pytz = 2010h
+  - Record = 2.13.0
+  - RestrictedPython = 3.5.2
+  - ThreadLock = 2.13.0
+  - ZODB3 = 3.9.5
+  - zope.authentication = 3.7.1
+  - zope.browser = 1.3
+  - zope.cachedescriptors = 3.5.1
+  - zope.deferredimport = 3.5.1
+  - zope.i18n = 3.7.3
+  - zope.i18nmessageid = 3.5.2
+  - zope.lifecycleevent = 3.6.1
+  - zope.pagetemplate = 3.5.1
+  - zope.proxy = 3.6.0
+  - zope.security = 3.7.3
+
+Bugs Fixed
+++++++++++
+
+- LP #142563:  Fix ``AccessControl.User.NullUnrestrictedUserTests.__str__``.
+
+- Fix several template errors in SiteErrorLog (chameleon compatibility).
+
+- LP #267820:  Fix bad except clause in the ``sequence_sort`` method of
+  the ``<dtml-in>`` tag.
+
+- LP #351006:  Don't nest block tags inside HTML ``<p>`` tags in
+  ``zExceptions.ExceptionFormatter``.
+
+- LP #411837:  Handle resource files with ``.htm`` extension properly,
+  as page template resources.
+
+- LP #435728:  Fix indentation of OFSP/help/sequence.py docstring.
+
+- LP #574286:  Ensure that mailhosts which share a queue directory do not
+  double-deliver mails, by sharing the thread which processes emails for
+  that directory.
+
+- BaseRequest: Fixed handling of errors in 'traverseName'.
+
+2.12.5 (2010-04-24)
+-------------------
+
+Features Added
+++++++++++++++
+
+- Updated packages:
+
+  - Acquisition = 2.13.3
+  - distribute = 0.6.10
+  - roman = 1.4.0
+  - zope.annotation = 3.5.0
+  - zope.app.cache = 3.6.0
+  - zope.app.dav = 3.5.1
+  - zope.app.i18n = 3.6.1
+  - zope.app.localpermission = 3.7.2
+  - zope.app.principalannotation = 3.7.0
+  - zope.app.publication = 3.8.1
+  - zope.app.publisher = 3.8.4
+  - zope.app.renderer = 3.5.1
+  - zope.app.security = 3.7.3
+  - zope.app.session = 3.6.1
+  - zope.app.testing = 3.7.3
+  - zope.app.wsgi = 3.6.0
+  - zope.app.zapi = 3.4.1
+  - zope.broken = 3.6.0
+  - zope.catalog = 3.8.1
+  - zope.formlib = 3.7.0
+  - zope.i18nmessageid = 3.5.1
+  - zope.index = 3.6.0
+  - zope.keyreference = 3.6.2
+  - zope.lifecycleevent = 3.6.0
+  - zope.location = 3.6.0
+  - zope.minmax = 1.1.2
+  - zope.securitypolicy = 3.6.1
+  - zope.viewlet = 3.6.1
+
+- Downgrade the ``manage_* is discouraged. You should use event subscribers
+  instead`` warnings to debug level logging. This particular warning hasn't
+  motivated anyone to actually change any code.
+
+- Use the standard libraries doctest module in favor of the deprecated version
+  in zope.testing.
+
+- LP #143013: make the maximum number of retries on ConflictError a
+  configuration option.
+
+Bugs Fixed
+++++++++++
+
+- HTTPResponse: Fixed handling of exceptions with unicode values.
+
+- zExceptions: Fixed some unicode issues in Unauthorized.
+
+- LP #372632, comments #15ff.: Fixed regression in Unauthorized handling.
+
+- LP #563229:  Process "evil" JSON cookies which contain double quotes in
+  violation of RFC 2965 / 2616.
+
+- Document ``Products.PluginIndexes.PathIndex.PathIndex.insertEntry`` as
+  an API for use by subclasses.
+
+- Fixed regression introduced in the resource directory fix in 2.12.4.
+
+- LP #143655:  don't prevent sorting using a path index.
+
+- LP #142478:  normalize terms passed to ``PLexicon.queryLexicon`` using
+  the lexicon's pipeline (e.g., case flattening, stop word removal, etc.)
+
+- Wrap exception views in the context of the published object.
+
+2.12.4 (2010-04-05)
+-------------------
+
+Restructuring
++++++++++++++
+
+- Removed unmaintained build scripts for full Windows installers and
+  ``configure / make`` type builds.
+
+- Updated copyright and license information to conform with repository policy.
+
+- Factored out ZopeUndo package into a separate distribution.
+
+Features Added
+++++++++++++++
+
+- Updated packages:
+
+  - Acquisition = 2.13.2
+  - ExtensionClass = 2.13.0
+  - Persistence = 2.13.0
+  - pytz = 2010b
+
+- There is now an event ZPublisher.interfaces.IPubBeforeStreaming which will
+  be fired just before the first chunk of data is written to the response
+  stream when using the write() method on the response. This is the last
+  possible point at which response headers may be set in this case.
+
+Bugs Fixed
+++++++++++
+
+- LP #142430: Avoid using the contexts title_or_id method in the
+  standard_error_message.
+
+- LP #257675: request.form contained '-C':'' when no QUERY_STRING was in
+  the environment.
+
+- Zope 3-style resource directories would throw an Unauthorized error when
+  trying to use restrictedTraverse() to reach a resource in a sub-directory
+  of the resource directory.
+
+- Restore ability to traverse to 'macros' on template-based browser views.
+
+- Protect ZCTextIndex's clear method against storing Acquisition wrappers.
+
+- LP #195761: fixed ZMI XML export / import and restored it to the UI.
+
+- MailHost should fall back to HELO when EHLO fails.
+
+2.12.3 (2010-01-12)
+-------------------
+
+Bugs Fixed
+++++++++++
+
+- LP #491224: proper escaping of rendered error message
+
+- LP #246983: Enabled unicode conflict resolution on variables inside "string:"
+  expressions in TALES.
+
+- Fixed possible TypeError while sending multipart emails.
+
+- Also look for ZEXP imports within the clienthome directory. This
+  provides a place to put imports that won't be clobbered by buildout
+  in a buildout-based Zope instance.
+
+- Fixed a SyntaxError in utilities/load_site.py script.
+
+Features Added
+++++++++++++++
+
+- Made OFS.Image.File and OFS.Image.Image send IObjectModifiedEvent when
+  created through their factories and modified through the ZMI forms
+  (manage_edit() and manage_upload()).
+
+- Moved zope.formlib / zope.app.form integration into a separate package
+  called five.formlib.
+
+2.12.2 (2009-12-22)
+-------------------
+
+Features Added
+++++++++++++++
+
+- Updated packages:
+
   - ZODB3 = 3.9.4
   - docutils = 0.6
   - pytz = 2009r
@@ -43,7 +301,10 @@
 Bugs Fixed
 ++++++++++
 
-- LP #496961:  Remove all mention of ``standard_html_header`` and
+- LP #143444: add labels to checkboxes / radio buttons on import /
+  export form.
+
+- LP #496941:  Remove all mention of ``standard_html_header`` and
   ``standard_html_footer`` from default DTML content.
 
 - Fixed a regression in Products.PageTemplates that meant filesystem templates
@@ -59,10 +320,9 @@
 - Avoid possible errors on test tear-down in Products.Five.fiveconfigure's
   cleanUp() function if Products.meta_types has not been set
 
+2.12.1 (2009-11-02)
+-------------------
 
-Zope 2.12.1 (2009/11/02)
-------------------------
-
 Features Added
 ++++++++++++++
 
@@ -90,8 +350,8 @@
 
 - LP #453723: zopectl start works again on non-Windows platforms.
 
-Zope 2.12.0 final  (2009/10/01)
--------------------------------
+2.12.0 (2009-10-01)
+-------------------
 
 Features Added
 ++++++++++++++
@@ -114,8 +374,8 @@
 - LP #414757 (backported from Zope trunk): don't emit a IEndRequestEvent when
   clearing a cloned request.
 
-Zope 2.12.0 c1 (2009/09/04)
----------------------------
+2.12.0c1 (2009-09-04)
+---------------------
 
 Features Added
 ++++++++++++++
@@ -140,10 +400,9 @@
 - Made the version information show up again, based on pkg_resources
   distribution information instead of the no longer existing version.txt.
 
+2.12.0b4 (2008-08-06)
+---------------------
 
-Zope 2.12.0 b4 (2008/08/06)
----------------------------------
-
 Features Added
 ++++++++++++++
 
@@ -176,10 +435,9 @@
 - MailHost manage form no longer interprets the value None as a string
   in user and password fields.
 
+2.12.0b3 (2009-07-15)
+---------------------
 
-Zope 2.12.0 b3 (2009/07/15)
----------------------------
-
 Features Added
 ++++++++++++++
 
@@ -227,8 +485,8 @@
 
 - Correctly handle exceptions in the ZPublisherExceptionHook.
 
-Zope 2.12.0 b2 (2009/05/27)
----------------------------
+2.12.0b2 (2009-05-27)
+---------------------
 
 Restructuring
 +++++++++++++
@@ -323,8 +581,8 @@
   Fixes https://bugs.launchpad.net/zope2/+bug/372629 , which prevented
   viewing the "Try" tab of a script with no parameters.
 
-Zope 2.12.0b1 (2009/05/06)
---------------------------
+2.12.0b1 (2009-05-06)
+---------------------
 
 Restructuring
 +++++++++++++

Copied: Zope/branches/tseaver-fix_wsgi/doc/INSTALL-buildout.rst (from rev 112805, Zope/branches/2.12/doc/INSTALL-buildout.rst)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/INSTALL-buildout.rst	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/doc/INSTALL-buildout.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,186 @@
+Installing and Zope with ``zc.buildout``
+========================================
+
+.. highlight:: bash
+
+This document descibes how to get going with Zope using ``zc.buildout``.
+
+
+About ``zc.buildout``
+---------------------
+
+`zc.buildout <http://www.buildout.org/>`_ is a powerful tool for creating
+repeatable builds of a given software configuration and environment.  The
+Zope developers use ``zc.buildout`` to develop Zope itself, as well as
+the underlying packages it uses.
+
+Prerequisites
+-------------
+
+In order to use Zope, you must have the following pre-requisites
+available: 
+
+- A supported version of Python, including the development support if
+  installed from system-level packages.  Supported versions include:
+
+  * 2.6.x
+
+- Zope needs the Python ``zlib`` module to be importable.  If you are
+  building your own Python from source, please be sure that you have the
+  headers installed which correspond to your system's ``zlib``.
+
+- A C compiler capable of building extension modules for your Python
+  (gcc recommended). This is not necessary for Windows as binary
+  releases of the parts that would need compiling are always made
+  available.
+
+- If you wish to install Zope as a Service on Windows, you will need
+  to have the `pywin32`__ package installed.
+
+  __ https://sourceforge.net/projects/pywin32/
+
+
+Installing standalone Zope using zc.buildout
+--------------------------------------------
+
+In this configuration, we use ``zc.buildout`` to install the Zope software,
+but then generate server "instances" outside the buildout environment.
+
+Installing the Zope software
+::::::::::::::::::::::::::::
+
+Installing the Zope software using ``zc.buildout`` involves the following
+steps:
+
+- Download the Zope 2 source distribution from `PyPI`__
+
+  __ http://pypi.python.org/pypi/Zope2
+
+- Bootstrap the buildout
+
+- Run the buildout
+
+On Linux, this can be done as follows::
+
+  $ wget http://pypi.python.org/packages/source/Z/Zope2/Zope2-<Zope version>.tar.gz
+  $ tar xfvz Zope2-<Zope version>.tar.gz
+  $ cd Zope2-<Zope version>
+  $ /path/to/your/python bootstrap/bootstrap.py
+  $ bin/buildout
+
+
+Creating a Zope instance
+::::::::::::::::::::::::
+
+Once you've installed Zope, you will need to create an "instance
+home". This is a directory that contains configuration and data for a
+Zope server process.  The instance home is created using the
+``mkzopeinstance`` script::
+
+  $ bin/mkzopeinstance
+
+You can specify the Python interpreter to use for the instance
+explicitly:: 
+
+  $ bin/mkzopeinstance --python=$PWD/bin/zopepy
+
+You will be asked to provide a user name and password for an
+administrator's account during ``mkzopeinstance``.  To see the available
+command-line options, run the script with the ``--help`` option::
+
+  $ bin/mkzopeinstance --help
+
+.. note::
+  The traditional "inplace" build is no longer supported. If using
+  ``mkzopeinstance``, always do so outside the buildout environment.
+
+
+Creating a buildout-based Zope instance
+---------------------------------------
+
+Rather than installing Zope separately from your instance, you may wish
+to use ``zc.buildout`` to create a self-contained environment, containing
+both the Zope software and the configuration and data for your server.
+This procedure involves the following steps:
+
+- Create the home directory for the buildout, including 
+  ``etc``, ``log`` and ``var`` subdirectories.
+
+- Fetch the buildout bootstrap script into the environment.
+
+- Create a buildout configuration as follows:
+
+.. topic:: buildout.cfg
+ :class: file
+
+ ::
+
+   [buildout]
+   parts = instance 
+   extends = http://download.zope.org/Zope2/index/<Zope version>/versions.cfg
+
+   [instance]
+   recipe = zc.recipe.egg
+   eggs = Zope2
+   interpreter = py
+   scripts = runzope zopectl
+   initialization =
+     import sys
+     sys.argv[1:1] = ['-C',r'${buildout:directory}/etc/zope.conf']
+
+This is the minimum but all the usual buildout techniques can be
+used.
+
+- Bootstrap the buildout
+
+- Run the buildout
+
+- Create a Zope configuration file.  A minimal version would be:
+
+.. topic:: etc/zope.cfg
+ :class: file
+
+ ::
+
+   %define INSTANCE <path to your instance directory>
+
+   python $INSTANCE/bin/py[.exe on Windows]
+ 
+   instancehome $INSTANCE
+
+A fully-annotated sample can be found in the Zope2 egg::
+
+   $ cat eggs/Zope2--*/Zope2/utilities/skel/etc/zope.conf.in
+
+   <rest of the stuff that goes into a zope.conf, e.g. databases and log files.>
+
+.. highlight:: bash
+
+An example session::
+
+   $ mkdir /path/to/instance
+   $ cd /path/to/instance
+   $ mkdir etc logs var
+   $ wget http://svn.zope.org/zc.buildout/trunk/bootstrap/bootstrap.py
+   $ vi buildout.cfg
+   $ /path/to/your/python bootstrap.py
+   $ bin/buildout
+   $ cat eggs/Zope2--*/Zope2/utilities/skel/etc/zope.conf.in > etc/zope.conf
+   $ vi etc/zope.conf  # replace <<INSTANCE_HOME>> with buildout directory
+   $ bin/zopectl start
+
+In the ``bin`` subdirectory of your instance directory, you will
+find ``runzope`` and ``zopectl`` scripts that can be used as
+normal.
+
+You can use ``zopectl`` interactively as a command shell by just
+calling it without any arguments. Try ``help`` there and ``help <command>``
+to find out about additionally commands of zopectl. These commands
+also work at the command line.
+
+Note that there are there are recipes such as `plone.recipe.zope2instance
+<http://pypi.python.org/pypi/plone.recipe.zope2instance>`_ which can be
+used to automate this whole process.
+
+After installation, refer to :doc:`operation` for documentation on
+configuring and running Zope.

Modified: Zope/branches/tseaver-fix_wsgi/doc/INSTALL.rst
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/INSTALL.rst	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/doc/INSTALL.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,13 +1,13 @@
-============================
-Building and Installing Zope
-============================
+Installing Zope
+===============
 
 .. highlight:: bash
 
 This document descibes how to get going with Zope.
 
+
 Prerequisites
-=============
+-------------
 
 In order to use Zope, you must have the following pre-requisites
 available: 
@@ -31,82 +31,33 @@
 
   __ https://sourceforge.net/projects/pywin32/
 
+
 Installing Zope
-===============
+---------------
 
-Unless using buildout to build a zope instance as described
-:ref:`below <buildout-instances>`, you will need to install Zope
-separately. If you want to create a buildout-based Zope instance,
-please skip directly to that section.
+The recommended way to install Zope is within a virtualized Python environment
+using ``virtualenv`` as follows::
 
-Installing Zope using virtualenv
---------------------------------
-
-Zope can be installed within a virtualized Python environment using 
-``virtualenv`` as follows::
-
   $ virtualenv --no-site-packages my_zope
   $ cd my_zope
-  $ source bin/activate
   $ bin/easy_install -i http://download.zope.org/Zope2/index/<Zope version> Zope2
 
-Using ``virtualenv`` is **highly recommended**. Otherwise, you may encounter
-unexpected conflicts with packages that have already been installed.
+If you don't already have ``virtualenv`` installed on your system, download
+the latest release from the `virtualenv PyPI page
+<http://pypi.python.org/pypi/virtualenv>`_, unpack it, and install it, e.g.::
 
-Once you've installed Zope, you'll need to :ref:`create an instance <classic-instances>`.
+  $ wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.4.6.tar.gz
+  $ tar xzf virtualenv-1.4.6.tar.gz
+  $ cd virtuaenv-1.4.6
+  $ /path/to/python2.6 setup.py install
 
-Installing Zope using zc.buildout
----------------------------------
+If you wish to manage your Zope instance using
+buildout, please see the :doc:`INSTALL-buildout`.
 
-Unless you are `developing zope`__, you most likely
-want to be creating a :ref:`buildout-based Zope instance <buildout-instances>` rather
-that installing using buildout as described in this section.
 
-__ http://docs.zope.org/developer/
+Creating a Zope Instance
+------------------------
 
-However, if you really just want to create Zope instances using the
-classic ``mkzopeinstance`` but with the software installed by buildout,
-then you need to do the following:
-
-- Download the Zope 2 source distribution from `PyPI`__
-
-  __ http://pypi.python.org/pypi/Zope2
-
-- Bootstrap the buildout
-
-- Run the buildout
-
-On Linux, this can be done as follows::
-
-  $ wget http://pypi.python.org/packages/source/Z/Zope2/Zope2-<Zope version>.tar.gz
-  $ tar xfvz Zope2-2.12.0.tar.gz
-  $ cd Zope2-2.12.0
-  $ /path/to/your/python bootstrap/bootstrap.py
-  $ bin/buildout
-
-Once you've installed Zope, you'll need to :ref:`create an instance <classic-instances>`.
-
-Installing Zope using easy_install
-----------------------------------
-
-Zope can be installed using ``easy_install``, but it is recommended to
-use ``virtualenv`` as described above to avoid unexpected conflicts
-with other packages installed directly in your python installation.
-
-However, if you want to use easy_install globally, all you need to do
-is::
-
-  $ easy_install -i http://download.zope.org/Zope2/index/<Zope version> Zope2
-
-This will create the related scripts such as ``mkzopeinstance`` within the
-scripts folder of your python installation. You can then use them to
-create instances as described below.
-
-.. _classic-instances:
-
-Creating a classic Zope Instance
-================================
-
 Once you've installed Zope, you will need to create an "instance
 home". This is a directory that contains configuration and data for a
 Zope server process.  The instance home is created using the
@@ -114,11 +65,6 @@
 
   $ bin/mkzopeinstance
 
-You can specify the Python interpreter to use for the instance
-explicitly:: 
-
-  $ bin/mkzopeinstance --python=$PWD/bin/zopepy
-
 You will be asked to provide a user name and password for an
 administrator's account during ``mkzopeinstance``.  To see the available
 command-line options, run the script with the ``--help`` option::
@@ -126,225 +72,9 @@
   $ bin/mkzopeinstance --help
 
 .. note::
-  The traditional "inplace" build is no longer supported. If using
-  ``mkzopeinstance``, always do so outside the buildout/virtualenv
-  environment. If you wish to manage your Zope instance using
-  buildout, please see the section below.
+  The traditional "inplace" build is no longer supported.  Always use
+  ``mkzopeinstance`` to create instances outside the virtualenv environment.
 
-.. _buildout-instances:
 
-Creating a buildout-based Zope Instance
-=======================================
-
-If you wish to use buildout to manage your Zope instance, then the
-instance is created as follows:
-
-* Create a directory for your instance. In this directory, create a
-  ``etc``, ``logs`` and ``var`` subdirectories.
-
-* Download the following file into your instance directory:
-
-  `http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py`__
-    
-  __ http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
-
-.. highlight:: none
-
-* Create a buildout configuration as follows:
-
-.. topic:: buildout.cfg
- :class: file
-
- ::
-
-   [buildout]
-   parts = instance 
-   extends = http://svn.zope.org/*checkout*/Zope/tags/<Zope version>/versions.cfg
-
-   [instance]
-   recipe = zc.recipe.egg
-   eggs = Zope2
-   interpreter = py
-   scripts = runzope zopectl
-   initialization =
-     import sys
-     sys.argv[1:1] = ['-C',r'${buildout:directory}/etc/zope.conf']
-
-This is the minimum but all the usual buildout techniques can be
-used.
-
-* Create a Zope configuration file starting as follows:
-
-.. topic:: etc/zope.cfg
- :class: file
-
- ::
-
-   %define INSTANCE <path to your instance directory>
-
-   python $INSTANCE/bin/py[.exe on Windows]
- 
-   instancehome $INSTANCE
-
-.. highlight:: bash
-
-* Now, run the following commands::
-
-    $ /path/to/your/python bootstrap.py
-    $ bin/buildout
-
-  In the ``bin`` subdirectory of your instance directory, you will
-  find ``runzope`` and ``zopectl`` scripts that can be used as
-  normal.
-
-Using your Zope instance
-========================
-
-There are various ways to run Zope from your newly created
-instance. They are all described below.
-
-Running Zope in the Foreground
-------------------------------
-
-To run Zope without detaching from the console, use the ``fg``
-command (short for ``foreground``)::
-
-  $ /path/to/zope/instance/bin/zopectl fg
-
-In this mode, Zope emits its log messages to the console, and does not
-detach from terminal.
-
-
-Running Zope as a Daemon
--------------------------
-
-Once an instance home has been created, the Zope server can now be
-started using this command::
-
-  $ /path/to/zope/instance/bin/zopectl start
-
-During start, zope emits log messages into ./log/event.log
-You can examine it with the usual tools (cat, more, tail)
-and see if there are any errors preventing zope from starting.
-
-.. highlight:: none
-.. note::
-
-  For this to work on Windows, the Zope instance must be installed as
-  a Service. This is done with::
-
-    bin\zopectl install
-
-  If you later want to remove this Service, do the following::
-
-    bin\zopectl remove
-
-  For the full list of options available for setting up Zope as a
-  Windows Service, do::
-
-    bin\zopectl install --help
-
-.. highlight:: bash
-
-Integrating with System Startup
--------------------------------
-
-zopectl can be linked as rc-script in the usual start directories
-on linux or other System V unix variants.
-
-You can use ``zopectl`` interactively as a command shell by just
-calling it without any arguments. Try ``help`` there and ``help <command>``
-to find out about additionally commands of zopectl. These commands
-also work at the command line.
-
-.. note::
-
-  On Windows, a Service can be installed and set to start
-  automatically with the following:
-
-  .. code-block:: none
-
-    bin\zopectl install --startup=auto
-
-Configuring Zope
-================
-
-Your Zope instance is configured through a file, either found by
-default::
-
-  $ /path/to/zope/instance/bin/zopectl show
-  ...
-  Config file:  /path/to/zope/instance/etc/zope.conf
-
-or passed explicitly on the commandline::
-
-  $ /path/to/zope/instance/bin/zopectl -c /tmp/other.conf show
-  ...
-  Config file:  /tmp/other.conf
-
-When starting Zope, if you see errors indicating that an address is in
-use, then you may have to change the ports Zope uses for HTTP or FTP. 
-The default HTTP and FTP ports used by Zope are
-8080 and 8021 respectively. You can change the ports used by
-editing ./etc/zope.conf appropriately.
-
-The section in the configuration file looks like this::
-
-  <http-server>
-    # valid keys are "address" and "force-connection-close"
-    address 8080
-    # force-connection-close on
-  </http-server>
-
-The address can just be a port number as shown, or a  host:port
-pair to bind only to a specific interface.
-
-Logging In To Zope
-==================
-
-Once you've started Zope, you can then connect to the Zope webserver
-by directing your browser to::
-
-  http://yourhost:8080/manage
-
-where 'yourhost' is the DNS name or IP address of the machine
-running Zope.  If you changed the HTTP port as described, use the port
-you configured.
-
-You will be prompted for a user name and password. Use the user name
-and password you provided in response to the prompts issued during
-the "make instance" process.
-
-If you are using a buildout-based Zope instance, you will need to
-create a user as follows::
-
-  $ bin/zopectl adduser username password
-
-Now you're off and running! You should be looking at the Zope
-management screen which is divided into two frames. On the left you
-can navigate between Zope objects and on the right you can edit them
-by selecting different management functions with the tabs at the top
-of the frame.
-
-If you haven't used Zope before, you should head to the Zope web
-site and read some documentation. The Zope Documentation section is
-a good place to start. You can access it at http://docs.zope.org/
-
-Troubleshooting
-===============
-
-- This version of Zope requires Python 2.6.4 or better.
-  It will *not* run with Python 3.x.
-
-- The Python you run Zope with *must* have threads compiled in,
-  which is the case for a vanilla build.  Warning: Zope will not run
-  with a Python version that uses ``libpth``.  You *must* use
-  ``libpthread``.
-
-- To build Python extensions you need to have Python configuration
-  information available. If your Python comes from an RPM you may
-  need the python-devel (or python-dev) package installed too. If
-  you built Python from source all the configuration information
-  should already be available.
-
-- See the :doc:`CHANGES` for important notes on this version of Zope.
+After installation, refer to :doc:`operation` for documentation on
+configuring and running Zope.

Modified: Zope/branches/tseaver-fix_wsgi/doc/WHATSNEW.rst
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/WHATSNEW.rst	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/doc/WHATSNEW.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -14,11 +14,11 @@
 Zope 2 has supported and required Python 2.4 since its 2.9 release in summer
 2006. Later versions of Python have so far been unsupported by Zope 2.
 
-This version of Zope 2 adds support for both Python 2.5 and 2.6 at the same
-time. As Python 2.4 is no longer maintained itself, it is no longer officially
-supported by this Zope 2 version. There is however no code in Zope 2 yet which
-requires Python 2.5, so applications built on top of Zope 2 should still
-continue to run with Python 2.4.
+This version of Zope 2 adds support for Python 2.6 instead. As neither Python
+2.4 nor Python 2.5 are officially maintained any longer. Python 2.4 on 64-bit
+platforms is known to be incompatible with Zope 2.12. On 32-bit it could work
+at your own risk. While there are no known incompatibilities with Python 2.5
+it is not recommended.
 
 Python 3 is a backwards incompatible release of Python and not supported. At
 this point there is no concrete roadmap for adoption of Python 3. It is
@@ -52,27 +52,31 @@
 <http://pypi.python.org/pypi/virtualenv>`_ are in wide-spread use.
 
 
-Zope Toolkit
-------------
+Zope 3
+------
 
-This version of Zope 2 is based on the Zope Toolkit. The Zope Toolkit is an
-extraction of the reusable and wildly used packages of the former Zope 3
-project. The Zope Toolkit is focused on supporting frameworks and applications,
-rather than trying to be one itself. Parts of the Zope Toolkit are used by
-Zope 2, Plone, Grok, Repoze.bfg, and by many other different applications and
-frameworks.
+This version of Zope 2 does no longer includes a full version of the Zope 3
+application server nor a specific release of it. Instead it includes a minimal
+set of packages from the former Zope 3 project. Only those packages actually
+used by Zope 2 itself are still included. Examples of such packages include
+zope.interface, zope.component, zope.i18n, zope.tal and many more.
 
-A major focus of the Zope Toolkit was to refactor package dependencies to
-generate more maintainable and better structured code. Based on this effort
-the number of packages included by Zope 2 could be dramatically reduced from
-about 120 additional packages to just over 60. The total code size of Zope 2
-and its dependencies has decreased by over 200,000 lines of code as a result.
+Zope 2.12 marks a transitionary release, where a number of zope.app packages
+are still included. An ongoing effort to refactor those packages into more
+reusable and minimal packages is going on and will result in no zope.app
+packages being used or shipped with anymore as part of Zope 2. Zope 2.13 does
+no longer ship with any zope.app packages.
 
-You can find more information about the changes in the Zope Toolkit at
-http://docs.zope.org/zopetoolkit/. Upgrade information from Zope 3 to the Zope
-Toolkit can be found at http://docs.zope.org/zopetoolkit/migration/index.html.
+If you are using zope.app packages inside your own codebase, you should make
+sure to declare these as dependencies of your packages or otherwise follow the
+refactoring effort and remove your dependency on these packages.
 
+As a result of this refocussing on more minimal dependencies, the number of
+packages included by Zope 2 could be dramatically reduced from about 120
+additional packages to just over 70. The total code size of Zope 2 and its
+dependencies has decreased by over 200,000 lines of code as a result.
 
+
 ZODB 3.9
 --------
 

Modified: Zope/branches/tseaver-fix_wsgi/doc/index.rst
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/index.rst	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/doc/index.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -9,6 +9,8 @@
 
    WHATSNEW.rst
    INSTALL.rst
+   INSTALL-buildout.rst
+   operation.rst
    USERS.rst
    SECURITY.rst
    SETUID.rst

Copied: Zope/branches/tseaver-fix_wsgi/doc/operation.rst (from rev 112805, Zope/branches/2.12/doc/operation.rst)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/doc/operation.rst	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/doc/operation.rst	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,155 @@
+Configuring and Running Zope
+============================
+
+.. highlight:: bash
+
+
+Whichever method you used to install Zope and create a server instance (see
+:doc:`INSTALL` and :doc:`INSTALL-buildout`), the end result is configured
+and operated the same way.
+
+
+Configuring Zope
+----------------
+
+Your instance's configuration is defined in its ``etc/zope.conf`` file.
+Unless you created the file manually, that file should contain fully-
+annotated examples of each directive.
+
+You can also pass an explicit configuration file on the commandline::
+
+  $ /path/to/zope/instance/bin/zopectl -c /tmp/other.conf show
+  ...
+  Config file:  /tmp/other.conf
+
+When starting Zope, if you see errors indicating that an address is in
+use, then you may have to change the ports Zope uses for HTTP or FTP. 
+The default HTTP and FTP ports used by Zope are
+8080 and 8021 respectively. You can change the ports used by
+editing ./etc/zope.conf appropriately.
+
+The section in the configuration file looks like this::
+
+  <http-server>
+    # valid keys are "address" and "force-connection-close"
+    address 8080
+    # force-connection-close on
+  </http-server>
+
+The address can just be a port number as shown, or a  host:port
+pair to bind only to a specific interface.
+
+After making any changes to the configuration file, you need to restart any
+running Zope server for the affected instance before changes are in effect.
+
+
+Running Zope in the Foreground
+------------------------------
+
+To run Zope without detaching from the console, use the ``fg``
+command (short for ``foreground``)::
+
+  $ /path/to/zope/instance/bin/zopectl fg
+
+In this mode, Zope emits its log messages to the console, and does not
+detach from the terminal.
+
+
+Running Zope as a Daemon
+------------------------
+
+Once an instance home has been created, the Zope server can now be
+started using this command::
+
+  $ /path/to/zope/instance/bin/zopectl start
+
+During startup, Zope emits log messages into
+`/path/to/zope/instance/log/event.log`.  You can examine it with the usual
+tools (``cat``, ``more``, ``tail``, etc) and see if there are any errors
+preventing Zope from starting.
+
+.. highlight:: none
+.. note::
+
+  For this to work on Windows, the Zope instance must be installed as
+  a Service. This is done with::
+
+    bin\zopectl install
+
+  If you later want to remove this Service, do the following::
+
+    bin\zopectl remove
+
+  For the full list of options available for setting up Zope as a
+  Windows Service, do::
+
+    bin\zopectl install --help
+
+.. highlight:: bash
+
+
+Integrating with System Startup
+-------------------------------
+
+zopectl can be linked as rc-script in the usual start directories
+on linux or other System V unix variants.
+
+You can use ``zopectl`` interactively as a command shell by just
+calling it without any arguments. Try ``help`` there and ``help <command>``
+to find out about additionally commands of zopectl. These commands
+also work at the command line.
+
+.. note::
+
+  On Windows, a Service can be installed and set to start
+  automatically with the following:
+
+  .. code-block:: none
+
+    bin\zopectl install --startup=auto
+
+
+Logging In To Zope
+------------------
+
+Once you've started Zope, you can then connect to the Zope webserver
+by directing your browser to::
+
+  http://yourhost:8080/manage
+
+where 'yourhost' is the DNS name or IP address of the machine
+running Zope.  If you changed the HTTP port as described, use the port
+you configured.
+
+You will be prompted for a user name and password. Use the user name
+and password you provided in response to the prompts issued during
+the "make instance" process.
+
+Now you're off and running! You should be looking at the Zope
+management screen which is divided into two frames. On the left you
+can navigate between Zope objects and on the right you can edit them
+by selecting different management functions with the tabs at the top
+of the frame.
+
+If you haven't used Zope before, you should head to the Zope web
+site and read some documentation. The Zope Documentation section is
+a good place to start. You can access it at http://docs.zope.org/
+
+Troubleshooting
+---------------
+
+- This version of Zope requires Python 2.6.4 or better.
+  It will *not* run with Python 3.x.
+
+- The Python you run Zope with *must* have threads compiled in,
+  which is the case for a vanilla build.  Warning: Zope will not run
+  with a Python version that uses ``libpth``.  You *must* use
+  ``libpthread``.
+
+- To build Python extensions you need to have Python configuration
+  information available. If your Python comes from an RPM you may
+  need the python-devel (or python-dev) package installed too. If
+  you built Python from source all the configuration information
+  should already be available.
+
+- See the :doc:`CHANGES` for important notes on this version of Zope.

Deleted: Zope/branches/tseaver-fix_wsgi/inst/Makefile.in
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/Makefile.in	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/Makefile.in	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,157 +0,0 @@
-# Zope2 build and install Makefile.
-
-# We do as much as possible in Python in order to avoid needing to
-# learn autoconf or some other awful thing. ;-)
-
-NAME=Zope
-MAJOR_VERSION=<<ZOPE_MAJOR_VERSION>>
-MINOR_VERSION=<<ZOPE_MINOR_VERSION>>
-RELEASE_TAG=<<VERSION_RELEASE_TAG>>
-PACKAGE_NAME=${NAME}-${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}
-
-PYTHON="<<PYTHON>>"
-TMPDIR=/tmp
-PREFIX=<<PREFIX>>
-BASE_DIR=<<BASE_DIR>>
-BUILD_BASE=<<BUILD_BASE>>
-DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
-INSTALL_FLAGS=<<INSTALL_FLAGS>>
-TESTOPTS=-v
-BUILD_FLAGS=--build-base="${BUILD_BASE}" \
-            --build-lib="${BUILD_BASE}/build-lib" \
-            --build-scripts="${BUILD_BASE}/build-scripts"\
-            --build-temp="${BUILD_BASE}/build-temp"
-
-RM=rm -f
-RMRF=rm -rf
-FIND=find
-GREP=grep
-XARGS=xargs
-CD=cd
-LN=ln -sfn
-CP=cp
-TAR=tar
-MKDIR=mkdir -p
-
-.PHONY : clean install instance untestinst testinst build unbuild
-.PHONY : default
-
-# default:     The default step (invoked when make is called without a target)
-default: build
-	@echo
-	@echo Zope built.  Next, do \'make install\' \(or \'make inplace\',
-	@echo followed by \'make instance\' to run a Zope instance directly
-	@echo from the build directory\).
-
-# build:       Do whatever 'setup.py build' implies
-build:
-	${PYTHON} "${BASE_DIR}/setup.py" \
-           ${DISTUTILS_OPTS} build ${BUILD_FLAGS}
-
-# unbuild:     Remove the build directory (undo the make build step)
-unbuild:
-	${RMRF} ${BUILD_BASE}
-
-# install:     Install a software home.
-install: build version_txt
-	${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} install \
-	   --home="${PREFIX}" ${BUILD_FLAGS} ${INSTALL_FLAGS}
-	[ -f ${PREFIX}/bin/python ] || ${LN} ${PYTHON} ${PREFIX}/bin/python
-	@echo
-	@echo Zope binaries installed successfully.
-	@echo Now run \'${PREFIX}/bin/mkzopeinstance.py\'
-
-# inplace:     Install a software home into to the source directory.
-#
-# Note: We used to run 'build_ext -i' for 'inplace', but that was
-# suboptimal because it had a tendency to try to rebuild all of the
-# (possibly  already-built) extensions that might be built during a
-# previous 'make' step.  built_ext doesn't understand '--build-base'
-# and friends so we can't stop it from doing this easily.  So instead,
-# we rely on the stock install step and name the prefix as the current
-# directory.  This is a little less efficient than just building the
-# extensions because it also compiles bytecode, but it's more intuitive and
-# less expensive in the common case than letting distutils
-# potentially rebuild the binaries when we've done that already.
-inplace: PREFIX=${BASE_DIR}
-inplace: install
-
-# test:        Do an inplace build and run the Zope test suite.
-test: inplace
-	${PYTHON} "${BASE_DIR}/test.py" ${TESTOPTS}
-
-# instance:    Do an inplace build and create an instance home in the resulting
-#              software home.
-instance: build
-	${PYTHON} "${BASE_DIR}/utilities/mkzopeinstance.py" ${MKZ_FLAGS}
-
-# testinst:    Perform an inplace build and create an instance home in the
-#              resulting software home without asking questions.  Useful when
-#              performing automated testing.
-testinst: MKZ_FLAGS=--user=admin:admin --dir="${BASE_DIR}"
-testinst: instance
-
-# uninstance:  Remove the instance files made by testinstance (w/ prejudice)
-uninstance:
-	${RMRF} "${BASE_DIR}/etc"
-	${RMRF} "${BASE_DIR}/import"
-	${RMRF} "${BASE_DIR}/log"
-	${RMRF} "${BASE_DIR}/var"
-	${RMRF} "${BASE_DIR}/Products"
-
-# clean:       Delete the build files and any binaries/bytecode files in
-#              the source directory for good measure.
-clean: unbuild
-	${FIND} "${BASE_DIR}" \
-         -name '*.py[co]' -o -name '*.so' -o -name '*.o' | \
-         grep -vE "${BASE_DIR}/src|${BASE_DIR}/parts|${BASE_DIR}/eggs|${BASE_DIR}/develop" | \
-         ${XARGS} ${RM}
-	${RM} "$(BASE_DIR)/lib/python/Zope2/version.txt"
-	${RMRF} build
-
-# version_txt: create a version file in lib/python/version.txt
-version_txt:
-	printf "Zope ${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}" >\
-          "${BASE_DIR}/lib/python/Zope2/version.txt"
-
-sdist: clean sdist_tgz
-
-# sdist_tgz:   Create a tgz archive file as a source distribution.
-#
-sdist_tgz: version_txt
-	${FIND} . -type f -exec chmod a+r {} \; 
-	${FIND} . -type d -exec chmod a+rx {} \; 
-	${MKDIR} ${TMPDIR}
-	${CD} ${TMPDIR} && ${LN} ${BASE_DIR} ${PACKAGE_NAME} && \
-          ${TAR} czfh ${BASE_DIR}/${PACKAGE_NAME}.tgz \
-           --exclude=${PACKAGE_NAME}.tgz\
-           --exclude=.svn\
-           --exclude=${PACKAGE_NAME}/.installed.cfg \
-           --exclude=.DS_Store \
-           --exclude=${PACKAGE_NAME}/bin \
-           --exclude=${PACKAGE_NAME}/etc \
-           --exclude=${PACKAGE_NAME}/import \
-           --exclude=${PACKAGE_NAME}/log \
-           --exclude=${PACKAGE_NAME}/var \
-           --exclude=${PACKAGE_NAME}/Products \
-           --exclude=${PACKAGE_NAME}/makefile \
-           --exclude=${PACKAGE_NAME}/build-base \
-           --exclude=${PACKAGE_NAME}/bootstrap \
-           --exclude=${PACKAGE_NAME}/develop-eggs \
-           --exclude=${PACKAGE_NAME}/develop \
-           --exclude=${PACKAGE_NAME}/eggs \
-           --exclude=${PACKAGE_NAME}/include \
-           --exclude=${PACKAGE_NAME}/parts \
-           --exclude=${PACKAGE_NAME}/src \
-           --exclude=${PACKAGE_NAME}/*.cfg \
-           --exclude=*~ \
-           --exclude=.#* ${PACKAGE_NAME} 
-	${RMRF} ${TMPDIR}/${PACKAGE_NAME}
-
-# clobber:     Make the source tree 'pristine' again.
-clobber: clean uninstance
-
-# distclean:     Make the source tree *really* 'pristine' again.
-distclean: clobber
-	${RM} makefile Makefile
-	${RMRF} build-base

Deleted: Zope/branches/tseaver-fix_wsgi/inst/Makefile.win.in
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/Makefile.win.in	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/Makefile.win.in	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,133 +0,0 @@
-# Zope2 build and install Makefile for win32 (nmake-style).
-
-# We do as much as possible in Python in order to avoid needing to
-# learn autoconf or some other awful thing. ;-)
-
-NAME=Zope
-MAJOR_VERSION=<<ZOPE_MAJOR_VERSION>>
-MINOR_VERSION=<<ZOPE_MINOR_VERSION>>
-RELEASE_TAG=<<VERSION_RELEASE_TAG>>
-ZOPEVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG)
-PACKAGE_NAME=$(NAME)-$(ZOPEVERSION)
-
-PYTHON="<<PYTHON>>"
-TMPDIR="<<TMP_DIR>>"
-PREFIX="<<PREFIX>>"
-BASE_DIR=<<BASE_DIR>>
-BUILD_BASE=<<BUILD_BASE>>
-DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
-INSTALL_FLAGS=<<INSTALL_FLAGS>>
-TESTOPTS=-v
-BUILD_FLAGS=--build-base="$(BUILD_BASE)" \
-            --build-lib="$(BUILD_BASE)\build-lib" \
-            --build-scripts="$(BUILD_BASE)\build-scripts" \
-            --build-temp="$(BUILD_BASE)\build-temp"
-
-RM=del /f /q
-!IF ("$(OS)" == "Windows_NT")
-RMRF=rmdir /s /q
-!ELSE
-RMRF=deltree /y
-!ENDIF
-CD=cd
-XCOPY=xcopy /i /s /e /y
-COPY=copy
-MOVE=move
-EXISTS=IF EXIST
-NOT_EXISTS=IF NOT EXIST
-
-default: build
-# default:     The default step (invoked when make is called without a target)
-	@ echo.
-	@ echo Zope built.  Next, do 'nmake install'.
-	@ echo.
-
-.PHONY : clean install instance untestinst testinst build unbuild
-.PHONY : default
-
-# build:       Do whatever 'setup.py build' implies
-build:
-	$(PYTHON) "$(BASE_DIR)\setup.py" \
-            $(DISTUTILS_OPTS) build $(BUILD_FLAGS)
-
-# unbuild:     Remove the build directory (undo the make build step)
-unbuild:
-	-$(EXISTS) $(BUILD_BASE) $(RMRF) $(BUILD_BASE)
-
-# install:     Install a software home.
-install: build version_txt
-	$(PYTHON) "$(BASE_DIR)\setup.py" $(DISTUTILS_OPTS) install \
-	    --prefix="$(PREFIX)" $(BUILD_FLAGS) $(INSTALL_FLAGS)
-	@ echo.
-	@ echo Zope binaries installed successfully.
-	@ echo Now run '$(PYTHON) $(PREFIX)\bin\mkzopeinstance.py'
-
-
-$(BASE_DIR)/inst/tmp/$(PACKAGE_NAME).tgz:
-	$(MAKE) sdist
-	$(NOT_EXISTS) inst\tmp $(MKDIR) inst\tmp
-	$(MOVE) $(PACKAGE_NAME).tgz inst\tmp
-
-# installer:     Create the Zope Installer.
-installer: $(BASE_DIR)/inst/tmp/$(PACKAGE_NAME).tgz
-	$(CD) inst && sh Winbuilders/buildout zope ZOPEVERSION=$(ZOPEVERSION)
-
-# inplace:     Do an in-place build
-inplace:
-	$(MAKE) install PREFIX="$(BASE_DIR)"
-
-# test:        Do an inplace build and run the Zope test suite.
-test: inplace
-	$(PYTHON) "$(BASE_DIR)\test.py" $(TESTOPTS)
-
-# instance:    Do an inplace build and create an instance home in the resulting
-#              software home.
-instance: build
-	$(PYTHON) "$(BASE_DIR)\utilities\mkzopeinstance.py" $(MKZ_FLAGS)
-
-# testinst:    Perform an inplace build and create an instance home in the
-#              resulting software home without asking questions.  Useful when
-#              performing automated testing.
-testinst:
-	$(MAKE) instance MKZ_FLAGS=--user=admin:admin --dir="$(BASE_DIR)"
-
-# uninstance:  Remove the instance files made by testinstance (w/ prejudice)
-uninstance:
-	$(EXISTS) "$(BASE_DIR)/bin" $(RMRF) "$(BASE_DIR)/bin"
-	$(EXISTS) "$(BASE_DIR)/etc" $(RMRF) "$(BASE_DIR)/etc"
-	$(EXISTS) "$(BASE_DIR)/import" $(RMRF) "$(BASE_DIR)/import"
-	$(EXISTS) "$(BASE_DIR)/log" $(RMRF) "$(BASE_DIR)/log"
-	$(EXISTS) "$(BASE_DIR)/var" $(RMRF) "$(BASE_DIR)/var"
-	$(EXISTS) "$(BASE_DIR)/Products" $(RMRF) "$(BASE_DIR)/Products"
-
-# clean:       Delete the build files and any binaries/bytecode files in
-#              the source directory for good measure.
-clean:
-	$(CD) "$(BASE_DIR)"
-	-$(RM) /s *.pyc *.pyo *.dll *.o *.obj *.pyd
-	-$(EXISTS) "$(BASE_DIR)\lib\python\Zope2\version.txt" $(RM) "$(BASE_DIR)\lib\python\Zope2\version.txt"
-	-$(EXISTS) build $(RMRF) build
-
-# version_txt: create a version file in lib/python/Zope2/version.txt
-version_txt:
-	echo Zope $(MAJOR_VERSION).$(MINOR_VERSION)-$(RELEASE_TAG) > \
-          "$(BASE_DIR)/lib/python/Zope2/version.txt"
-
-# sdist:       Create a source distribution file (implies clobber).
-#
-sdist: clobber sdist_tgz
-
-# sdist_tgz:   Create a tgz archive file as a source distribution.
-#
-sdist_tgz: version_txt
-	$(PYTHON) $(BASE_DIR)\inst\tar.py $(BASE_DIR)\$(PACKAGE_NAME).tgz $(BASE_DIR)
-
-# clobber:     Make the source tree 'pristine' again.
-clobber: clean uninstance
-
-# distclean:     Make the source tree *really* 'pristine' again.
-distclean: clobber
-	$(EXISTS) makefile $(RM) makefile
-	$(EXISTS) Makefile $(RM) Makefile
-	$(EXISTS) build-base $(RMRF) build-base
-

Deleted: Zope/branches/tseaver-fix_wsgi/inst/compilezpy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/compilezpy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/compilezpy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,68 +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
-#
-##############################################################################
-
-import compileall, os, sys
-
-class Shutup:
-    def write(*args): pass # :)
-
-class NoteErr:
-    wrote = 0
-    def write(self, *args):
-        self.wrote = 1
-        apply(stderr.write, args)
-
-def compile_non_test(dir):
-    """Byte-compile all modules except those in test directories."""
-    success = compileall.compile_dir(dir, maxlevels=0)
-    try:
-        names = os.listdir(dir)
-    except os.error:
-        print "Can't list", dir
-        names = []
-    names.sort()
-    for name in names:
-        fullname = os.path.join(dir, name)
-        if (name != os.curdir and name != os.pardir and
-            os.path.isdir(fullname) and not os.path.islink(fullname) and
-            name != 'test' and name != 'tests' and name != 'skins'):
-            success = success and compile_non_test(fullname)
-    return success
-
-print
-print '-'*78
-print 'Compiling python modules'
-stdout = sys.stdout
-stderr = sys.stderr
-try:
-    try:
-        success = 0
-        sys.stdout = Shutup()
-        sys.stderr = NoteErr()
-        success = compile_non_test(os.getcwd())
-    finally:
-        success = success and not sys.stderr.wrote
-        sys.stdout = stdout
-        sys.stderr = stderr
-except:
-    success = 0
-    import traceback
-    traceback.print_exc()
-
-if not success:
-    print
-    print '!' * 78
-    print 'There were errors during Python module compilation.'
-    print '!' * 78
-    print
-    sys.exit(1)

Deleted: Zope/branches/tseaver-fix_wsgi/inst/configure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/configure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/configure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,238 +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
-#
-##############################################################################
-"""
-Create a Makefile for building and installing Zope.
-"""
-import getopt
-import os
-import sys
-import versions
-import tempfile
-
-QUIET=0
-
-if sys.platform == 'win32':
-    PREFIX = 'c:\\Zope-' + versions.ZOPE_MAJOR_VERSION
-    IN_MAKEFILE = 'Makefile.win.in'
-    MAKE_COMMAND='the Visual C++ batch file "VCVARS32.bat" and then "nmake"'
-else:
-    PREFIX = '/opt/Zope-' + versions.ZOPE_MAJOR_VERSION
-    IN_MAKEFILE = 'Makefile.in'
-    MAKE_COMMAND='make'
-
-def main():
-    # below assumes this script is in the BASE_DIR/inst directory
-    global PREFIX
-    BASE_DIR=os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0])))
-    BUILD_BASE=os.path.join(os.getcwd(), 'build-base',
-                            'python-%s.%s' % sys.version_info[:2])
-    PYTHON=sys.executable
-    TMP_DIR = tempfile.gettempdir()
-    MAKEFILE=open(os.path.join(BASE_DIR, 'inst', IN_MAKEFILE)).read()
-    REQUIRE_LF_ENABLED = 1
-    REQUIRE_ZLIB = 1
-    REQUIRE_EXPAT = 1 
-    INSTALL_FLAGS = ''
-    DISTUTILS_OPTS = ''
-    try:
-        longopts = ['help', 'ignore-largefile', 'ignore-zlib',
-                    'ignore-expat', 'prefix=',
-                    'build-base=', 'optimize', 'no-compile', 'quiet']
-        opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
-    except getopt.GetoptError, v:
-        print v
-        usage()
-        sys.exit(1)
-    for o, a in opts:
-        if o in ('-h', '--help'):
-            usage()
-            sys.exit()
-        if o == '--prefix':
-            PREFIX=os.path.abspath(os.path.expanduser(a))
-        if o == '--ignore-largefile':
-            REQUIRE_LF_ENABLED=0
-        if o == '--ignore-zlib':
-            REQUIRE_ZLIB=0
-        if o == '--ignore-expat':
-            REQUIRE_EXPAT=0
-        if o == '--optimize':
-            INSTALL_FLAGS = '--optimize=1 --no-compile'
-        if o == '--no-compile':
-            INSTALL_FLAGS = '--no-compile'
-        if o == '--build-base':
-            BUILD_BASE = a
-        if o == '--quiet':
-            DISTUTILS_OPTS = '-q'
-            global QUIET
-            QUIET = 1
-    if REQUIRE_LF_ENABLED:
-        test_largefile()
-    if REQUIRE_ZLIB:
-        test_zlib()
-    if REQUIRE_EXPAT:
-        test_expat()
-    out('  - Zope top-level binary directory will be %s.' % PREFIX)
-    if INSTALL_FLAGS:
-        out('  - Distutils install flags will be "%s"' % INSTALL_FLAGS)
-    idata = {
-        '<<PYTHON>>':PYTHON,
-        '<<PREFIX>>':PREFIX,
-        '<<BASE_DIR>>':BASE_DIR,
-        '<<BUILD_BASE>>':BUILD_BASE,
-        '<<TMP_DIR>>':TMP_DIR,
-        '<<INSTALL_FLAGS>>':INSTALL_FLAGS,
-        '<<ZOPE_MAJOR_VERSION>>':versions.ZOPE_MAJOR_VERSION,
-        '<<ZOPE_MINOR_VERSION>>':versions.ZOPE_MINOR_VERSION,
-        '<<VERSION_RELEASE_TAG>>':versions.VERSION_RELEASE_TAG,
-        '<<DISTUTILS_OPTS>>':DISTUTILS_OPTS,
-        }
-    for k,v in idata.items():
-        MAKEFILE = MAKEFILE.replace(k, v)
-    f = open(os.path.join(os.getcwd(), 'makefile'), 'w')
-    f.write(MAKEFILE)
-    out('  - Makefile written.')
-    out('')
-    out('  Next, run %s.' % MAKE_COMMAND)
-    out('')
-
-def usage():
-    usage = ("""
-%(program)s configures and writes a Makefile for Zope.
-
-Defaults for options are specified in brackets.
-
-Configuration:
-
-  -h, --help                    display this help and exit
-
-Options:
-
-  --quiet                       suppress nonessential output
-
-  --ignore-zlib                 allow configuration to proceeed if
-                                Python zlib module is not found.
-
-  --ignore-largefile            allow configuration to proceed without
-                                Python large file support.
-
-  --ignore-expat                allow configuration to proceed if the expat
-                                XML parsing module is not found.
-
-  --optimize                    compile Python files as .pyo files
-                                instead of as .pyc files
-
-  --no-compile                  don't compile Python files
-
-Directories:
-
-  --build-base=DIR              use DIR to store temporary build files
-
-  --prefix=DIR                  install Zope files in DIR [%(PREFIX)s]
-
-By default, 'make install' will install Zope software files in
-'%(PREFIX)s'  You can specify an alternate location for these
-files by using '--prefix', for example: '--prefix=$HOME/zope'.
-""" % ({'program':sys.argv[0], 'PREFIX':PREFIX})
-             )
-    print usage
-
-def test_expat():
-    try:
-        import xml.parsers.expat
-    except ImportError:
-        print (
-            """
-The Python interpreter you are using does not appear to have the 'pyexpat'
-library module installed.  For many Zope features to work properly, including
-Zope Page Templates, you must install a Python interpreter which includes the
-pyexpat module, or install the pyexpat library into your Python interpreter
-manually.  The file which represents the library is named 'pyexpat.so' (UNIX)
-or 'pyexpat.dll' (Windows) and is typically located in the 'lib-dynload'
-directory of your Python's library directory.  Some Python packagers ship the
-pyexpat module as a separate installable binary. If you are using a
-system-provided Python installation, you may want to look for a 'python-xml'
-or 'python-pyexpat' package (or something like it) and install it to make the
-pyexpat module available to Zope.  If you've compiled your Python interpreter
-from source, you may need to recompile and reinstall it after installing James
-Clark's expat libraries and development packages (look for libexpat.so and
-expat.h). Typically, these come as part of your operating system's libexpat
-and libexpat-dev packages, respectively.
-
-Run the configure script with the --ignore-expat option to prevent this
-warning with the understanding that some Zope features may not work properly
-until you've installed the pyexpat module.
-"""
-            )
-        sys.exit(1)
-        
-
-def test_zlib():
-    try:
-        import zlib
-    except ImportError:
-        print (
-            """
-The Python interpreter you are using does not appear to have the 'zlib'
-library module installed.  For Zope to be able to run, you must install a
-Python interpreter which includes the zlib module, or install the zlib library
-into your Python interpreter manually.  The file which represents the library
-is named 'zlib.so' (UNIX) or 'zlib.dll' (Windows) and is typically located in
-the 'lib-dynload' directory of your Python's library directory.  Some
-Python packagers ship the zlib module as a separate installable binary. If you
-are using a system-provided Python installation, you may want to look for
-a 'python-zlib' package (or something like it) and install it to make the
-Python zlib module available to Zope.
-
-Run the configure script with the --ignore-zlib option to prevent this
-warning with the understanding that Zope will not start properly until
-you've installed the zlib module.
-"""
-            )
-        sys.exit(1)
-    except:
-        print 'An error occurred while trying to import zlib!'
-        import traceback; traceback.print_exc()
-        sys.exit(1)
-
-def test_largefile():
-    OK=0
-    f = open(sys.argv[0], 'r')
-    try:
-        # 2**31 == 2147483648
-        f.seek(2147483649L)
-        f.close()
-        OK=1
-    except (IOError, OverflowError):
-        f.close()
-    if OK:
-        return
-    print (
-        """
-This Python interpreter does not have 'large file support' enabled. Large
-file support is required to allow the default Zope ZODB database to grow
-larger than 2GB on most platforms.  Either install a Python interpreter with
-large file support (see
-http://www.python.org/doc/current/lib/posix-large-files.html) or run this
-program again with the --ignore-largefile option to prevent this warning,
-with the understanding that your Zope may fail if the ZODB database
-size ever exceeds 2GB.
-"""
-        )
-    sys.exit(1)
-
-def out(s):
-    if not QUIET:
-        print s
-    
-if __name__ == '__main__':
-    main()

Deleted: Zope/branches/tseaver-fix_wsgi/inst/file_from_infile.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/file_from_infile.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/file_from_infile.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,90 +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
-#
-##############################################################################
-"""
-Reads a file named by 'src', performs textual replacements on the
-file based on sed-style markup, and writes the result to the file named
-by 'dst' unless 'dst' already exists.
-"""
-import getopt, os, sys
-from os.path import abspath, split, dirname
-import shutil
-import versions
-
-default_map = {
-    'PYTHON'              : sys.executable,
-    'BASE_DIR'            : abspath(split(dirname(sys.argv[0]))[0]),
-    'ZOPE_MAJOR_VERSION'  : versions.ZOPE_MAJOR_VERSION,
-    'ZOPE_MINOR_VERSION'  : versions.ZOPE_MINOR_VERSION,
-    'ZOPE_BRANCH_NAME'    : versions.ZOPE_BRANCH_NAME,
-    'VERSION_RELEASE_TAG' : versions.VERSION_RELEASE_TAG,
-    }
-
-def main(source, dest, map, force):
-    if not force and os.path.exists(dest):
-        print '%s exists, so I left it alone' % dest
-    else:
-        txt = open(source, 'rb').read()
-        for k, v in map.items():
-            txt = txt.replace('<<%s>>' % k, v)
-        outfile = open(dest, 'wb')
-        outfile.write(txt)
-        outfile.close()
-        shutil.copystat(source, dest)
-        print "Wrote %s from %s" % (dest, source)
-
-def usage():
-    print "%s [opts] src dst" % sys.argv[0]
-    print
-    print "Reads a file named by 'src', performs textual replacements on "
-    print "the file based on sed-style markup embedded in the infile, and "
-    print "and writes the result to the file named by 'dst' unless 'dst'."
-    print "already exists.  The generated file will have the same permissions"
-    print "and other mode bit settings as the source file."
-    print
-    print "Options:"
-    print
-    print "  --force      Force replacement of dst even if it already exists."
-    for name, value in default_map.items():
-        print ("  --%s=value     controls text replacement, default '%s'"
-               % (name, value))
-
-if __name__ == '__main__':
-    if len(sys.argv) < 3:
-        usage()
-        sys.exit(127)
-    map = default_map.copy()
-    force = 0
-    try:
-        longopts = ['help', 'force']
-        for name in default_map.keys():
-            longopts.append('%s=' % name)
-        opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
-    except getopt.GetoptError, v:
-        print v
-        usage()
-        sys.exit(1)
-    try:
-        source, dest = args
-    except:
-        usage()
-        sys.exit(1)
-    for o, a in opts:
-        if o in ('-h', '--help'):
-            usage()
-            sys.exit()
-        if o == '--force':
-            force = 1
-        if o in map.keys():
-            map[o] = a
-    main(source, dest, map, force)
-

Deleted: Zope/branches/tseaver-fix_wsgi/inst/generate_index.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/generate_index.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/generate_index.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,63 +0,0 @@
-"""
-Generate an index file based on the version.cfg file of Zope 2
-in order to provide a version specific index page generated to be used
-in combination with easy_install -i <some_url>
-"""
-
-import os
-import sys
-import urlparse
-from xmlrpclib import Server
-from ConfigParser import RawConfigParser as ConfigParser
-
-# packages containing upper-case letters
-upper_names = ('ClientForm', 'RestrictedPython', 'ZConfig', 'ZODB3', 'zLOG', 
-               'Acquisition', 'DateTime', 'ExtensionClass', 'Persistence')
-
-def write_index(package, version):
-    print >>sys.stderr, 'Package %s==%s' % (package, version)
-    dest_dir = os.path.join(dirname, package)
-    if not os.path.exists(dest_dir):
-        os.makedirs(dest_dir)
-    index_html = os.path.join(dest_dir, 'index.html')
-
-    fp = file(index_html, 'w')
-    print >>fp, '<html><body>'
-    lst = server.package_urls(package, version)
-    if lst:
-        # package hosted on PyPI
-        for d in lst:
-            link = '<a href="%s">%s</a>' % (d['url'], d['filename'])
-            print >>fp, link
-            print >>fp, '<br/>'
-    else:
-        # for externally hosted packages we need to rely on the 
-        # download_url metadata
-        rel_data = server.release_data(package, version)
-        download_url = rel_data['download_url']
-        filename = os.path.basename(urlparse.urlparse(download_url)[2])
-        link = '<a href="%s">%s</a>' % (download_url, filename)
-        print >>fp, link
-
-    print >>fp, '</body></html>'
-    fp.close()
-
-CP = ConfigParser()
-CP.read(['versions.cfg'])
-
-server = Server('http://pypi.python.org/pypi')
-links = list()
-dirname = sys.argv[1]
-
-write_index('Zope2', '2.12.0a3')
-
-for package in CP.options('versions'):
-
-    # options() returns all options in lowercase but
-    # we must preserve the case for package names
-    for name in upper_names:
-        if name.lower() == package:
-            package = name
-            break
-    version = CP.get('versions', package)
-    write_index(package, version)

Deleted: Zope/branches/tseaver-fix_wsgi/inst/install.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/install.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/install.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,167 +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
-#
-##############################################################################
-"""
-Generic file and directory installer.
-
-Typically called when installing Zope via the Makefile written by
-'configure.py' in the 'make install' step.
-"""
-import getopt
-import os
-import re
-import shutil
-import stat
-import sys
-
-# RE that, if a pathname's base name matches, causes it to be ignored
-# when copying that file or directory.
-default_omitpattern = r'(\..*|CVS|.*~)$'
-
-def main(src, dst, dirmode=0755, fmode=0644,
-         omitpattern=default_omitpattern, retain_xbit=1):
-    """
-    Copy a file or directory named by src to a file or directory named by
-    dst, normalizing mode bit settings as necessary.  Recursively copies
-    directory trees using shutil.copy2().
-
-    Errors are reported to standard output.
-
-      - 'dirmode' is the directory creation mode.  All directories
-        are created with this mode.
-      - 'fmode' is the default file creation mode.  This mode
-        is modified by the status of the source file.  If the source
-        file is executable, mod the fmode to be +wgo executable.
-      - omitpattern is a Python-style regex pattern.  If a file
-        or directory name matches this pattern, it will never be copied.
-      - if the dst directory already exists, don't raise an error.
-    """
-    try:
-        if os.path.isdir(src):
-            copydir(src, dst, dirmode, fmode, omitpattern,
-                    retain_xbit)
-        else:
-            names = omit([src], omitpattern)
-            names and copyfile(names[0], dst, fmode, retain_xbit)
-
-    except (IOError, os.error), why:
-        print "Can't copy %s to %s: %s" % (`src`, `dst`, str(why))
-
-def copydir(src, dst, dirmode, fmode, omitpattern, retain_xbit):
-    names = omit(os.listdir(src), omitpattern)
-    try:
-        # always create directories with dirmode
-        os.makedirs(dst, dirmode)
-    except os.error, why:
-        if why[0] == 17:
-            # directory already exists
-            pass
-        else:
-            raise
-    for name in omit(names, omitpattern):
-        srcname = os.path.join(src, name)
-        dstname = os.path.join(dst, name)
-        if os.path.isdir(srcname):
-            copydir(srcname, dstname, dirmode,fmode,omitpattern,
-                    retain_xbit)
-        else:
-            copyfile(srcname, dstname, fmode, retain_xbit)
-
-def copylink(src, dst):
-    linkto = os.readlink(src)
-    os.symlink(linkto, dst)
-
-def copyfile(src, dst, mode, retain_xbit):
-    shutil.copy2(src, dst)
-    # change dest file mode to fmode but
-    # make +wgo executable if source file is executable
-    dstmode = mode
-    st = os.stat(src)
-    srcmode = st[stat.ST_MODE]
-    if retain_xbit and (srcmode & stat.S_IEXEC):
-        dstmode = (mode | 0111)
-    if os.path.isdir(dst):
-        # if dst is a directory, copy the file in to it
-        os.chmod(os.path.join(dst, os.path.split(src)[-1]), dstmode)
-    else:
-        os.chmod(dst, dstmode)
-
-omitcache = {}
-
-def omit(names, omitpattern):
-    return [ n for n in names
-             if not re.match(omitpattern, os.path.basename(n)) ]
-
-def usage():
-    print "%s [opts] source dest" % sys.argv[0]
-    print
-    print "Copies a file or directory specified by 'source' to 'dest'"
-    print "normalizing mode bit settings as necessary."
-    print
-    print "If src is a file and dst is a directory, the file will be"
-    print "copied into the dst directory.  However, if src is a directory"
-    print "and dst is a directory, the contents of src will be copied into"
-    print "dst."
-    print
-    print "opts: --dirmode=mode --fmode=mode --omitpattern=patt"
-    print
-    print "  --dontcopyxbit   when copying a file marked as executable,"
-    print "                   don't make the copy executable."
-    print "  --dirmode        mode bit settings of dest dirs (e.g. '755')"
-    print "  --fmode          mode bit settings of dest files (e.g. '644')"
-    print "                   (modified wgo+x when dontcopyxbit is not"
-    print "                   specified)"
-    print "  --omitpattern    a Python-style regex pattern.  File and"
-    print "                   directory names which match this pattern will "
-    print "                   not be copied.  The default omitpattern is"
-    print "                   '%s'" % default_omitpattern
-
-if __name__ == '__main__':
-    if len(sys.argv) < 3:
-        print "too few arguments"
-        usage()
-        sys.exit(2)
-    dirmode = 0755
-    fmode   = 0644
-    omitpattern = default_omitpattern
-    retain_xbit = 1
-    longopts = ['dirmode=', 'fmode=', 'omitpattern=', 'help',
-                'copyxmode' ]
-    try:
-        opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
-    except getopt.GetoptError, v:
-        print v
-        usage()
-        sys.exit(2)
-    try:
-        source, dest = args
-    except:
-        print "wrong number of arguments"
-        usage()
-        sys.exit(2)
-    for o, a in opts:
-        if o in ('-h', '--help'):
-            usage()
-            sys.exit()
-        if o == '--dirmode':
-            if not a.startswith('0'):
-                a = '0%s' % a
-            dirmode = eval(a)
-        if o == '--fmode':
-            if not a.startswith('0'):
-                a = '0%s' % a
-            fmode = eval(a)
-        if o == '--omitpattern':
-            omitpattern = a
-        if o == '--dontcopyxbit':
-            retain_xbit = 0
-    main(source, dest, dirmode, fmode, omitpattern, retain_xbit)

Deleted: Zope/branches/tseaver-fix_wsgi/inst/make_resource.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/make_resource.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/make_resource.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,41 +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
-#
-##############################################################################
-"""Build a PCGI resource file.
-
-You must be in the directory containing this script.
-"""
-
-import os
-from do import *
-
-def main(cwd=os.getcwd(), name='Zope', user='', group=''):
-    python=sys.executable
-    print '-'*78
-    print 'Writing the pcgi resource file (ie cgi script), %s' % name
-    cwd=os.environ.get('ZDIR',cwd)
-
-    open(name,'w').write('''#!%(cwd)s/pcgi/pcgi-wrapper
-PCGI_NAME=Zope
-PCGI_MODULE_PATH=%(cwd)s/lib/python/Zope
-PCGI_PUBLISHER=%(cwd)s/pcgi/pcgi_publisher.py
-PCGI_EXE=%(python)s
-PCGI_SOCKET_FILE=%(cwd)s/var/pcgi.soc
-PCGI_PID_FILE=%(cwd)s/var/pcgi.pid
-PCGI_ERROR_LOG=%(cwd)s/var/pcgi.log
-PCGI_DISPLAY_ERRORS=1
-BOBO_REALM=%(name)s
-BOBO_DEBUG_MODE=1
-INSTANCE_HOME=%(cwd)s
-''' % vars())
-
-    ch(name, user, group, 0755)

Deleted: Zope/branches/tseaver-fix_wsgi/inst/tar.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/tar.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/tar.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,74 +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
-#
-##############################################################################
-
-import os
-import sys
-import optparse
-import tarfile
-from distutils import filelist
-
-INCLUDES = tuple('.*'.split())
-EXCLUDES = tuple(r""".*.svn\\ .*CVS\\ .*.tgz
-                     .*makefile$ .*Makefile$
-                     .*inst\\tmp\\.* .*inst\\src\\.*
-                     .*build-base\\ .*build\\
-                     .*~ .*.#.*""".split())
-
-def collect(top_dir, includes=INCLUDES, excludes=EXCLUDES):
-    old_dir = os.getcwd()
-    os.chdir(top_dir)
-    try:
-        fl = filelist.FileList()
-        fl.findall()
-
-        for inc in includes:
-            fl.include_pattern(inc, is_regex=1)
-
-        for exc in excludes:
-            fl.exclude_pattern(exc, is_regex=1)
-
-        return fl.files
-    finally:
-        os.chdir(old_dir)
-
-def tar_it_up(dest, files):
-    tar = tarfile.open(dest, mode='w:gz')
-    basename = os.path.splitext(os.path.basename(dest))[0]
-    for fname in files:
-        tar.add(fname, os.path.join(basename, fname), recursive=False)
-    tar.close()
-
-def main(options, args):
-    dest, top_dir = args
-    includes = options.include
-    excludes = options.exclude
-    excludes.append('.*%s.*' % os.path.basename(dest))
-
-    files = collect(top_dir, includes=includes, excludes=excludes)
-    tar_it_up(dest, files)
-
-if __name__ == '__main__':
-    excludes = list(EXCLUDES)
-    includes = list(INCLUDES)
-
-    parser = optparse.OptionParser()
-    parser.add_option('', '--exclude', action='append', default=excludes)
-    parser.add_option('', '--include', action='append', default=includes)
-
-    options, args = parser.parse_args()
-
-    if not len(args) == 2:
-        parser.print_help()
-        parser.exit(status=1)
-
-    main(options, args)

Deleted: Zope/branches/tseaver-fix_wsgi/inst/versions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/versions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/versions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +0,0 @@
-ZOPE_MAJOR_VERSION  = '2.12'
-ZOPE_MINOR_VERSION  = '1'
-ZOPE_BRANCH_NAME    = '$Name$'[6:] or 'no-branch'
-
-# always start prerelease branches with '0' to avoid upgrade
-# issues in RPMs
-VERSION_RELEASE_TAG = 'final'

Deleted: Zope/branches/tseaver-fix_wsgi/inst/walkandscrub.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/inst/walkandscrub.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/inst/walkandscrub.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,47 +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
-#
-##############################################################################
-
-import os, sys
-DEBUG = 0
-if os.name in ('posix', 'nt', 'dos'):
-    EXCLUDED_NAMES=['..', '.']
-else:
-    EXCLUDED_NAMES=[]
-
-# extend EXCLUDED_NAMES here manually with filenames ala "asyncore.pyc" for
-# files that are only distributed in compiled format (.pyc, .pyo)
-# if necessary (not currently necessary in 2.3.1 AFAIK) - chrism
-
-def walkandscrub(path):
-    path = os.path.expandvars(os.path.expanduser(path))
-    print
-    print '-'*78
-    sys.stdout.write(
-        "Deleting '.pyc' and '.pyo' files recursively under %s...\n" % path
-        )
-    os.path.walk(path, scrub, [])
-    sys.stdout.write('Done.\n')
-
-def scrub(list, dirname, filelist):
-    for name in filelist:
-        if name in EXCLUDED_NAMES:
-            continue
-        prefix, ext = os.path.splitext(name)
-        if ext == '.pyo' or ext == '.pyc':
-            full = os.path.join(dirname, name)
-            os.unlink(full)
-            if DEBUG: print full
-
-if __name__ == '__main__':
-    DEBUG = 1
-    walkandscrub(os.getcwd())

Modified: Zope/branches/tseaver-fix_wsgi/setup.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/setup.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/setup.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,19 +11,16 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""Setup for the Acquisition egg package
-"""
+
 import os
 from setuptools import setup, find_packages, Extension
 
-EXTENSIONCLASS_INCLUDEDIRS = ['include', 'src']
-
-params = dict(name='Zope2',
-    version='2.12.2-dev',
+setup(name='Zope2',
+    version='2.12.7dev',
     url='http://www.zope.org',
     license='ZPL 2.1',
     description='Zope2 application server / web framework',
-    author='Zope Corporation and Contributors',
+    author='Zope Foundation and Contributors',
     author_email='zope-dev at zope.org',
     long_description=file("README.txt").read() + "\n" +
                      file(os.path.join("doc", "CHANGES.rst")).read(),
@@ -37,44 +34,18 @@
       # AccessControl
       Extension(
             name='AccessControl.cAccessControl',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
+            include_dirs=['include', 'src'],
             sources=['src/AccessControl/cAccessControl.c'],
             depends=['include/ExtensionClass/ExtensionClass.h',
-                     'include/ExtensionClass/pickle/pickle.c',
                      'include/Acquisition/Acquisition.h']),
 
       # DocumentTemplate
       Extension(
             name='DocumentTemplate.cDocumentTemplate',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
-            sources=['src/DocumentTemplate/cDocumentTemplate.c']),
+            include_dirs=['include', 'src'],
+            sources=['src/DocumentTemplate/cDocumentTemplate.c'],
+            depends=['include/ExtensionClass/ExtensionClass.h']),
 
-      Extension(
-            name='MultiMapping._MultiMapping',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
-            sources=["src/MultiMapping/_MultiMapping.c"],
-            depends=["include/ExtensionClass/ExtensionClass.h"]),
-      Extension(
-            name='ThreadLock._ThreadLock',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
-            sources=["src/ThreadLock/_ThreadLock.c"],
-            depends=["include/ExtensionClass/ExtensionClass.h"]),
-      Extension(
-            name='Missing._Missing',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
-            sources=["src/Missing/_Missing.c"],
-            depends=["include/ExtensionClass/ExtensionClass.h"]),
-      Extension(
-            name='Record._Record',
-            include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
-            sources=["src/Record/_Record.c"],
-            depends=["include/ExtensionClass/ExtensionClass.h"]),
-
-      # initgroups
-      Extension(
-            name='initgroups._initgroups',
-            sources=['src/initgroups/_initgroups.c']),
-
       # indexes
       Extension(
             name='Products.ZCTextIndex.stopper',
@@ -89,11 +60,18 @@
       'Acquisition',
       'DateTime',
       'ExtensionClass',
+      'Missing',
+      'MultiMapping',
       'Persistence',
+      'Record',
       'RestrictedPython',
+      'ThreadLock',
       'ZConfig',
       'ZODB3',
+      'ZopeUndo',
       'docutils',
+      'five.formlib',
+      'initgroups',
       'pytz',
       'setuptools',
       'tempstorage',
@@ -108,19 +86,19 @@
       'zope.deferredimport',
       'zope.event',
       'zope.exceptions',
-      'zope.formlib',
       'zope.i18n [zcml]',
       'zope.i18nmessageid',
       'zope.interface',
       'zope.lifecycleevent',
       'zope.location',
+      'zope.mkzeoinstance',
       'zope.pagetemplate',
       'zope.processlifetime',
       'zope.proxy',
       'zope.publisher',
       'zope.schema',
       'zope.security',
-      'zope.sendmail',
+      'zope.sendmail<3.7.0',
       'zope.sequencesort',
       'zope.site',
       'zope.size',
@@ -131,7 +109,6 @@
       'zope.testing',
       'zope.traversing',
       'zope.viewlet',
-      'zope.app.form',
       'zope.app.publication',
       'zope.app.publisher',
       'zope.app.schema',
@@ -140,14 +117,12 @@
     include_package_data=True,
     zip_safe=False,
     entry_points={
-       'console_scripts' : [
-          'mkzeoinstance=Zope2.utilities.mkzeoinstance:main',
+       'console_scripts': [
+          'mkzeoinstance=zope.mkzeoinstance:main',
           'mkzopeinstance=Zope2.utilities.mkzopeinstance:main',
           'runzope=Zope2.Startup.run:run',
           'zopectl=Zope2.Startup.zopectl:run',
           'zpasswd=Zope2.utilities.zpasswd:main',
-      ]
+      ],
     },
 )
-
-setup(**params)

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/AuthEncoding.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/AuthEncoding.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/AuthEncoding.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/DTML.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/DTML.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/DTML.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplC.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplC.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplC.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplPython.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplPython.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/ImplPython.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/Implementation.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/Implementation.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/Implementation.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/Owned.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/Owned.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/Owned.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -157,23 +157,21 @@
         If 'recursive' is true then also take ownership of all sub-objects,
         otherwise sub-objects retain their ownership information.
         """
-
-        new=ownerInfo(user)
-        if new is None: return # Special user!
+        new = ownerInfo(user)
+        if new is None: 
+            return # Special user!
         old = self.getOwnerTuple()
+
         if not recursive:
-            if old==new: return
-            if old is UnownableOwner: return
+            if old == new or old is UnownableOwner:
+                return
 
-        for child in self.objectValues():
-            if recursive:
+        if recursive:
+            for child in self.objectValues():
                 child.changeOwnership(user, 1)
-            else:
-                # make ownership explicit
-                child._owner=new
 
         if old is not UnownableOwner:
-            self._owner=new
+            self._owner = new
 
     def userCanTakeOwnership(self):
         security=getSecurityManager()

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permission.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permission.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permission.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionMapping.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionMapping.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionMapping.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionRole.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionRole.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/PermissionRole.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permissions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permissions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/Permissions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/Role.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/Role.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/Role.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityInfo.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityInfo.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityInfo.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManagement.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManagement.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManagement.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/SecurityManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/SimpleObjectPolicies.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/SimpleObjectPolicies.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/SimpleObjectPolicies.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/SpecialUsers.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/SpecialUsers.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/SpecialUsers.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/User.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/User.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/User.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -400,6 +400,9 @@
     def has_permission(self, permission, object):
         return 0
 
+    def __str__(self):
+        # See https://bugs.launchpad.net/zope2/+bug/142563
+        return repr(self)
 
 
 def readUserAccessFile(filename):

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeGuards.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeGuards.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeGuards.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 #############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeSecurityPolicy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeSecurityPolicy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/ZopeSecurityPolicy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/cAccessControl.c
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/cAccessControl.c	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/cAccessControl.c	2010-05-28 20:11:49 UTC (rev 112816)
@@ -3,7 +3,7 @@
 **
 **	Access control acceleration routines
 
-  Copyright (c) 2001, Digital Creations, Fredericksburg, VA, USA.  
+  Copyright (c) 2001, Zope Foundation and Contributors.  
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/requestmethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/requestmethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/requestmethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 #############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/ResultObject.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/ResultObject.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/ResultObject.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/SecurityBase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/SecurityBase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/SecurityBase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/framework.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/framework.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/framework.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/regressionSecurity.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/regressionSecurity.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/securitySuite/regressionSecurity.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testAcquisition.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testAcquisition.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testAcquisition.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testBindings.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testBindings.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testBindings.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testChownRecursive.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testChownRecursive.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testChownRecursive.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,7 @@
 # vim: ts=4 expandtab :
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testClassSecurityInfo.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testClassSecurityInfo.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testClassSecurityInfo.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testDeprecatedAPI.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testDeprecatedAPI.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testDeprecatedAPI.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testImplementation.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testImplementation.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testImplementation.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testModuleSecurity.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testModuleSecurity.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testModuleSecurity.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2008 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2008 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testOwned.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testOwned.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testOwned.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -177,8 +177,93 @@
         self.assertEqual(wrapped_owner.getId(), 'user')
 
 
+class OwnershipChangeTests(unittest.TestCase):
+
+    def setUp(self):
+        from AccessControl.Owned import UnownableOwner
+        from AccessControl.User import UserFolder
+        from OFS.Folder import Folder
+        super(OwnershipChangeTests, self).setUp()
+
+        self.root = FauxRoot()
+        self.root.acl_users = UserFolder()
+
+        self.uf = self.root.acl_users
+        self.uf._doAddUser('user1', 'xxx', ['role1'], [])
+        self.uf._doAddUser('user2', 'xxx', ['role1'], [])
+
+        self.root.unownable = Folder('unownable')
+        self.root.unownable._owner = UnownableOwner
+
+        self.root.parent = Folder('parent')
+        parent = self.root.parent
+        parent._owner = (['acl_users'], 'user1')
+        parent._setObject('child', Folder('child'))
+        parent.child._owner = (['acl_users'], 'user1')
+        parent.child._setObject('grandchild', Folder('grandchild'))
+        parent.child.grandchild._owner = (['acl_users'], 'user1')
+
+    def test_changeOwnership_bad_owner(self):
+        from AccessControl.User import nobody
+        previous = self.root.parent._owner
+
+        self.root.parent.changeOwnership(nobody)
+        self.assertEquals(self.root.parent._owner, previous)
+
+    def test_changeOwnership_same_owner(self):
+        previous = self.root.parent._owner
+        sameuser = self.uf.getUser('user1').__of__(self.uf)
+
+        self.root.parent.changeOwnership(sameuser)
+        self.assertEquals(self.root.parent._owner, previous)
+
+    def test_changeOwnership_unownable_owner(self):
+        previous = self.root.unownable._owner
+        newuser = self.uf.getUser('user1').__of__(self.uf)
+
+        self.root.unownable.changeOwnership(newuser)
+        self.assertEquals(self.root.unownable._owner, previous)
+
+    def test_changeOwnership_nonrecursive(self):
+        previous_parent_owner = self.root.parent._owner
+        previous_child_owner = self.root.parent.child._owner
+        previous_grandchild_owner = self.root.parent.child.grandchild._owner
+        newuser = self.uf.getUser('user2').__of__(self.uf)
+
+        self.root.parent.changeOwnership(newuser)
+        self.assertNotEquals(self.root.parent._owner, previous_parent_owner)
+        self.assertEquals(self.root.parent._owner, (['acl_users'], 'user2'))
+        self.assertEquals(self.root.parent.child._owner, previous_child_owner)
+        self.assertEquals( self.root.parent.child.grandchild._owner
+                         , previous_grandchild_owner
+                         )
+
+    def test_changeOwnership_recursive(self):
+        previous_parent_owner = self.root.parent._owner
+        previous_child_owner = self.root.parent.child._owner
+        previous_grandchild_owner = self.root.parent.child.grandchild._owner
+        newuser = self.uf.getUser('user2').__of__(self.uf)
+
+        self.root.parent.changeOwnership(newuser, recursive=True)
+        self.assertNotEquals(self.root.parent._owner, previous_parent_owner)
+        self.assertEquals(self.root.parent._owner, (['acl_users'], 'user2'))
+        self.assertNotEquals(self.root.parent.child._owner, previous_child_owner)
+        self.assertEquals( self.root.parent.child._owner
+                         , (['acl_users'], 'user2')
+                         )
+        self.assertNotEquals( self.root.parent.child.grandchild._owner
+                            , previous_grandchild_owner
+                            )
+        self.assertEquals( self.root.parent.child.grandchild._owner
+                         , (['acl_users'], 'user2')
+                         )
+
+
 def test_suite():
-    return unittest.makeSuite(OwnedTests)
+    return unittest.TestSuite((
+        unittest.makeSuite(OwnedTests),
+        unittest.makeSuite(OwnershipChangeTests),
+        ))
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPasswordDigest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPasswordDigest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPasswordDigest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPermissionRole.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPermissionRole.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testPermissionRole.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurity.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurity.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurity.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurityManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurityManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testSecurityManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Copied: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUser.py (from rev 112805, Zope/branches/2.12/src/AccessControl/tests/testUser.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUser.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,504 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Foundation and Contributors.
+#
+# 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 tests for AccessControl.User
+"""
+import unittest
+
+
+class BasicUserTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from AccessControl.User import BasicUser
+        return BasicUser
+
+    def _makeOne(self, name, password, roles, domains):
+        return self._getTargetClass()(name, password, roles, domains)
+
+    def _makeDerived(self, **kw):
+        class Derived(self._getTargetClass()):
+            def __init__(self, **kw):
+                self.name = 'name'
+                self.password = 'password'
+                self.roles = ['Manager']
+                self.domains = []
+                self.__dict__.update(kw)
+        return Derived(**kw)
+
+    def test_ctor_is_abstract(self):
+        # Subclasses must override __init__, and mustn't call the base version.
+        self.assertRaises(NotImplementedError,
+                          self._makeOne, 'name', 'password', ['Manager'], [])
+
+    def test_abstract_methods(self):
+        # Subclasses must override these methods.
+        derived = self._makeDerived()
+        self.assertRaises(NotImplementedError, derived.getUserName)
+        self.assertRaises(NotImplementedError, derived.getId)
+        self.assertRaises(NotImplementedError, derived._getPassword)
+        self.assertRaises(NotImplementedError, derived.getRoles)
+        self.assertRaises(NotImplementedError, derived.getDomains)
+
+    # TODO: def test_getRolesInContext (w/wo local, callable, aq)
+    # TODO: def test_authenticate (w/wo domains)
+    # TODO: def test_allowed (...)
+    # TODO: def test_has_role (w/wo str, context)
+    # TODO: def test_has_permission (w/wo str)
+
+    def test___len__(self):
+        derived = self._makeDerived()
+        self.assertEqual(len(derived), 1)
+
+    def test___str__(self):
+        derived = self._makeDerived(getUserName=lambda: 'phred')
+        self.assertEqual(str(derived), 'phred')
+
+    def test___repr__(self):
+        derived = self._makeDerived(getUserName=lambda: 'phred')
+        self.assertEqual(repr(derived), "<Derived 'phred'>")
+
+
+class SimpleUserTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from AccessControl.User import SimpleUser
+        return SimpleUser
+
+    def _makeOne(self, name='admin', password='123', roles=None, domains=None):
+        if roles is None:
+            roles = ['Manager']
+        if domains is None:
+            domains = []
+        return self._getTargetClass()(name, password, roles, domains)
+
+    def test_overrides(self):
+        simple = self._makeOne()
+        self.assertEqual(simple.getUserName(), 'admin')
+        self.assertEqual(simple.getId(), 'admin')
+        self.assertEqual(simple._getPassword(), '123')
+        self.assertEqual(simple.getDomains(), ())
+
+    def test_getRoles_anonymous(self):
+        simple = self._makeOne('Anonymous User', roles=())
+        self.assertEqual(simple.getRoles(), ())
+
+    def test_getRoles_non_anonymous(self):
+        simple = self._makeOne('phred', roles=())
+        self.assertEqual(simple.getRoles(), ('Authenticated',))
+
+    def test___repr__(self):
+        special = self._makeOne()
+        self.assertEqual(repr(special), "<SimpleUser 'admin'>")
+
+
+class SpecialUserTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from AccessControl.User import SpecialUser
+        return SpecialUser
+
+    def _makeOne(self, name='admin', password='123', roles=None, domains=None):
+        if roles is None:
+            roles = ['Manager']
+        if domains is None:
+            domains = []
+        return self._getTargetClass()(name, password, roles, domains)
+
+    def test_overrides(self):
+        special = self._makeOne()
+        self.assertEqual(special.getUserName(), 'admin')
+        self.assertEqual(special.getId(), None)
+        self.assertEqual(special._getPassword(), '123')
+        self.assertEqual(special.getDomains(), ())
+
+    def test___repr__(self):
+        special = self._makeOne()
+        self.assertEqual(repr(special), "<SpecialUser 'admin'>")
+
+
+class UnrestrictedUserTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from AccessControl.User import UnrestrictedUser
+        return UnrestrictedUser
+
+    def _makeOne(self, name='admin', password='123', roles=None, domains=None):
+        if roles is None:
+            roles = ['Manager']
+        if domains is None:
+            domains = []
+        return self._getTargetClass()(name, password, roles, domains)
+
+    def test_allowed__what_not_even_god_should_do(self):
+        from AccessControl.PermissionRole import _what_not_even_god_should_do
+        unrestricted = self._makeOne()
+        self.failIf(unrestricted.allowed(self, _what_not_even_god_should_do))
+
+    def test_allowed_empty(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.allowed(self, ()))
+
+    def test_allowed_other(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.allowed(self, ('Manager',)))
+
+    def test_has_role_empty_no_object(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.has_role(()))
+
+    def test_has_role_empty_w_object(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.has_role((), self))
+
+    def test_has_role_other_no_object(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.has_role(('Manager',)))
+
+    def test_has_role_other_w_object(self):
+        unrestricted = self._makeOne()
+        self.failUnless(unrestricted.has_role(('Manager',), self))
+
+    def test___repr__(self):
+        unrestricted = self._makeOne()
+        self.assertEqual(repr(unrestricted),
+                         "<UnrestrictedUser 'admin'>")
+
+
+class NullUnrestrictedUserTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from AccessControl.User import NullUnrestrictedUser
+        return NullUnrestrictedUser
+
+    def _makeOne(self):
+        return self._getTargetClass()()
+
+    def test_overrides(self):
+        simple = self._makeOne()
+        self.assertEqual(simple.getUserName(), (None, None))
+        self.assertEqual(simple.getId(), None)
+        self.assertEqual(simple._getPassword(), (None, None))
+        self.assertEqual(simple.getRoles(), ())
+        self.assertEqual(simple.getDomains(), ())
+
+    def test_getRolesInContext(self):
+        null = self._makeOne()
+        self.assertEqual(null.getRolesInContext(self), ())
+
+    def test_authenticate(self):
+        null = self._makeOne()
+        self.failIf(null.authenticate('password', {}))
+
+    def test_allowed(self):
+        null = self._makeOne()
+        self.failIf(null.allowed(self, ()))
+
+    def test_has_role(self):
+        null = self._makeOne()
+        self.failIf(null.has_role('Authenticated'))
+
+    def test_has_role_w_object(self):
+        null = self._makeOne()
+        self.failIf(null.has_role('Authenticated', self))
+
+    def test_has_permission(self):
+        null = self._makeOne()
+        self.failIf(null.has_permission('View', self))
+
+    def test___repr__(self):
+        null = self._makeOne()
+        self.assertEqual(repr(null), "<NullUnrestrictedUser (None, None)>")
+
+    def test___str__(self):
+        # See https://bugs.launchpad.net/zope2/+bug/142563
+        null = self._makeOne()
+        self.assertEqual(str(null), "<NullUnrestrictedUser (None, None)>")
+
+
+# TODO class Test_readUserAccessFile(unittest.TestCase)
+
+
+# TODO class BasicUserFoldertests(unittest.TestCase)
+
+
+class UserFolderTests(unittest.TestCase):
+
+    def setUp(self):
+        import transaction
+        transaction.begin()
+
+    def tearDown(self):
+        import transaction
+        from AccessControl.SecurityManagement import noSecurityManager
+        noSecurityManager()
+        transaction.abort()
+
+    def _getTargetClass(self):
+        from AccessControl.User import UserFolder
+        return UserFolder
+
+    def _makeOne(self, app=None):
+        if app is None:
+            app = self._makeApp()
+        uf = self._getTargetClass()().__of__(app)
+        uf._doAddUser('user1', 'secret', ['role1'], [])
+        return uf
+
+    def _makeApp(self):
+        from Testing.makerequest import makerequest
+        from Testing.ZopeTestCase import ZopeLite
+        app = makerequest(ZopeLite.app())
+        # Set up a user and role
+        app._addRole('role1')
+        app.manage_role('role1', ['View'])
+        # Set up a published object accessible to user
+        app.addDTMLMethod('doc', file='')
+        app.doc.manage_permission('View', ['role1'], acquire=0)
+        # Rig the REQUEST so it looks like we traversed to doc
+        app.REQUEST.set('PUBLISHED', app.doc)
+        app.REQUEST.set('PARENTS', [app])
+        app.REQUEST.steps = ['doc']
+        return app
+
+    def _makeBasicAuthToken(self, creds='user1:secret'):
+        import base64
+        return 'Basic %s' % base64.encodestring(creds)
+
+    def _login(self, uf, name):
+        from AccessControl.SecurityManagement import newSecurityManager
+        user = uf.getUserById(name)
+        user = user.__of__(uf)
+        newSecurityManager(None, user)
+
+    def test_class_conforms_to_IStandardUserFolder(self):
+        from AccessControl.interfaces import IStandardUserFolder
+        from zope.interface.verify import verifyClass
+        verifyClass(IStandardUserFolder, self._getTargetClass())
+
+    def testGetUser(self):
+        uf = self._makeOne()
+        self.failIfEqual(uf.getUser('user1'), None)
+
+    def testGetBadUser(self):
+        uf = self._makeOne()
+        self.assertEqual(uf.getUser('user2'), None)
+
+    def testGetUserById(self):
+        uf = self._makeOne()
+        self.failIfEqual(uf.getUserById('user1'), None)
+
+    def testGetBadUserById(self):
+        uf = self._makeOne()
+        self.assertEqual(uf.getUserById('user2'), None)
+
+    def testGetUsers(self):
+        uf = self._makeOne()
+        users = uf.getUsers()
+        self.failUnless(users)
+        self.assertEqual(users[0].getUserName(), 'user1')
+
+    def testGetUserNames(self):
+        uf = self._makeOne()
+        names = uf.getUserNames()
+        self.failUnless(names)
+        self.assertEqual(names[0], 'user1')
+
+    def testIdentify(self):
+        uf = self._makeOne()
+        name, password = uf.identify(self._makeBasicAuthToken())
+        self.assertEqual(name, 'user1')
+        self.assertEqual(password, 'secret')
+
+    def testGetRoles(self):
+        uf = self._makeOne()
+        user = uf.getUser('user1')
+        self.failUnless('role1' in user.getRoles())
+
+    def testGetRolesInContext(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        app.manage_addLocalRoles('user1', ['Owner'])
+        roles = user.getRolesInContext(app)
+        self.failUnless('role1' in roles)
+        self.failUnless('Owner' in roles)
+
+    def testHasRole(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        self.failUnless(user.has_role('role1', app))
+
+    def testHasLocalRole(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        app.manage_addLocalRoles('user1', ['Owner'])
+        self.failUnless(user.has_role('Owner', app))
+
+    def testHasPermission(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        self.failUnless(user.has_permission('View', app))
+        app.manage_role('role1', ['Add Folders'])
+        self.failUnless(user.has_permission('Add Folders', app))
+
+    def testHasLocalRolePermission(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        app.manage_role('Owner', ['Add Folders'])
+        app.manage_addLocalRoles('user1', ['Owner'])
+        self.failUnless(user.has_permission('Add Folders', app))
+        
+    def testAuthenticate(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.getUser('user1')
+        self.failUnless(user.authenticate('secret', app.REQUEST))
+
+    def testValidate(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.validate(app.REQUEST, self._makeBasicAuthToken(),
+                           ['role1'])
+        self.failIfEqual(user, None)
+        self.assertEqual(user.getUserName(), 'user1')
+
+    def testNotValidateWithoutAuth(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.validate(app.REQUEST, '', ['role1'])
+        self.assertEqual(user, None)
+
+    def testValidateWithoutRoles(self):
+        # Note - calling uf.validate without specifying roles will cause
+        # the security machinery to determine the needed roles by looking
+        # at the object itself (or its container). I'm putting this note
+        # in to clarify because the original test expected failure but it
+        # really should have expected success, since the user and the
+        # object being checked both have the role 'role1', even though no
+        # roles are passed explicitly to the userfolder validate method.
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.validate(app.REQUEST, self._makeBasicAuthToken())
+        self.assertEqual(user.getUserName(), 'user1')
+
+    def testNotValidateWithEmptyRoles(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.validate(app.REQUEST, self._makeBasicAuthToken(), [])
+        self.assertEqual(user, None)
+
+    def testNotValidateWithWrongRoles(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        user = uf.validate(app.REQUEST, self._makeBasicAuthToken(),
+                           ['Manager'])
+        self.assertEqual(user, None)
+
+    def testAllowAccessToUser(self):
+        app = self._makeApp()
+        uf = self._makeOne(app)
+        self._login(uf, 'user1')
+        app.restrictedTraverse('doc')
+
+    def testDenyAccessToAnonymous(self):
+        from AccessControl import Unauthorized
+        app = self._makeApp()
+        self.assertRaises(Unauthorized, app.restrictedTraverse, 'doc')
+
+    def testMaxListUsers(self):
+        # create a folder-ish thing which contains a roleManager,
+        # then put an acl_users object into the folde-ish thing
+        from AccessControl.User import BasicUserFolder
+
+        class Folderish(BasicUserFolder):
+            def __init__(self, size, count):
+                self.maxlistusers = size
+                self.users = []
+                self.acl_users = self
+                self.__allow_groups__ = self
+                for i in xrange(count):
+                    self.users.append("Nobody")
+
+            def getUsers(self):
+                return self.users
+
+            def user_names(self):
+                return self.getUsers()
+
+
+        tinyFolderOver = Folderish(15, 20)
+        tinyFolderUnder = Folderish(15, 10)
+
+        assert tinyFolderOver.maxlistusers == 15
+        assert tinyFolderUnder.maxlistusers == 15
+        assert len(tinyFolderOver.user_names()) == 20
+        assert len(tinyFolderUnder.user_names()) == 10
+
+        try:
+            list = tinyFolderOver.get_valid_userids()
+            assert 0, "Did not raise overflow error"
+        except OverflowError:
+            pass
+
+        try:
+            list = tinyFolderUnder.get_valid_userids()
+            pass
+        except OverflowError:
+            assert 0, "Raised overflow error erroneously"
+
+    def test__doAddUser_with_not_yet_encrypted_passwords(self):
+        # See collector #1869 && #1926
+        from AccessControl.AuthEncoding import pw_validate
+
+        USER_ID = 'not_yet_encrypted'
+        PASSWORD = 'password'
+
+        uf = self._makeOne()
+        uf.encrypt_passwords = True
+        self.failIf(uf._isPasswordEncrypted(PASSWORD))
+
+        uf._doAddUser(USER_ID, PASSWORD, [], [])
+        user = uf.getUserById(USER_ID)
+        self.failUnless(uf._isPasswordEncrypted(user.__))
+        self.failUnless(pw_validate(user.__, PASSWORD))
+
+    def test__doAddUser_with_preencrypted_passwords(self):
+        # See collector #1869 && #1926
+        from AccessControl.AuthEncoding import pw_validate
+
+        USER_ID = 'already_encrypted'
+        PASSWORD = 'password'
+
+        uf = self._makeOne()
+        uf.encrypt_passwords = True
+        ENCRYPTED = uf._encryptPassword(PASSWORD)
+
+        uf._doAddUser(USER_ID, ENCRYPTED, [], [])
+        user = uf.getUserById(USER_ID)
+        self.assertEqual(user.__, ENCRYPTED)
+        self.failUnless(uf._isPasswordEncrypted(user.__))
+        self.failUnless(pw_validate(user.__, PASSWORD))
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(BasicUserTests))
+    suite.addTest(unittest.makeSuite(SimpleUserTests))
+    suite.addTest(unittest.makeSuite(SpecialUserTests))
+    suite.addTest(unittest.makeSuite(UnrestrictedUserTests))
+    suite.addTest(unittest.makeSuite(NullUnrestrictedUserTests))
+    suite.addTest(unittest.makeSuite(UserFolderTests))
+    return suite

Deleted: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUserFolder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUserFolder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testUserFolder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,301 +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.
-#
-##############################################################################
-"""User folder tests.
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-import os, sys, base64
-
-import transaction
-from Testing.makerequest import makerequest
-
-from AccessControl import Unauthorized
-from AccessControl.SecurityManagement import newSecurityManager
-from AccessControl.SecurityManagement import noSecurityManager
-from AccessControl.User import BasicUserFolder, UserFolder
-from AccessControl.User import User
-
-
-class UserFolderTests(unittest.TestCase):
-
-    def setUp(self):
-        transaction.begin()
-        self.app = makerequest(Zope2.app())
-        try:
-            # Set up a user and role
-            self.uf = UserFolder().__of__(self.app)    
-            self.uf._doAddUser('user1', 'secret', ['role1'], [])
-            self.app._addRole('role1')
-            self.app.manage_role('role1', ['View'])
-            # Set up a published object accessible to user
-            self.app.addDTMLMethod('doc', file='')
-            self.app.doc.manage_permission('View', ['role1'], acquire=0)
-            # Rig the REQUEST so it looks like we traversed to doc
-            self.app.REQUEST.set('PUBLISHED', self.app.doc)
-            self.app.REQUEST.set('PARENTS', [self.app])
-            self.app.REQUEST.steps = ['doc']
-            self.basic = 'Basic %s' % base64.encodestring('user1:secret')
-        except:
-            self.tearDown()
-            raise
-
-    def tearDown(self):
-        noSecurityManager()
-        transaction.abort()
-        self.app._p_jar.close()
-
-    def login(self, name):
-        user = self.uf.getUserById(name)
-        user = user.__of__(self.uf)
-        newSecurityManager(None, user)
-
-    def test_z3interfaces(self):
-        from AccessControl.interfaces import IStandardUserFolder
-        from AccessControl.User import UserFolder
-        from zope.interface.verify import verifyClass
-
-        verifyClass(IStandardUserFolder, UserFolder)
-
-    def testGetUser(self):
-        self.failIfEqual(self.uf.getUser('user1'), None)
-
-    def testGetBadUser(self):
-        self.assertEqual(self.uf.getUser('user2'), None)
-
-    def testGetUserById(self):
-        self.failIfEqual(self.uf.getUserById('user1'), None)
-
-    def testGetBadUserById(self):
-        self.assertEqual(self.uf.getUserById('user2'), None)
-
-    def testGetUsers(self):
-        users = self.uf.getUsers()
-        self.failUnless(users)
-        self.assertEqual(users[0].getUserName(), 'user1')
-
-    def testGetUserNames(self):
-        names = self.uf.getUserNames()
-        self.failUnless(names)
-        self.assertEqual(names[0], 'user1')
-
-    def testIdentify(self):
-        name, password = self.uf.identify(self.basic)
-        self.assertEqual(name, 'user1')
-        self.assertEqual(password, 'secret')
-
-    def testGetRoles(self):
-        user = self.uf.getUser('user1')
-        self.failUnless('role1' in user.getRoles())
-
-    def testGetRolesInContext(self):
-        user = self.uf.getUser('user1')
-        self.app.manage_addLocalRoles('user1', ['Owner'])
-        roles = user.getRolesInContext(self.app)
-        self.failUnless('role1' in roles)
-        self.failUnless('Owner' in roles)
-
-    def testHasRole(self):
-        user = self.uf.getUser('user1')
-        self.failUnless(user.has_role('role1', self.app))
-
-    def testHasLocalRole(self):
-        user = self.uf.getUser('user1')
-        self.app.manage_addLocalRoles('user1', ['Owner'])
-        self.failUnless(user.has_role('Owner', self.app))
-
-    def testHasPermission(self):
-        user = self.uf.getUser('user1')
-        self.failUnless(user.has_permission('View', self.app))
-        self.app.manage_role('role1', ['Add Folders'])
-        self.failUnless(user.has_permission('Add Folders', self.app))
-
-    def testHasLocalRolePermission(self):
-        user = self.uf.getUser('user1')
-        self.app.manage_role('Owner', ['Add Folders'])
-        self.app.manage_addLocalRoles('user1', ['Owner'])
-        self.failUnless(user.has_permission('Add Folders', self.app))
-        
-    def testAuthenticate(self):
-        user = self.uf.getUser('user1')
-        self.failUnless(user.authenticate('secret', self.app.REQUEST))
-
-    def testValidate(self):
-        user = self.uf.validate(self.app.REQUEST, self.basic, ['role1'])
-        self.failIfEqual(user, None)
-        self.assertEqual(user.getUserName(), 'user1')
-
-    def testNotValidateWithoutAuth(self):
-        user = self.uf.validate(self.app.REQUEST, '', ['role1'])
-        self.assertEqual(user, None)
-
-    def testValidateWithoutRoles(self):
-        # Note - calling uf.validate without specifying roles will cause
-        # the security machinery to determine the needed roles by looking
-        # at the object itself (or its container). I'm putting this note
-        # in to clarify because the original test expected failure but it
-        # really should have expected success, since the user and the
-        # object being checked both have the role 'role1', even though no
-        # roles are passed explicitly to the userfolder validate method.
-        user = self.uf.validate(self.app.REQUEST, self.basic)
-        self.assertEqual(user.getUserName(), 'user1')
-
-    def testNotValidateWithEmptyRoles(self):
-        user = self.uf.validate(self.app.REQUEST, self.basic, [])
-        self.assertEqual(user, None)
-
-    def testNotValidateWithWrongRoles(self):
-        user = self.uf.validate(self.app.REQUEST, self.basic, ['Manager'])
-        self.assertEqual(user, None)
-
-    def testAllowAccessToUser(self):
-        self.login('user1')
-        try:
-            self.app.restrictedTraverse('doc')
-        except Unauthorized:
-            self.fail('Unauthorized')
-
-    def testDenyAccessToAnonymous(self):
-        self.assertRaises(Unauthorized, self.app.restrictedTraverse, 'doc')
-
-    def testMaxListUsers(self):
-        # create a folder-ish thing which contains a roleManager,
-        # then put an acl_users object into the folde-ish thing
-
-        class Folderish(BasicUserFolder):
-            def __init__(self, size, count):
-                self.maxlistusers = size
-                self.users = []
-                self.acl_users = self
-                self.__allow_groups__ = self
-                for i in xrange(count):
-                    self.users.append("Nobody")
-
-            def getUsers(self):
-                return self.users
-
-            def user_names(self):
-                return self.getUsers()
-
-
-        tinyFolderOver = Folderish(15, 20)
-        tinyFolderUnder = Folderish(15, 10)
-
-        assert tinyFolderOver.maxlistusers == 15
-        assert tinyFolderUnder.maxlistusers == 15
-        assert len(tinyFolderOver.user_names()) == 20
-        assert len(tinyFolderUnder.user_names()) == 10
-
-        try:
-            list = tinyFolderOver.get_valid_userids()
-            assert 0, "Did not raise overflow error"
-        except OverflowError:
-            pass
-
-        try:
-            list = tinyFolderUnder.get_valid_userids()
-            pass
-        except OverflowError:
-            assert 0, "Raised overflow error erroneously"
-
-    def test__doAddUser_with_not_yet_encrypted_passwords(self):
-        # See collector #1869 && #1926
-        from AccessControl.AuthEncoding import pw_validate
-
-        USER_ID = 'not_yet_encrypted'
-        PASSWORD = 'password'
-
-        uf = UserFolder().__of__(self.app)    
-        uf.encrypt_passwords = True
-        self.failIf(uf._isPasswordEncrypted(PASSWORD))
-
-        uf._doAddUser(USER_ID, PASSWORD, [], [])
-        user = uf.getUserById(USER_ID)
-        self.failUnless(uf._isPasswordEncrypted(user.__))
-        self.failUnless(pw_validate(user.__, PASSWORD))
-
-    def test__doAddUser_with_preencrypted_passwords(self):
-        # See collector #1869 && #1926
-        from AccessControl.AuthEncoding import pw_validate
-
-        USER_ID = 'already_encrypted'
-        PASSWORD = 'password'
-
-        uf = UserFolder().__of__(self.app)    
-        uf.encrypt_passwords = True
-        ENCRYPTED = uf._encryptPassword(PASSWORD)
-
-        uf._doAddUser(USER_ID, ENCRYPTED, [], [])
-        user = uf.getUserById(USER_ID)
-        self.assertEqual(user.__, ENCRYPTED)
-        self.failUnless(uf._isPasswordEncrypted(user.__))
-        self.failUnless(pw_validate(user.__, PASSWORD))
-
-
-class UserTests(unittest.TestCase):
-
-    def testGetUserName(self):
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f.getUserName(), 'chris')
-        
-    def testGetUserId(self):
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f.getId(), 'chris')
-
-    def testBaseUserGetIdEqualGetName(self):
-        # this is true for the default user type, but will not
-        # always be true for extended user types going forward (post-2.6)
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f.getId(), f.getUserName())
-
-    def testGetPassword(self):
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f._getPassword(), '123')
-
-    def testGetRoles(self):
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f.getRoles(), ('Manager', 'Authenticated'))
-
-    def testGetDomains(self):
-        f = User('chris', '123', ['Manager'], [])
-        self.assertEqual(f.getDomains(), ())
-
-    def testRepr(self):
-        f = User('flo', '123', ['Manager'], [])
-        self.assertEqual(repr(f), "<User 'flo'>")
-
-    def testReprSpecial(self):
-        from AccessControl.User import NullUnrestrictedUser
-        from AccessControl.User import nobody
-        from AccessControl.User import system
-        # NullUnrestrictedUser is used when there is no emergency user
-        self.assertEqual(repr(NullUnrestrictedUser()),
-                         "<NullUnrestrictedUser (None, None)>")
-        self.assertEqual(repr(nobody),
-                         "<SpecialUser 'Anonymous User'>")
-        self.assertEqual(repr(system),
-                         "<UnrestrictedUser 'System Processes'>")
-
-def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(UserFolderTests))
-    suite.addTest(unittest.makeSuite(UserTests))
-    return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeGuards.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeGuards.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeGuards.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -17,13 +17,13 @@
 
 $Id$
 """
+import doctest
 import unittest
 
 import os
 import operator
 import sys
 
-from zope.testing import doctest
 import ZODB
 
 

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeSecurityPolicy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeSecurityPolicy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/testZopeSecurityPolicy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -574,7 +574,7 @@
     
     """
 
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
 
 def test_suite():
     suite = unittest.TestSuite()

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_requestmethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_requestmethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_requestmethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 #############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_safeiter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_safeiter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/tests/test_safeiter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/AccessControl/unauthorized.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/AccessControl/unauthorized.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/AccessControl/unauthorized.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/ApplicationManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/ApplicationManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/ApplicationManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/CacheManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/CacheManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/CacheManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Common.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Common.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Common.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/DavLockManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/DavLockManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/DavLockManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Dialogs.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Dialogs.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Dialogs.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Extensions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Extensions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Extensions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/FactoryDispatcher.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/FactoryDispatcher.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/FactoryDispatcher.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/FindHomes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/FindHomes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/FindHomes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Hotfixes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Hotfixes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Hotfixes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/ImageFile.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/ImageFile.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/ImageFile.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Management.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Management.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Management.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Permission.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Permission.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Permission.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/PersistentExtra.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/PersistentExtra.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/PersistentExtra.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Product.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Product.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Product.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/ProductContext.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/ProductContext.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/ProductContext.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/ProductRegistry.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/ProductRegistry.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/ProductRegistry.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/RefreshFuncs.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/RefreshFuncs.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/RefreshFuncs.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/Undo.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/Undo.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/Undo.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -15,7 +15,6 @@
 $Id$
 """
 
-from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
 from AccessControl import getSecurityManager
@@ -30,6 +29,7 @@
 from ZopeUndo.Prefix import Prefix
 from zope.interface import implements
 
+
 class UndoSupport(ExtensionClass.Base):
 
     implements(IUndoSupport)
@@ -37,8 +37,8 @@
     security = ClassSecurityInfo()
 
     manage_options=(
-        {'label':'Undo', 'action':'manage_UndoForm',
-         'help':('OFSP','Undo.stx')},
+        {'label': 'Undo', 'action': 'manage_UndoForm',
+         'help': ('OFSP', 'Undo.stx')},
         )
 
     security.declareProtected(undo_changes, 'manage_UndoForm')
@@ -47,20 +47,25 @@
         globals(),
         PrincipiaUndoBatchSize=20,
         first_transaction=0,
-        last_transaction=20
+        last_transaction=20,
         )
 
     def get_request_var_or_attr(self, name, default):
         if hasattr(self, 'REQUEST'):
             REQUEST=self.REQUEST
-            if REQUEST.has_key(name): return REQUEST[name]
-            if hasattr(self, name): v=getattr(self, name)
-            else: v=default
-            REQUEST[name]=v
+            if REQUEST.has_key(name):
+                return REQUEST[name]
+            if hasattr(self, name):
+                v = getattr(self, name)
+            else:
+                v = default
+            REQUEST[name] = v
             return v
         else:
-            if hasattr(self, name): v=getattr(self, name)
-            else: v=default
+            if hasattr(self, name):
+                v = getattr(self, name)
+            else:
+                v = default
             return v
 
     security.declareProtected(undo_changes, 'undoable_transactions')
@@ -69,58 +74,61 @@
                               PrincipiaUndoBatchSize=None):
 
         if first_transaction is None:
-            first_transaction=self.get_request_var_or_attr(
+            first_transaction = self.get_request_var_or_attr(
                 'first_transaction', 0)
 
         if PrincipiaUndoBatchSize is None:
-            PrincipiaUndoBatchSize=self.get_request_var_or_attr(
+            PrincipiaUndoBatchSize = self.get_request_var_or_attr(
                 'PrincipiaUndoBatchSize', 20)
 
         if last_transaction is None:
-            last_transaction=self.get_request_var_or_attr(
+            last_transaction = self.get_request_var_or_attr(
                 'last_transaction',
                 first_transaction+PrincipiaUndoBatchSize)
 
-        spec={}
+        spec = {}
 
         # A user is allowed to undo transactions that were initiated
         # by any member of a user folder in the place where the user
         # is defined.
         user = getSecurityManager().getUser()
-        if hasattr(user, 'aq_parent'):
-            path = '/'.join(user.aq_parent.getPhysicalPath()[1:-1])
+        user_parent = aq_parent(user)
+        if user_parent is not None:
+            path = '/'.join(user_parent.getPhysicalPath()[1:-1])
         else:
-            path=''
-        if path: spec['user_name']=Prefix(path)
+            path = ''
+        if path:
+            spec['user_name'] = Prefix(path)
 
         if getattr(aq_parent(aq_inner(self)), '_p_jar', None) == self._p_jar:
             # We only want to undo things done here (and not in mounted
             # databases)
-            opath='/'.join(self.getPhysicalPath())
+            opath = '/'.join(self.getPhysicalPath())
         else:
             # Special case: at the root of a database,
             # allow undo of any path.
             opath = None
-        if opath: spec['description']=Prefix(opath)
+        if opath:
+            spec['description'] = Prefix(opath)
 
         r = self._p_jar.db().undoInfo(
             first_transaction, last_transaction, spec)
 
         for d in r:
-            d['time']=t=DateTime(d['time'])
+            d['time'] = t = DateTime(d['time'])
             desc = d['description']
-            tid=d['id']
+            tid = d['id']
             if desc:
                 desc = desc.split()
-                d1=desc[0]
+                d1 = desc[0]
                 desc = ''.join(desc[1:])
-                if len(desc) > 60: desc = desc[:56]+' ...'
+                if len(desc) > 60:
+                    desc = desc[:56] + ' ...'
                 tid = "%s %s %s %s" % (encode64(tid), t, d1, desc)
             else:
                 tid = "%s %s" % (encode64(tid), t)
-            d['id']=tid
+            d['id'] = tid
 
-
         return r
 
     security.declareProtected(undo_changes, 'manage_undo_transactions')
@@ -136,7 +144,8 @@
                 tid=decode64(tid[0])
                 undo(tid)
 
-        if REQUEST is None: return
+        if REQUEST is None:
+            return
         REQUEST['RESPONSE'].redirect("%s/manage_UndoForm" % REQUEST['URL1'])
         return ''
 
@@ -147,13 +156,17 @@
 
 import binascii
 
+
 def encode64(s, b2a=binascii.b2a_base64):
-    if len(s) < 58: return b2a(s)
-    r=[]; a=r.append
+    if len(s) < 58:
+        return b2a(s)
+    r = []
+    a = r.append
     for i in range(0, len(s), 57):
         a(b2a(s[i:i+57])[:-1])
     return ''.join(r)
 
+
 def decode64(s, a2b=binascii.a2b_base64):
     __traceback_info__=len(s), `s`
     return a2b(s+'\n')

Modified: Zope/branches/tseaver-fix_wsgi/src/App/ZApplication.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/ZApplication.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/ZApplication.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/App/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/class_init.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/class_init.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/class_init.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/config.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/config.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/config.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/App/dtml/copyright.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/dtml/copyright.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/dtml/copyright.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -158,7 +158,7 @@
 <hr>
 <p>Zope uses the C expat library by James Clark, for parsing XML text.</p>
 
-<P>Copyright (c) 1998, 1999 James Clark.  Expat is subject to the <A
+<P>Copyright (c) 1998, 1999 Zope Foundation and Contributors
 HREF="http://www.mozilla.org/NPL/NPL-1_1Final.html">Mozilla Public
 License Version 1.1</A>.
 </p>

Modified: Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -19,14 +19,14 @@
   <dtml-else>
   <frameset rows="34, *">
   </dtml-if>
-  <frame src="&dtml-URL1;/manage_top_frame" name="manage_top_frame"
+  <frame src="<dtml-var "REQUEST.URL1" html_quote>/manage_top_frame" name="manage_top_frame"
    marginheight="0" scrolling="no"/>
 </dtml-if>
 
   <frameset cols="175,*">
-    <frame src="&dtml-URL1;/manage_menu" name="manage_menu"
+    <frame src="<dtml-var "REQUEST.URL1" html_quote>/manage_menu" name="manage_menu"
      marginwidth="2" marginheight="2" scrolling="auto"/>
-    <frame src="&dtml-URL1;/manage_workspace" name="manage_main"
+    <frame src="<dtml-var "REQUEST.URL1" html_quote>/manage_workspace" name="manage_main"
      marginwidth="2" marginheight="2" scrolling="auto"/>
   </frameset>
 

Modified: Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage_tabs.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage_tabs.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/dtml/manage_tabs.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -59,7 +59,7 @@
    align="center"><font face="Verdana, Arial, Helvetica" 
    size="1" color="#000000">&nbsp;<a <dtml-if "s_item.get('action')"
    >href="&dtml-action;"<dtml-else
-   >href="&dtml-URL1;"</dtml-if
+   >href="<dtml-var "REQUEST.URL1" html_quote>"</dtml-if
    ><dtml-if "s_item.get('target')"> target="&dtml-target;"</dtml-if
    >><span style="color: #000000;"><strong><dtml-var "s_item['label']"
    ></strong></span></a>&nbsp;</font></td>
@@ -68,7 +68,7 @@
    align="center"><font face="Verdana, Arial, Helvetica" 
    size="1" color="#000000">&nbsp;<a <dtml-if "s_item.get('action')"
    >href="&dtml-action;"<dtml-else
-   >href="&dtml-URL1;"</dtml-if
+   >href="<dtml-var "REQUEST.URL1" html_quote>"</dtml-if
    ><dtml-if "s_item.get('target')"> target="&dtml-target;"</dtml-if
    >><span style="color: #000000;"><strong><dtml-var "s_item['label']"
    ></strong></span></a>&nbsp;</font></td>

Modified: Zope/branches/tseaver-fix_wsgi/src/App/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/special_dtml.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/special_dtml.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/special_dtml.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/tar.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/tar.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/tar.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/App/tests/test_cachemanager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/tests/test_cachemanager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/tests/test_cachemanager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/App/tests/test_class_init.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/tests/test_class_init.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/tests/test_class_init.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -31,7 +31,7 @@
     >>> InitializeClass(C)
     """
 
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
 import unittest
 
 def test_suite():

Modified: Zope/branches/tseaver-fix_wsgi/src/App/tests/test_setConfiguration.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/tests/test_setConfiguration.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/tests/test_setConfiguration.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004 Zope Corporation and Contributors.
+# Copyright (c) 2004 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/App/version_txt.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/App/version_txt.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/App/version_txt.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_HTML.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_HTML.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_HTML.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_If.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_If.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_If.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_In.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_In.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_In.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -761,19 +761,15 @@
                 if multsort: # More than one sort key.
                     k = []
                     for sk in sortfields:
-                        try:
-                            if mapping: akey = v[sk]
-                            else: akey = getattr(v, sk)
-                        except AttributeError, KeyError: akey = None
+                        if mapping: akey = v.get(sk)
+                        else: akey = getattr(v, sk, None)
                         if not basic_type(akey):
                             try: akey = akey()
                             except: pass
                         k.append(akey)
                 else: # One sort key.
-                    try:
-                        if mapping: k = v[sort]
-                        else: k = getattr(v, sort)
-                    except AttributeError, KeyError: k = None
+                    if mapping: k = v.get(sort)
+                    else: k = getattr(v, sort, None)
                     if not basic_type(type(k)):
                         try: k = k()
                         except: pass

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_InSV.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_InSV.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_InSV.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Let.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Let.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Let.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Raise.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Raise.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Raise.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Return.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Return.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Return.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_String.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_String.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_String.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Try.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Try.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Try.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_UI.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_UI.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_UI.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Util.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Util.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Util.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Var.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Var.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_Var.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_With.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_With.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DT_With.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DTtestExpr.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DTtestExpr.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/DTtestExpr.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/_DocumentTemplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/_DocumentTemplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/_DocumentTemplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/cDocumentTemplate.c
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/cDocumentTemplate.c	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/cDocumentTemplate.c	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-  Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+  Copyright (c) 2002 Zope Foundation and Contributors.
   
   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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/pDocumentTemplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/pDocumentTemplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/pDocumentTemplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/SortEx.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/SortEx.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/SortEx.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/tests/testSequence.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/tests/testSequence.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/sequence/tests/testSequence.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTML.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTML.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTML.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -13,60 +13,20 @@
 """Document Template Tests
 """
 
-__rcs_id__='$Id$'
-__version__='$Revision: 1.15 $'[11:-2]
-
-import sys, os, cgi
 import unittest
 
-if __name__=='__main__':
-    here = os.curdir
-else:
-    from DocumentTemplate import tests
-    here = tests.__path__[0]
+class DTMLTests(unittest.TestCase):
 
-def read_file(name):
-    f = open(os.path.join(here, name), 'r')
-    res = f.read()
-    f.close()
-    return res
+    def _get_doc_class(self):
+        from DocumentTemplate.DT_HTML import HTML
+        return HTML
+    doc_class = property(_get_doc_class,)
 
-from DocumentTemplate.DT_HTML import HTML, String
-from ExtensionClass import Base
-class D:
-    __allow_access_to_unprotected_subobjects__ = 1
-
-    def __init__(self, **kw):
-        for k, v in kw.items(): self.__dict__[k]=v
-
-    def __repr__(self): return "D(%s)" % `self.__dict__`
-
-def d(**kw): return kw
-
-docutils_include_warning = '''\
-<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">&lt;string&gt;</tt>, line 1)</p>
-<p>&quot;include&quot; directive disabled.</p>'''
-
-docutils_raw_warning = '''\
-<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">&lt;string&gt;</tt>, line 1)</p>
-<p>&quot;raw&quot; directive disabled.</p>'''
-
-class PukeError(Exception):
-    """Exception raised in test code."""
-
-class DTMLTests (unittest.TestCase):
-
-    doc_class = HTML
-
     def testBatchingEtc(self):
 
-        def item(key,**kw): return (key,kw)
-        def item2(key,**kw): return kw
+        def item(key, **kw):
+            return (key, kw)
 
-        class item_class:
-            def __init__(self,key,**kw):
-                for k in kw.keys(): self.__dict__[k]=kw[k]
-
         items=(
             item( 1,dealer='Bay Chevy', make='Chevrolet',
                   model='Caprice', year=96),
@@ -176,12 +136,11 @@
         self.assertEqual(res,expected)
 
     def testSequenceSummaries(self):
-        def d(**kw): return kw
-        data=(d(name='jim', age=38),
-              # d(name='kak', age=40),
-              d(name='will', age=7),
-              d(name='drew', age=4),
-              d(name='ches', age=1),
+        data=(dict(name='jim', age=38),
+              # dict(name='kak', age=40),
+              dict(name='will', age=7),
+              dict(name='drew', age=4),
+              dict(name='ches', age=1),
               )
         html = self.doc_class('<dtml-in data mapping>'
                     '<dtml-if sequence-end>'
@@ -222,6 +181,7 @@
         assert res == expected, res
 
     def testSimpleString(self):
+        from DocumentTemplate.DT_HTML import String
         dt = String('%(name)s')
         res = dt(name='Chris')
         expected = 'Chris'
@@ -229,6 +189,7 @@
 
     def testStringDateFormatting(self):
         import DateTime
+        from DocumentTemplate.DT_HTML import String
         html = String("%(name capitalize spacify)s is "
                       "%(date fmt=year)s/%(date fmt=month)s/%(date fmt=day)s")
         res = html(date=DateTime.DateTime("2001-04-27"),
@@ -357,6 +318,7 @@
         self.assert_(docutils_include_warning in result)
 
     def test_fmt_reST_raw_directive_disabled(self):
+        from cgi import escape
         EXPECTED = '<h1>HELLO WORLD</h1>'
         source = '.. raw:: html\n\n  %s\n' % EXPECTED
         html = self.doc_class('<dtml-var name="foo" fmt="restructured-text">')
@@ -367,7 +329,7 @@
         # verbatimly in the rendered output.  Instead a warning
         # message is presented:
         self.assert_(EXPECTED not in result)
-        self.assert_(cgi.escape(EXPECTED) in result)
+        self.assert_(escape(EXPECTED) in result)
         self.assert_(docutils_raw_warning in result)
 
     def test_fmt_reST_raw_directive_file_option_raises(self):
@@ -395,6 +357,7 @@
         self.assert_(docutils_raw_warning in result)
 
     def testPropogatedError(self):
+        from ExtensionClass import Base
 
         class foo:
             def __len__(self): return 9
@@ -434,7 +397,8 @@
             assert 0, 'Puke error not propogated'
 
     def testRenderCallable(self):
-        "Test automatic rendering of callable objects"
+        #Test automatic rendering of callable objects
+        from ExtensionClass import Base
         class C (Base):
             __allow_access_to_unprotected_subobjects__ = 1
             x=1
@@ -483,7 +447,9 @@
 
 
     def testNoItemPush(self):
-        data=d(sec='B', name='XXX', sub=(d(name='b1'),d(name='b2',sec='XXX')))
+        data = dict(sec='B',
+                    name='XXX',
+                    sub=(dict(name='b1'), dict(name='b2',sec='XXX')))
         html = """
 <dtml-with data mapping><dtml-in sub no_push_item>
     <dtml-var sec>.<dtml-with sequence-item mapping><dtml-var name></dtml-with>
@@ -496,11 +462,11 @@
 
     def testBasicHTMLIn(self):
         data=(
-            d(name='jim', age=39),
-            d(name='kak', age=29),
-            d(name='will', age=8),
-            d(name='andrew', age=5),
-            d(name='chessie',age=2),
+            dict(name='jim', age=39),
+            dict(name='kak', age=29),
+            dict(name='will', age=8),
+            dict(name='andrew', age=5),
+            dict(name='chessie',age=2),
             )
 
         html="""
@@ -519,7 +485,7 @@
         assert result == expected, result
 
     def testBasicHTMLIn2(self):
-        xxx=(D(name=1), D(name=2), D(name=3))
+        xxx=(Dummy(name=1), Dummy(name=2), Dummy(name=3))
         html = """
 <!--#in xxx-->
    <!--#var name  -->
@@ -543,7 +509,7 @@
         assert result == expected, result
 
     def testHTMLInElse(self):
-        xxx=(D(name=1), D(name=2), D(name=3))
+        xxx=(Dummy(name=1), Dummy(name=2), Dummy(name=3))
         html="""
 <!--#in data mapping-->
 <!--#var name-->, <!--#var age-->
@@ -562,12 +528,13 @@
         assert result == expected, result
 
     def testBasicStringIn(self):
+        from DocumentTemplate.DT_HTML import String
         data=(
-            d(name='jim', age=39),
-            d(name='kak', age=29),
-            d(name='will', age=8),
-            d(name='andrew', age=5),
-            d(name='chessie',age=2),
+            dict(name='jim', age=39),
+            dict(name='kak', age=29),
+            dict(name='will', age=8),
+            dict(name='andrew', age=5),
+            dict(name='chessie',age=2),
             )
         s="""
 %(in data mapping)[
@@ -584,13 +551,37 @@
         result = String(s)(data=data)
         assert expected == result, result
 
+
+def read_file(name):
+    import os
+    from DocumentTemplate import tests
+    here = tests.__path__[0]
+    f = open(os.path.join(here, name), 'r')
+    res = f.read()
+    f.close()
+    return res
+
+class Dummy:
+    __allow_access_to_unprotected_subobjects__ = 1
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+    def __repr__(self):
+        return "Dummy(%s)" % `self.__dict__`
+
+docutils_include_warning = '''\
+<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">&lt;string&gt;</tt>, line 1)</p>
+<p>&quot;include&quot; directive disabled.</p>'''
+
+docutils_raw_warning = '''\
+<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">&lt;string&gt;</tt>, line 1)</p>
+<p>&quot;raw&quot; directive disabled.</p>'''
+
+class PukeError(Exception):
+    """Exception raised in test code."""
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( DTMLTests ) )
     return suite
-
-def main():
-    unittest.TextTestRunner().run(test_suite())
-
-if __name__ == '__main__':
-    main()

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTMLUnicode.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTMLUnicode.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testDTMLUnicode.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -12,16 +12,8 @@
 ##############################################################################
 """Document Template Tests
 """
-
-__rcs_id__='$Id$'
-__version__='$Revision: 1.4 $'[11:-2]
-
-import sys, os
 import unittest
 
-from DocumentTemplate.DT_HTML import HTML, String
-from ExtensionClass import Base
-
 class force_str:
     # A class whose string representation is not always a plain string:
     def __init__(self,s):
@@ -31,7 +23,10 @@
 
 class DTMLUnicodeTests (unittest.TestCase):
 
-    doc_class = HTML
+    def _get_doc_class(self):
+        from DocumentTemplate.DT_HTML import HTML
+        return HTML
+    doc_class = property(_get_doc_class,)
 
     def testAA(self):
         html=self.doc_class('<dtml-var a><dtml-var b>')
@@ -91,9 +86,3 @@
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( DTMLUnicodeTests ) )
     return suite
-
-def main():
-    unittest.TextTestRunner().run(test_suite())
-
-if __name__ == '__main__':
-    main()

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Raise.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Raise.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Raise.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -21,7 +21,6 @@
         self.assertEqual(raiser.expr, None)
 
     def test_ctor_w_expr(self):
-        from DocumentTemplate.DT_Util import Eval
         raiser = self._makeOne(expr='SyntaxError')
         self.assertEqual(raiser.__name__, 'SyntaxError')
         self.assertEqual(raiser.expr.expr, 'SyntaxError')

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Var.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Var.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/test_DT_Var.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2008 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2008 Zope Foundation and Contributors.
 #
 # 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.
@@ -16,7 +16,6 @@
 """
 
 import unittest, doctest
-from DocumentTemplate import DT_Var
 
 class TestNewlineToBr(doctest.DocTestCase):
 
@@ -25,6 +24,7 @@
         newline_to_br should work identically with either DOS-style or
         Unix-style newlines.
 
+        >>> from DocumentTemplate import DT_Var
         >>> text = '''
         ... line one
         ... line two
@@ -47,6 +47,7 @@
 
     def test_newline_to_br_tainted(self):
         """
+        >>> from DocumentTemplate import DT_Var
         >>> text = '''
         ... <li>line one</li>
         ... <li>line two</li>

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testustr.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testustr.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/tests/testustr.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -17,7 +17,6 @@
 
 import unittest
 
-from DocumentTemplate.ustr import ustr
 
 
 class force_str:
@@ -40,45 +39,70 @@
 
 class UnicodeTests(unittest.TestCase):
 
-    def testPlain(self):
+    def test_bare_string_literall(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr('hello')
-        assert a=='hello', `a`
+        self.assertEqual(a, 'hello')
+
+    def test_with_force_str(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(force_str('hello'))
-        assert a=='hello', `a`
+        self.assertEqual(a, 'hello')
+
+    def test_with_non_ascii_char(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(chr(200))
-        assert a==chr(200), `a`
+        self.assertEqual(a, chr(200))
+
+    def test_with_force_str_non_ascii_char(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(force_str(chr(200)))
-        assert a==chr(200), `a`
+        self.assertEqual(a, chr(200))
+
+    def test_with_int(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(22)
-        assert a=='22', `a`
+        self.assertEqual(a, '22')
+
+    def test_with_list(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr([1,2,3])
-        assert a=='[1, 2, 3]', `a`
+        self.assertEqual(a, '[1, 2, 3]')
 
-    def testUnicode(self):
+    def test_w_unicode_literal(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(u'hello')
-        assert a=='hello', `a`
+        self.assertEqual(a, 'hello')
+
+    def test_w_force_str_unicode_literal(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(force_str(u'hello'))
-        assert a=='hello', `a`
+        self.assertEqual(a, 'hello')
+
+    def test_w_unichr(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(unichr(200))
-        assert a==unichr(200), `a`
+        self.assertEqual(a, unichr(200))
+
+    def test_w_force_str_unichr(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(force_str(unichr(200)))
-        assert a==unichr(200), `a`
+        self.assertEqual(a, unichr(200))
 
-    def testExceptions(self):
+    def test_w_unichr_in_exception(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(ValueError(unichr(200)))
-        assert a==unichr(200), `a`
+        self.assertEqual(a, unichr(200))
 
     def testCustomStrings(self):
+        from DocumentTemplate.ustr import ustr
         a = ustr(Foo('foo'))
-        self.failUnlessEqual(type(a), Foo)
+        self.assertEqual(type(a), Foo)
         a = ustr(Bar('bar'))
-        self.failUnlessEqual(type(a), Bar)
+        self.assertEqual(type(a), Bar)
 
 
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( UnicodeTests ) )
     return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/ustr.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/ustr.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/DocumentTemplate/ustr.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Globals/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Globals/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Globals/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/APIHelpTopic.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/APIHelpTopic.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/APIHelpTopic.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpSys.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpSys.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpSys.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpTopic.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpTopic.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpTopic.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpUtil.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpUtil.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/HelpUtil.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/ObjectRef.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/ObjectRef.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/ObjectRef.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/HelpSys/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/HelpSys/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/HelpSys/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Application.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Application.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Application.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Cache.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Cache.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Cache.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/CopySupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/CopySupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/CopySupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -39,7 +39,6 @@
 from App.class_init import InitializeClass
 from App.Dialogs import MessageDialog
 from App.special_dtml import HTML
-from App.special_dtml import HTMLFile
 from App.special_dtml import DTMLFile
 from ExtensionClass import Base
 from webdav.Lockable import ResourceLockedError
@@ -88,7 +87,7 @@
         if hasattr(aq_base(self), id):
             return getattr(self, id)
         if default is _marker:
-            raise AttributeError, id
+            raise AttributeError(id)
         return default
 
     def manage_CopyContainerFirstItem(self, REQUEST):
@@ -103,7 +102,7 @@
         if ids is None and REQUEST is not None:
             return eNoItemsSpecified
         elif ids is None:
-            raise ValueError, 'ids must be specified'
+            raise ValueError('ids must be specified')
 
         if type(ids) is type(''):
             ids=[ids]
@@ -112,10 +111,11 @@
             ob=self._getOb(id)
 
             if ob.wl_isLocked():
-                raise ResourceLockedError, 'Object "%s" is locked via WebDAV' % ob.getId()
+                raise ResourceLockedError('Object "%s" is locked via WebDAV'
+                                            % ob.getId())
 
             if not ob.cb_isMoveable():
-                raise CopyError, eNotSupported % escape(id)
+                raise CopyError(eNotSupported % escape(id))
             m = Moniker(ob)
             oblist.append(m.dump())
         cp=(1, oblist)
@@ -133,7 +133,7 @@
         if ids is None and REQUEST is not None:
             return eNoItemsSpecified
         elif ids is None:
-            raise ValueError, 'ids must be specified'
+            raise ValueError('ids must be specified')
 
         if type(ids) is type(''):
             ids=[ids]
@@ -141,7 +141,7 @@
         for id in ids:
             ob=self._getOb(id)
             if not ob.cb_isCopyable():
-                raise CopyError, eNotSupported % escape(id)
+                raise CopyError(eNotSupported % escape(id))
             m = Moniker(ob)
             oblist.append(m.dump())
         cp=(0, oblist)
@@ -188,12 +188,12 @@
         else:
             cp = None
         if cp is None:
-            raise CopyError, eNoData
+            raise CopyError(eNoData)
 
         try:
             op, mdatas = _cb_decode(cp)
         except:
-            raise CopyError, eInvalid
+            raise CopyError(eInvalid)
 
         oblist = []
         app = self.getPhysicalRoot()
@@ -204,7 +204,7 @@
             except ConflictError:
                 raise
             except:
-                raise CopyError, eNotFound
+                raise CopyError(eNotFound)
             self._verifyObjectPaste(ob, validate_src=op+1)
             oblist.append(ob)
 
@@ -214,17 +214,17 @@
             for ob in oblist:
                 orig_id = ob.getId()
                 if not ob.cb_isCopyable():
-                    raise CopyError, eNotSupported % escape(orig_id)
+                    raise CopyError(eNotSupported % escape(orig_id))
 
                 try:
                     ob._notifyOfCopyTo(self, op=0)
                 except ConflictError:
                     raise
                 except:
-                    raise CopyError, MessageDialog(
+                    raise CopyError(MessageDialog(
                         title="Copy Error",
                         message=sys.exc_info()[1],
-                        action='manage_main')
+                        action='manage_main'))
 
                 id = self._get_id(orig_id)
                 result.append({'id': orig_id, 'new_id': id})
@@ -253,20 +253,21 @@
             for ob in oblist:
                 orig_id = ob.getId()
                 if not ob.cb_isMoveable():
-                    raise CopyError, eNotSupported % escape(orig_id)
+                    raise CopyError(eNotSupported % escape(orig_id))
 
                 try:
                     ob._notifyOfCopyTo(self, op=1)
                 except ConflictError:
                     raise
                 except:
-                    raise CopyError, MessageDialog(
+                    raise CopyError(MessageDialog(
                         title="Move Error",
                         message=sys.exc_info()[1],
-                        action='manage_main')
+                        action='manage_main'))
 
                 if not sanity_check(self, ob):
-                    raise CopyError, "This object cannot be pasted into itself"
+                    raise CopyError(
+                            "This object cannot be pasted into itself")
 
                 orig_container = aq_parent(aq_inner(ob))
                 if aq_base(orig_container) is aq_base(self):
@@ -328,7 +329,7 @@
     def manage_renameObjects(self, ids=[], new_ids=[], REQUEST=None):
         """Rename several sub-objects"""
         if len(ids) != len(new_ids):
-            raise BadRequest,'Please rename each listed object.'
+            raise BadRequest('Please rename each listed object.')
         for i in range(len(ids)):
             if ids[i] != new_ids[i]:
                 self.manage_renameObject(ids[i], new_ids[i], REQUEST)
@@ -343,18 +344,18 @@
         try:
             self._checkId(new_id)
         except:
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                 title='Invalid Id',
                 message=sys.exc_info()[1],
-                action ='manage_main')
+                action ='manage_main'))
 
         ob = self._getOb(id)
 
         if ob.wl_isLocked():
-            raise ResourceLockedError, ('Object "%s" is locked via WebDAV'
+            raise ResourceLockedError('Object "%s" is locked via WebDAV'
                                         % ob.getId())
         if not ob.cb_isMoveable():
-            raise CopyError, eNotSupported % escape(id)
+            raise CopyError(eNotSupported % escape(id))
         self._verifyObjectPaste(ob)
 
         try:
@@ -362,10 +363,10 @@
         except ConflictError:
             raise
         except:
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                 title="Rename Error",
                 message=sys.exc_info()[1],
-                action ='manage_main')
+                action ='manage_main'))
 
         notify(ObjectWillBeMovedEvent(ob, self, id, self, new_id))
 
@@ -409,14 +410,14 @@
         """Clone an object, creating a new object with the given id.
         """
         if not ob.cb_isCopyable():
-            raise CopyError, eNotSupported % escape(ob.getId())
+            raise CopyError(eNotSupported % escape(ob.getId()))
         try:
             self._checkId(id)
         except:
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                 title='Invalid Id',
                 message=sys.exc_info()[1],
-                action ='manage_main')
+                action ='manage_main'))
 
         self._verifyObjectPaste(ob)
 
@@ -425,10 +426,10 @@
         except ConflictError:
             raise
         except:
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                 title="Clone Error",
                 message=sys.exc_info()[1],
-                action='manage_main')
+                action='manage_main'))
 
         orig_ob = ob
         ob = ob._getCopy(self)
@@ -482,17 +483,17 @@
         # heirarchy).
 
         if not hasattr(object, 'meta_type'):
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                   title   = 'Not Supported',
                   message = ('The object <em>%s</em> does not support this' \
                              ' operation' % escape(absattr(object.id))),
-                  action  = 'manage_main')
+                  action  = 'manage_main'))
 
         if not hasattr(self, 'all_meta_types'):
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                   title   = 'Not Supported',
                   message = 'Cannot paste into this object.',
-                  action  = 'manage_main')
+                  action  = 'manage_main'))
 
         method_name = None
         mt_permission = None
@@ -523,19 +524,19 @@
                         if not sm.checkPermission(delete_objects, parent):
                             raise Unauthorized('Delete not allowed.')
             else:
-                raise CopyError, MessageDialog(
+                raise CopyError(MessageDialog(
                     title = 'Insufficient Privileges',
                     message = ('You do not possess the %s permission in the '
                                'context of the container into which you are '
                                'pasting, thus you are not able to perform '
                                'this operation.' % mt_permission),
-                    action = 'manage_main')
+                    action = 'manage_main'))
         else:
-            raise CopyError, MessageDialog(
+            raise CopyError(MessageDialog(
                 title = 'Not Supported',
                 message = ('The object <em>%s</em> does not support this '
                            'operation.' % escape(absattr(object.id))),
-                action = 'manage_main')
+                action = 'manage_main'))
 
 InitializeClass(CopyContainer)
 
@@ -574,11 +575,11 @@
         transaction.savepoint(optimistic=True)
 
         if self._p_jar is None:
-            raise CopyError, (
+            raise CopyError(
                 'Object "%s" needs to be in the database to be copied' %
                 `self`)
         if container._p_jar is None:
-            raise CopyError, (
+            raise CopyError(
                 'Container "%s" needs to be in the database' %
                 `container`)
 

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLDocument.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLDocument.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLDocument.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -52,37 +52,6 @@
             or perms
         for perms in DTMLMethod.__ac_permissions__])
 
-    def manage_edit(self, data, title,
-                    SUBMIT='Change',
-                    dtpref_cols='100%',
-                    dtpref_rows='20',
-                    REQUEST=None
-                   ):
-        """ Replace contents with 'data', title with 'title'.
-
-        The SUBMIT parameter is also used to change the size of the editing
-        area on the default Document edit screen.  If the value is "Smaller",
-        the rows and columns decrease by 5.  If the value is "Bigger", the
-        rows and columns increase by 5.  If any other or no value is supplied,
-        the data gets checked for DTML errors and is saved.
-        """
-        self._validateProxy(REQUEST)
-        if self._size_changes.has_key(SUBMIT):
-            return self._er(data, title,
-                            SUBMIT, dtpref_cols, dtpref_rows, REQUEST)
-        if self.wl_isLocked():
-            raise ResourceLockedError(
-                'This document has been locked via WebDAV.')
-
-        self.title = str(title)
-        if type(data) is not type(''):
-            data = data.read()
-        self.munge(data)
-        self.ZCacheable_invalidate()
-        if REQUEST:
-            message = "Content changed."
-            return self.manage_main(self, REQUEST, manage_tabs_message=message)
-
     def manage_upload(self, file='', REQUEST=None):
         """ Replace the contents of the document with the text in 'file'.
         """

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/DTMLMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -38,6 +38,7 @@
 from zExceptions import Forbidden
 from zExceptions.TracebackSupplement import PathTracebackSupplement
 from ZPublisher.Iterators import IStreamIterator
+from ZPublisher.TaintedString import TaintedString
 from zope.contenttype import guess_content_type
 
 
@@ -287,10 +288,12 @@
             return self._er(data, title,
                             SUBMIT, dtpref_cols, dtpref_rows, REQUEST)
         if self.wl_isLocked():
-            raise ResourceLockedError('This DTML Method is locked via WebDAV')
+            raise ResourceLockedError('This item is locked via WebDAV')
 
         self.title = str(title)
-        if type(data) is not type(''):
+        if isinstance(data, TaintedString):
+            data = data.quoted()
+        if not isinstance(data, basestring):
             data = data.read()
         self.munge(data)
         self.ZCacheable_invalidate()

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/DefaultObservable.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/DefaultObservable.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/DefaultObservable.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Document.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Document.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Document.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/FTPInterface.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/FTPInterface.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/FTPInterface.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/FindSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/FindSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/FindSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Folder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Folder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Folder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/History.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/History.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/History.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Image.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Image.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Image.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -46,6 +46,10 @@
 from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import Item_w__name__
 
+from zope.event import notify
+from zope.lifecycleevent import ObjectModifiedEvent
+from zope.lifecycleevent import ObjectCreatedEvent
+
 manage_addFileForm = DTMLFile('dtml/imageAdd',
                               globals(),
                               Kind='File',
@@ -63,19 +67,23 @@
     precondition = str(precondition)
 
     id, title = cookId(id, title, file)
-
+    
     self=self.this()
 
     # First, we create the file without data:
     self._setObject(id, File(id,title,'',content_type, precondition))
-
+    
+    newFile = self._getOb(id)
+    
     # Now we "upload" the data.  By doing this in two steps, we
     # can use a database trick to make the upload more efficient.
     if file:
-        self._getOb(id).manage_upload(file)
+        newFile.manage_upload(file)
     if content_type:
-        self._getOb(id).content_type=content_type
-
+        newFile.content_type=content_type
+    
+    notify(ObjectCreatedEvent(newFile))
+    
     if REQUEST is not None:
         REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
 
@@ -469,6 +477,9 @@
             self.update_data(filedata, content_type, len(filedata))
         else:
             self.ZCacheable_invalidate()
+        
+        notify(ObjectModifiedEvent(self))
+        
         if REQUEST:
             message="Saved changes."
             return self.manage_main(self,REQUEST,manage_tabs_message=message)
@@ -487,7 +498,9 @@
         content_type=self._get_content_type(file, data, self.__name__,
                                             'application/octet-stream')
         self.update_data(data, content_type, size)
-
+        
+        notify(ObjectModifiedEvent(self))
+        
         if REQUEST:
             message="Saved changes."
             return self.manage_main(self,REQUEST,manage_tabs_message=message)
@@ -665,14 +678,18 @@
 
     # First, we create the image without data:
     self._setObject(id, Image(id,title,'',content_type, precondition))
-
+    
+    newFile = self._getOb(id)
+    
     # Now we "upload" the data.  By doing this in two steps, we
     # can use a database trick to make the upload more efficient.
     if file:
-        self._getOb(id).manage_upload(file)
+        newFile.manage_upload(file)
     if content_type:
-        self._getOb(id).content_type=content_type
-
+        newFile.content_type=content_type
+    
+    notify(ObjectCreatedEvent(newFile))
+    
     if REQUEST is not None:
         try:    url=self.DestinationURL()
         except: url=REQUEST['URL1']

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Moniker.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Moniker.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Moniker.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/ObjectManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/ObjectManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/ObjectManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -617,7 +617,6 @@
         if dirname:
             raise BadRequest, 'Invalid file name %s' % escape(file)
 
-        cfg = getConfiguration()
         for impath in self._getImportPaths():
             filepath = os.path.join(impath, 'import', file)
             if os.path.exists(filepath):
@@ -663,6 +662,8 @@
             paths.append(zopehome)
         if not cfg.instancehome in paths:
             paths.append(cfg.instancehome)
+        if not cfg.clienthome in paths:
+            paths.append(cfg.clienthome)
         return paths
 
     def list_imports(self):

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/OrderSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/OrderSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/OrderSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/OrderedFolder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/OrderedFolder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/OrderedFolder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/PropertyManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/PropertyManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/PropertyManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/PropertySheets.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/PropertySheets.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/PropertySheets.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/SimpleItem.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/SimpleItem.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/SimpleItem.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -20,12 +20,10 @@
 $Id$
 """
 
-import inspect
 import marshal
 import re
 import sys
 import time
-import warnings
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from AccessControl.SecurityManagement import getSecurityManager
@@ -118,7 +116,7 @@
     # Alias id to __name__, which will make tracebacks a good bit nicer:
     __name__=ComputedAttribute(lambda self: self.getId())
 
-    # Name, relative to SOFTWARE_URL of icon used to display item
+    # Name, relative to BASEPATH1 of icon used to display item
     # in folder listings.
     icon=''
 
@@ -237,39 +235,6 @@
             if not REQUEST:
                 REQUEST = aq_acquire(self, 'REQUEST')
 
-            handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None),
-                                    'handle_errors', False)
-            # Can we re-raise the exception with a rendered-to-HTML
-            # exception value? To be able to do so, the exception
-            # constructor needs to be able to take more than two
-            # arguments (some Zope 3 exceptions can't).
-            can_raise = False
-            ctor = getattr(error_type, '__init__', None)
-            if inspect.ismethoddescriptor(ctor):
-                # If it's a method descriptor, it means we've got a
-                # base ``__init__`` method that was not overriden,
-                # likely from the base ``Exception`` class.
-                can_raise = True
-            else:
-                if inspect.ismethod(ctor):
-                    ctor = getattr(ctor, 'im_func', None)
-                if inspect.isbuiltin(ctor):
-                    # In Python 2.4, the ``__init__`` method of the
-                    # base ``Exception`` class is a ``builtin
-                    # method``.
-                    can_raise = True
-                elif ctor is not None and inspect.isfunction(ctor):
-                    can_raise = (
-                        len(inspect.getargspec(error_type.__init__)[0]) > 2)
-
-            if not (can_raise and handle_errors):
-                # If we have been asked not to handle errors and we
-                # can't re-raise a transformed exception don't even
-                # bother with transforming the exception into
-                # HTML. Just re-raise the original exception right
-                # away.
-                raise error_type, error_value, tb
-
             try:
                 s = aq_acquire(client, 'standard_error_message')
 
@@ -295,7 +260,7 @@
                     exc_info=True
                     )
                 try:
-                    strv = str(error_value)
+                    strv = repr(error_value) # quotes tainted strings
                 except:
                     strv = ('<unprintable %s object>' % 
                             str(type(error_value).__name__))
@@ -306,12 +271,9 @@
                     html_quote(sys.exc_info()[1]),
                     ))
 
-            if handle_errors:
-                # If we've been asked to handle errors, just
-                # return the rendered exception and let the
-                # ZPublisher Exception Hook deal with it.
-                return error_type, v, tb
-            raise error_type, v, tb
+            # If we've been asked to handle errors, just return the rendered
+            # exception and let the ZPublisher Exception Hook deal with it.
+            return error_type, v, tb
         finally:
             if hasattr(self, '_v_eek'): del self._v_eek
             tb = None

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Traversable.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Traversable.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Traversable.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/Uninstalled.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/Uninstalled.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/Uninstalled.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/XMLExportImport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/XMLExportImport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/XMLExportImport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -14,6 +14,8 @@
 from cStringIO import StringIO
 from ZODB.serialize import referencesf
 from ZODB.ExportImport import TemporaryFile, export_end_marker
+from ZODB.utils import p64
+from ZODB.utils import u64
 from Shared.DC.xml import ppml
 
 
@@ -23,7 +25,7 @@
     q=ppml.ToXMLUnpickler
     f=StringIO(p)
     u=q(f)
-    id=ppml.u64(oid)
+    id=u64(oid)
     aka=encodestring(oid)[:-1]
     u.idprefix=str(id)+'.'
     p=u.load().__str__(4)
@@ -93,11 +95,11 @@
     file.seek(pos)
     a=data[1]
     if a.has_key('id'): oid=a['id']
-    oid=ppml.p64(int(oid))
+    oid=p64(int(oid))
     v=''
     for x in data[2:]:
         v=v+x
-    l=ppml.p64(len(v))
+    l=p64(len(v))
     v=oid+l+v
     return v
 

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/ZDOM.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/ZDOM.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/ZDOM.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/fileEdit.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/fileEdit.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/fileEdit.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -10,7 +10,7 @@
 text type and small enough to be edited in a text area.
 </p>
 
-<form action="&dtml-URL1;" method="post" enctype="multipart/form-data">
+<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post" enctype="multipart/form-data">
 <table cellpadding="2" cellspacing="0" width="100%" border="0">
 <tr>
   <td align="left" valign="top">

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findFrame.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findFrame.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findFrame.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -5,12 +5,12 @@
 </HEAD>
 <FRAMESET ROWS="52%,*">
 <dtml-if cv_ffaf>
-  <FRAME SRC="&dtml-URL1;/manage_findAdv" NAME="findForm"
+  <FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findAdv" NAME="findForm"
 <dtml-else>
-  <FRAME SRC="&dtml-URL1;/manage_findForm" NAME="findForm"
+  <FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findForm" NAME="findForm"
 </dtml-if>
    MARGINWIDTH="2" MARGINHEIGHT="2" SCROLLING="auto">
-  <FRAME SRC="&dtml-URL1;/manage_findResult" NAME="findResult"
+  <FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findResult" NAME="findResult"
    MARGINWIDTH="2" MARGINHEIGHT="0" SCROLLING="auto">
 </FRAMESET>
 <NOFRAMES>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findResult.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findResult.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/findResult.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -60,13 +60,13 @@
 <td width="50%">
  <div class="list-item">
  <dtml-in name="results" previous size="batch_size" start="query_start">
- <strong> <a href="&dtml-URL;&dtml-sequence-query;query_start=&dtml-previous-sequence-start-number;">&lt; Previous</a></strong>
+ <strong> <a href="<dtml-var "REQUEST.URL" html_quote>&dtml-sequence-query;query_start=&dtml-previous-sequence-start-number;">&lt; Previous</a></strong>
  <dtml-else>&nbsp;</dtml-in></div>
 </td>
 <td align="right" width="50%">
  <div class="list-item">
  <dtml-in name="results" next size=batch_size start=query_start>
- <strong><a href="&dtml-URL;&dtml-sequence-query;query_start=&dtml-next-sequence-start-number;">Next &gt;</a></strong>
+ <strong><a href="<dtml-var "REQUEST.URL" html_quote>&dtml-sequence-query;query_start=&dtml-next-sequence-start-number;">Next &gt;</a></strong>
  <dtml-else>&nbsp;</dtml-in></div>
 </td>
 </tr>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/history.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/history.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/history.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -2,7 +2,7 @@
 <dtml-var manage_tabs>
 
 <dtml-if manage_change_history>
-  <form action="&dtml-URL1;" method="POST">
+  <form action="<dtml-var "REQUEST.URL1" html_quote>" method="POST">
   <table width="100%" cellspacing="0" cellpadding="2" border="0">
 
     <tr class="list-header">
@@ -10,7 +10,7 @@
        <div class="list-nav">
     <dtml-if first_transaction>       
           <dtml-with expr="_(next=first_transaction*2-last_transaction)">
-            <a href="&dtml-URL;?first_transaction:int=&dtml.-next;&last_transaction:int=&dtml.-first_transaction;&HistoryBatchSize:int=&dtml.-HistoryBatchSize;">&lt; Later Revisions</a>
+            <a href="<dtml-var "REQUEST.URL" html_quote>?first_transaction:int=&dtml.-next;&last_transaction:int=&dtml.-first_transaction;&HistoryBatchSize:int=&dtml.-HistoryBatchSize;">&lt; Later Revisions</a>
           </dtml-with>
     <dtml-else>
     &nbsp;
@@ -21,7 +21,7 @@
        <div class="list-nav">
     <dtml-if expr="_.len(manage_change_history) == HistoryBatchSize"> 
           <dtml-with expr="_(last=last_transaction+HistoryBatchSize)">
-            <a href="&dtml-URL;?first_transaction:int=&dtml.-last_transaction;&last_transaction:int=&dtml.-last;&HistoryBatchSize:int=&dtml.-HistoryBatchSize;">Earlier Revisions &gt;</a>
+            <a href="<dtml-var "REQUEST.URL" html_quote>?first_transaction:int=&dtml.-last_transaction;&last_transaction:int=&dtml.-last;&HistoryBatchSize:int=&dtml.-HistoryBatchSize;">Earlier Revisions &gt;</a>
           </dtml-with>
     <dtml-else>
     &nbsp;

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/importExport.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/importExport.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/importExport.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -10,16 +10,12 @@
 to download the export file to your local machine, or save it
 in the &quot;var&quot; directory of your Zope installation 
 on the server. 
-<!--
 <br/>
 <br/>
 <b>Note:</b>
-Zope can export/import objects in two dfferent formats: a binary format (called
+Zope can export/import objects in two different formats: a binary format (called
 ZEXP) and as XML. The ZEXP format is the officially supported export/import
 format for moving data between <u>identical</u> Zope installations (it is not a migration tool).
-The XML export/import is unsupported (and possibly broken under certain circumstances) - use it
-at your own risk.
--->
 </p>
 
 <form action="manage_exportObject" method="post">
@@ -42,26 +38,32 @@
   </td>
   <td align="left" valign="top">
   <div class="form-text">
-  <input type="radio" name="download:int" value="1" />
+  <label for="download_local">
+  <input type="radio" name="download:int" value="1" id="download_local" />
   Download to local machine
+  </label>
   <br />
-  <input type="radio" name="download:int" value="0" checked />
+  <label for="download_server">
+  <input type="radio" name="download:int" value="0" id="download_server" checked />
   Save to file on server
+  </label>
   </div>
   </td>
 </tr>  
-<!--
 <tr>
   <td align="left" valign="top">
   &nbsp;
   </td>
   <td align="left" valign="top">
   <div class="form-text">
-  <input type="checkbox" name="toxml" value="Y" /> XML format? (unsupported, see above)
+  <label for="toxml">
+  <input type="checkbox" id="toxml" name="toxml" value="Y" />
+  XML format?
+  </label>
+  <em>(unsupported, see above)</em>
   </div>
   </td>
 </tr>
--->
 <tr>
   <td></td>
   <td align="left" valign="top">
@@ -115,11 +117,15 @@
   </td>
   <td align="left" valign="top">
   <div class="form-text">
-  <input type="radio" name="set_owner:int" value="1" checked />
+  <label for="owner_take">
+  <input type="radio" name="set_owner:int" value="1" id="owner_take" checked />
   Take ownership of imported objects
+  </label>
   <br />
-  <input type="radio" name="set_owner:int" value="0" /> 
+  <label for="owner_retain">
+  <input type="radio" name="set_owner:int" value="0" id="owner_retain" /> 
   Retain existing ownership information
+  </label>
   </div>
   </td>
 </tr>
@@ -136,10 +142,3 @@
 
 
 <dtml-var manage_page_footer>
-
-
-
-
-
-
-

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/main.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/main.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/main.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -34,10 +34,10 @@
   <td align="left" valign="top">&nbsp;</td>
   <td align="right" valign="top">
   <div class="form-element">
-  <form action="&dtml-URL1;/" method="get">
+  <form action="<dtml-var "REQUEST.URL1" html_quote>/" method="get">
   <dtml-if "_.len(filtered_meta_types) > 1">
     <select class="form-element" name=":action" 
-     onChange="location.href='&dtml-URL1;/'+this.options[this.selectedIndex].value">
+     onChange="location.href='<dtml-var "REQUEST.URL1" html_quote>/'+this.options[this.selectedIndex].value">
     <option value="manage_workspace" disabled>Select type to add...</option>
     <dtml-in filtered_meta_types mapping sort=name>
     <dtml-if action>
@@ -59,7 +59,7 @@
   </table>
 </dtml-if>
 
-<form action="&dtml-URL1;/" name="objectItems" method="post">
+<form action="<dtml-var "REQUEST.URL1" html_quote>/" name="objectItems" method="post">
 <dtml-if objectItems>
   <dtml-let hasOrderSupport="_.getattr(this().aq_explicit, 'has_order_support', 0)">
   <dtml-unless skey>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/properties.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/properties.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/properties.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -25,7 +25,7 @@
 <dtml-var manage_tabs>
 </dtml-with>
 
-<form action="&dtml-URL1;" method="post">
+<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
 <dtml-if propertyMap>
 <p class="form-help">
 Properties allow you to assign simple values to Zope objects. To change 
@@ -222,7 +222,7 @@
 
 <dtml-if property_extensible_schema__>
 
-<form action="&dtml-URL1;/manage_addProperty" method="post">
+<form action="<dtml-var "REQUEST.URL1" html_quote>/manage_addProperty" method="post">
 
 <p class="form-help">
 To add a new property, enter a name, type and value for the new 

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertyType.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertyType.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertyType.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -20,7 +20,7 @@
   </dtml-if>
 </dtml-unless>
 
-<form action="&dtml-URL1;" method="POST">
+<form action="<dtml-var "REQUEST.URL1" html_quote>" method="POST">
 <dtml-if old_ids>
 <p>
 To change property names and values, edit them and click

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertysheets.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertysheets.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/propertysheets.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,7 @@
 <dtml-var manage_page_header>
 <dtml-var manage_tabs>
 
-<form action="&dtml-URL1;" method="post">
+<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
 <table cellspacing="0" cellpadding="2" border="0">
 <dtml-in items sort>
 <dtml-with "_(REQUEST=REQUEST, item=_['sequence-item'].aq_base, isDeletable=isDeletable)" only>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/renameForm.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/renameForm.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/dtml/renameForm.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -7,7 +7,7 @@
 	   )">
 
 <dtml-if expr="REQUEST.has_key('ids')">
-<form action="&dtml-URL1;" method="post">
+<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
 <table border="0">
 <dtml-in expr="manage_CopyContainerAllItems(REQUEST)">
 <tr>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/event.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/event.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/event.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/misc_.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/misc_.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/misc_.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/rPickle.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/rPickle.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/rPickle.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/standard/standard_error_message.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/standard/standard_error_message.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/standard/standard_error_message.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,5 +1,5 @@
 <html>
-<head><title>&dtml-title_or_id;</title></head>
+<head><title>Site Error</title></head>
 <body bgcolor="#FFFFFF">
 
 <dtml-if error_message>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/subscribers.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/subscribers.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/subscribers.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -12,12 +12,9 @@
 #
 ##############################################################################
 """
-Five subscriber definitions.
-
-$Id$
+Subscriber definitions.
 """
 
-import warnings
 from logging import getLogger
 
 import OFS.interfaces
@@ -67,10 +64,9 @@
         # Method knows it's deprecated
         return
     class_ = ob.__class__
-    warnings.warn(
+    LOG.debug(
         "%s.%s.%s is discouraged. You should use event subscribers instead." %
-        (class_.__module__, class_.__name__, method_name),
-        DeprecationWarning)
+        (class_.__module__, class_.__name__, method_name))
 
 ##################################################
 

Copied: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/export.xml (from rev 112805, Zope/branches/2.12/src/OFS/tests/export.xml)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/export.xml	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/export.xml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,344 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="482504664188191745" aka="BrIzb4doBAE=">
+    <pickle>
+      <tuple id="482504664188191745.2">
+          <global id="482504664188191745.1" name="Folder" module="OFS.Folder"/>
+          <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary id="482504664188191745.3">
+        <item>
+            <key><string id="482504664188191745.4" encoding="">_objects</string></key>
+            <value>
+              <tuple id="482504664188191745.10">
+                  <dictionary id="482504664188191745.5">
+                    <item>
+                        <key><string id="482504664188191745.6" encoding="">meta_type</string></key>
+                        <value><string id="482504664188191745.7" encoding="">Image</string></value>
+                    </item>
+                    <item>
+                        <key><string id="482504664188191745.8" encoding="">id</string></key>
+                        <value><string id="482504664188191745.9" encoding="">image</string></value>
+                    </item>
+                  </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key><reference id="482504664188191745.9"/></key>
+            <value>
+              <persistent><string id="482504664188191745.11" encoding="base64">BrIzb4doBAI=</string></persistent>
+            </value>
+        </item>
+        <item>
+            <key><reference id="482504664188191745.8"/></key>
+            <value><string id="482504664188191745.12" encoding="">sub</string></value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="482504664188191746" aka="BrIzb4doBAI=">
+    <pickle>
+      <tuple id="482504664188191746.2">
+          <global id="482504664188191746.1" name="Image" module="OFS.Image"/>
+          <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary id="482504664188191746.3">
+        <item>
+            <key><string id="482504664188191746.4" encoding="">precondition</string></key>
+            <value><string encoding=""></string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.5" encoding="">height</string></key>
+            <value><int>16</int></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.6" encoding="">size</string></key>
+            <value><int>894</int></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.7" encoding="">title</string></key>
+            <value><string encoding=""></string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.8" encoding="">width</string></key>
+            <value><int>16</int></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.9" encoding="">_EtagSupport__etag</string></key>
+            <value><string id="482504664188191746.10" encoding="">ts65767150.22</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.11" encoding="">prop3</string></key>
+            <value><long>2147483647</long></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.12" encoding="">content_type</string></key>
+            <value><string id="482504664188191746.13" encoding="">image/gif</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.14" encoding="">__name__</string></key>
+            <value><string id="482504664188191746.15" encoding="">image</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.16" encoding="">data</string></key>
+            <value><string id="482504664188191746.17" encoding="base64">R0lGODlhEAAQAPcAAP8A/wAAAFBQUICAgMDAwP8AAIAAQAAAoABAgIAAgEAAQP//AP//gACAgECA
+gP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAA
+AAhbAAMIHEhwIICDAQ4qXIhQYUKFCCIufAiAYsSLDjMWiFjgoMSODkECAMmRIcWDBTYiYMjS40qT
+DFWKRHmyY8mRKStmXJhzp04AEllSfBgUZsOWPk+2HFqwaYCAAAA7</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.18" encoding="">prop12</string></key>
+            <value><unicode encoding="">£</unicode></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.19" encoding="">prop10</string></key>
+            <value><string id="482504664188191746.20" encoding="">&lt;]]&gt;</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.21" encoding="">prop11</string></key>
+            <value><unicode id="482504664188191746.22" encoding="">&lt;]]&gt;</unicode></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.23" encoding="">prop4</string></key>
+            <value><string id="482504664188191746.24" encoding="">xxx</string></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.25" encoding="">prop5</string></key>
+            <value>
+              <tuple id="482504664188191746.27">
+                  <reference id="482504664188191746.24"/>
+                  <string id="482504664188191746.26" encoding="">zzz</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.28" encoding="">prop6</string></key>
+            <value><unicode id="482504664188191746.29" encoding="">xxx</unicode></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.30" encoding="">prop7</string></key>
+            <value>
+              <tuple id="482504664188191746.32">
+                  <reference id="482504664188191746.29"/>
+                  <unicode id="482504664188191746.31" encoding="">zzz</unicode>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.33" encoding="">prop1</string></key>
+            <value><float>3.14159265359</float></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.34" encoding="">prop2</string></key>
+            <value><int>1</int></value>
+        </item>
+        <item>
+            <key><string id="482504664188191746.35" encoding="">_properties</string></key>
+            <value>
+              <tuple id="482504664188191746.66">
+                  <dictionary id="482504664188191746.36">
+                    <item>
+                        <key><string id="482504664188191746.37" encoding="">type</string></key>
+                        <value><string id="482504664188191746.38" encoding="">string</string></value>
+                    </item>
+                    <item>
+                        <key><string id="482504664188191746.39" encoding="">id</string></key>
+                        <value><reference id="482504664188191746.7"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.40">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><string id="482504664188191746.41" encoding="">alt</string></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.42">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.12"/></value>
+                    </item>
+                    <item>
+                        <key><string id="482504664188191746.43" encoding="">mode</string></key>
+                        <value><string encoding="">w</string></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.44">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.5"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.45">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.8"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.46">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.47" encoding="">float</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.33"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.48">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.49" encoding="">int</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.34"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.50">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.51" encoding="">long</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.11"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.52">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.23"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.53">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.54" encoding="">lines</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.25"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.55">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.56" encoding="">unicode</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.28"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.57">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><string id="482504664188191746.58" encoding="">ulines</string></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.30"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.59">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><string id="482504664188191746.60" encoding="">prop8</string></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.61">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.56"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><string id="482504664188191746.62" encoding="">prop9</string></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.63">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.38"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.19"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.64">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.56"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.21"/></value>
+                    </item>
+                  </dictionary>
+                  <dictionary id="482504664188191746.65">
+                    <item>
+                        <key><reference id="482504664188191746.37"/></key>
+                        <value><reference id="482504664188191746.56"/></value>
+                    </item>
+                    <item>
+                        <key><reference id="482504664188191746.39"/></key>
+                        <value><reference id="482504664188191746.18"/></value>
+                    </item>
+                  </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key><reference id="482504664188191746.60"/></key>
+            <value><string id="482504664188191746.67" encoding="cdata"><![CDATA[<&>]]></string></value>
+        </item>
+        <item>
+            <key><reference id="482504664188191746.62"/></key>
+            <value><unicode id="482504664188191746.68" encoding="cdata"><![CDATA[<&>]]></unicode></value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testAppInitializer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testAppInitializer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testAppInitializer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testCopySupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testCopySupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testCopySupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,5 @@
 import unittest
 import Testing
-import Zope2
-Zope2.startup()
 
 import cStringIO
 

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testFileAndImage.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testFileAndImage.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testFileAndImage.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -8,6 +8,8 @@
 import time
 from cStringIO import StringIO
 
+from Acquisition import aq_base
+
 from OFS.Application import Application
 from OFS.SimpleItem import SimpleItem
 from OFS.Cache import ZCM_MANAGERS
@@ -19,6 +21,12 @@
 from zExceptions import Redirect
 import transaction
 
+import OFS.Image
+
+from zope.component import adapter
+from zope.lifecycleevent.interfaces import IObjectModifiedEvent
+from zope.lifecycleevent.interfaces import IObjectCreatedEvent
+
 try:
     here = os.path.dirname(os.path.abspath(__file__))
 except:
@@ -57,7 +65,7 @@
                    mtime_func=None):
         self.get = ob
         if self.si:
-            return si
+            return self.si
 
     def ZCache_invalidate(self, ob):
         self.invalidated = ob
@@ -78,6 +86,38 @@
     def ZCacheManager_getCache(self):
         return ADummyCache
 
+class EventCatcher(object):
+    
+    def __init__(self):
+        self.created = []
+        self.modified = []
+        
+        self.setUp()
+    
+    def setUp(self):
+        from zope.component import provideHandler
+        provideHandler(self.handleCreated)
+        provideHandler(self.handleModified)
+    
+    def tearDown(self):
+        from zope.component import getSiteManager
+        getSiteManager().unregisterHandler(self.handleCreated)
+        getSiteManager().unregisterHandler(self.handleModified)
+    
+    def reset(self):
+        self.created = []
+        self.modified = []
+    
+    @adapter(IObjectCreatedEvent)
+    def handleCreated(self, event):
+        if isinstance(event.object, OFS.Image.File):
+            self.created.append(event)
+    
+    @adapter(IObjectModifiedEvent)
+    def handleModified(self, event):
+        if isinstance(event.object, OFS.Image.File):
+            self.modified.append(event)
+
 class FileTests(unittest.TestCase):
     data = open(filedata, 'rb').read()
     content_type = 'application/octet-stream'
@@ -85,6 +125,8 @@
     def setUp( self ):
 
         self.connection = makeConnection()
+        self.eventCatcher = EventCatcher()
+        
         try:
             r = self.connection.root()
             a = Application()
@@ -107,7 +149,16 @@
             raise
         transaction.begin()
         self.file = getattr( self.app, 'file' )
-
+        
+        # Since we do the create here, let's test the events here too
+        self.assertEquals(1, len(self.eventCatcher.created))
+        self.failUnless(aq_base(self.eventCatcher.created[0].object) is aq_base(self.file))
+        
+        self.assertEquals(1, len(self.eventCatcher.modified))
+        self.failUnless(aq_base(self.eventCatcher.created[0].object) is aq_base(self.file))
+        
+        self.eventCatcher.reset()
+        
     def tearDown( self ):
         del self.file
         transaction.abort()
@@ -117,6 +168,8 @@
         del self.root
         del self.connection
         ADummyCache.clear()
+        
+        self.eventCatcher.tearDown()
 
     def testViewImageOrFile(self):
         self.assertRaises(Redirect, self.file.view_image_or_file, 'foo')
@@ -153,18 +206,24 @@
         self.assertEqual(self.file.content_type, 'text/plain')
         self.failUnless(ADummyCache.invalidated)
         self.failUnless(ADummyCache.set)
+        self.assertEquals(1, len(self.eventCatcher.modified))
+        self.failUnless(self.eventCatcher.modified[0].object is self.file)
 
     def testManageEditWithoutFileData(self):
         self.file.manage_edit('foobar', 'text/plain')
         self.assertEqual(self.file.title, 'foobar')
         self.assertEqual(self.file.content_type, 'text/plain')
         self.failUnless(ADummyCache.invalidated)
+        self.assertEquals(1, len(self.eventCatcher.modified))
+        self.failUnless(self.eventCatcher.modified[0].object is self.file)
 
     def testManageUpload(self):
         f = StringIO('jammyjohnson')
         self.file.manage_upload(f)
         self.assertEqual(self.file.data, 'jammyjohnson')
         self.assertEqual(self.file.content_type, 'application/octet-stream')
+        self.assertEquals(1, len(self.eventCatcher.modified))
+        self.failUnless(self.eventCatcher.modified[0].object is self.file)
 
     def testIfModSince(self):
         now = time.time()
@@ -302,3 +361,4 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
+

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProductInit.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProductInit.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProductInit.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProperties.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProperties.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testProperties.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testRanges.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testRanges.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testRanges.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002-2009 Zope Corporation and Contributors.
+# Copyright (c) 2002-2009 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -178,9 +178,8 @@
 
     def expectMultipleRanges(self, range, sets, draft=0):
         import cStringIO
-        from mimetools import Message
-        from multifile import MultiFile
         import re
+        import email
         rangeParse = re.compile('bytes\s*(\d+)-(\d+)/(\d+)')
         req = self.app.REQUEST
         rsp = req.RESPONSE
@@ -211,20 +210,16 @@
         # Decode the multipart message
         bodyfile = cStringIO.StringIO('Content-Type: %s\n\n%s' % (
             rsp.getHeader('content-type'), body))
-        bodymessage = Message(bodyfile)
-        partfiles = MultiFile(bodyfile)
-        partfiles.push(bodymessage.getparam('boundary'))
+        partmessages = [part
+                        for part in email.message_from_file(bodyfile).walk()]
 
-        partmessages = []
-        add = partmessages.append
-        while partfiles.next():
-            add(Message(cStringIO.StringIO(partfiles.read())))
-
         # Check the different parts
         returnedRanges = []
         add = returnedRanges.append
         for part in partmessages:
-            range = part['content-range']
+            if part.get_content_maintype() == 'multipart':
+                continue
+            range = part.get('content-range')
             start, end, size = rangeParse.search(range).groups()
             start, end, size = int(start), int(end), int(size)
             end = end + 1
@@ -233,13 +228,7 @@
                 'Part Content-Range header reported incorrect length. '
                 'Expected %d, got %d.' % (len(self.data), size))
 
-            part.rewindbody()
-            body = part.fp.read()
-            # Whotcha! Bug in MultiFile; the CRLF that is part of the boundary
-            # is returned as part of the body. Note that this bug is resolved
-            # in Python 2.2.
-            if body[-2:] == '\r\n':
-                body = body[:-2]
+            body = part.get_payload()
 
             self.failIf(len(body) != end - start,
                 'Part (%d, %d) is of wrong length, expected %d, got %d.' % (

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testSimpleItem.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testSimpleItem.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testSimpleItem.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -3,16 +3,68 @@
 
 class TestItem(unittest.TestCase):
 
-    def test_z3interfaces(self):
+    def _getTargetClass(self):
+        from OFS.SimpleItem import Item
+        return Item
+
+    def _makeOne(self, *args, **kw):
+        return self._getTargetClass()(*args, **kw)
+
+    def test_conforms_to_IItem(self):
         from OFS.interfaces import IItem
+        from zope.interface.verify import verifyClass
+
+        verifyClass(IItem, self._getTargetClass())
+
+    def test_conforms_to_IManageable(self):
         from OFS.interfaces import IManageable
-        from OFS.SimpleItem import Item
         from zope.interface.verify import verifyClass
 
-        verifyClass(IItem, Item)
-        verifyClass(IManageable, Item)
+        verifyClass(IManageable, self._getTargetClass())
 
+    def test_raise_StandardErrorMessage_str_errorValue(self):
+        class REQUEST(object):
+            class RESPONSE(object):
+                handle_errors = True
+        item = self._makeOne()
+        def _raise_during_standard_error_message(*args, **kw):
+            raise ZeroDivisionError('testing')
+        item.standard_error_message = _raise_during_standard_error_message
+        try:
+            item.raise_standardErrorMessage(
+                            error_type=OverflowError,
+                            error_value='simple',
+                            REQUEST=REQUEST(),
+                            )
+        except:
+            import sys
+            self.assertEqual(sys.exc_info()[0], OverflowError)
+            value = sys.exc_info()[1]
+            self.failUnless(value.message.startswith("'simple'"))
+            self.failUnless('full details: testing' in value.message)
 
+    def test_raise_StandardErrorMessage_TaintedString_errorValue(self):
+        from ZPublisher.TaintedString import TaintedString
+        class REQUEST(object):
+            class RESPONSE(object):
+                handle_errors = True
+        item = self._makeOne()
+        def _raise_during_standard_error_message(*args, **kw):
+            raise ZeroDivisionError('testing')
+        item.standard_error_message = _raise_during_standard_error_message
+        try:
+            item.raise_standardErrorMessage(
+                            error_type=OverflowError,
+                            error_value=TaintedString('<simple>'),
+                            REQUEST=REQUEST(),
+                            )
+        except:
+            import sys
+            self.assertEqual(sys.exc_info()[0], OverflowError)
+            value = sys.exc_info()[1]
+            self.failIf('<' in value.message)
+
+
 class TestItem_w__name__(unittest.TestCase):
 
     def test_z3interfaces(self):

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testTraverse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testTraverse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/testTraverse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_DTMLMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_DTMLMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_DTMLMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -14,7 +14,16 @@
         from webdav.interfaces import IWriteLock
         verifyClass(IWriteLock, self._getTargetClass())
 
+    def test_edit_taintedstring(self):
+        from ZPublisher.TaintedString import TaintedString
+        doc = self._makeOne()
+        self.assertEquals(doc.read(), '')
+        data = TaintedString('hello<br/>')
 
+        doc.manage_edit(data, 'title')
+        self.assertEquals(doc.read(), 'hello&lt;br/&gt;')
+
+
 class FactoryTests(unittest.TestCase):
 
     def test_defaults_no_standard_html_header(self):

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_Uninstalled.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_Uninstalled.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_Uninstalled.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_XMLExportImport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_XMLExportImport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/OFS/tests/test_XMLExportImport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,7 @@
+# -*- coding: iso8859-1 -*-
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.
@@ -16,8 +17,16 @@
 import transaction
 from StringIO import StringIO
 
-_LONG_DTML = '\n'.join([('<dtml-var foo%d' % x) for x in xrange(1000)])
+try:
+    here = os.path.dirname(os.path.abspath(__file__))
+except:
+    here = os.path.dirname(os.path.abspath(sys.argv[0]))
 
+imagedata = os.path.join(here, 'test.gif')
+xmldata = os.path.join(here, 'export.xml')
+
+_LONG_DTML = ''.join([('<dtml-var foo%d' % x) for x in xrange(1000)])
+
 class XMLExportImportTests(unittest.TestCase):
 
     def _makeJarAndRoot(self):
@@ -112,6 +121,75 @@
             # the block above.
             os.remove(path)
 
+    def test_exportXML(self):
+        from OFS.Folder import Folder
+        from OFS.Image import Image
+        from OFS.XMLExportImport import exportXML
+
+        connection, app = self._makeJarAndRoot()
+        data = open(imagedata, 'rb')
+
+        sub = Folder('sub')
+        app._setObject('sub', sub)
+        img = Image('image', '', data, 'image/gif')
+        sub._setObject('image', img)
+        img._setProperty('prop1', 3.14159265359, 'float')
+        img._setProperty('prop2', 1, 'int')
+        img._setProperty('prop3', 2L**31-1, 'long')
+        img._setProperty('prop4', 'xxx', 'string')
+        img._setProperty('prop5', ['xxx', 'zzz'], 'lines')
+        img._setProperty('prop6', u'xxx', 'unicode')
+        img._setProperty('prop7', [u'xxx', u'zzz'], 'ulines')
+        img._setProperty('prop8', '<&>', 'string')
+        img._setProperty('prop9', u'<&>', 'unicode')
+        img._setProperty('prop10', '<]]>', 'string')
+        img._setProperty('prop11', u'<]]>', 'unicode')
+        img._setProperty('prop12', u'£', 'unicode')
+        transaction.savepoint(optimistic=True)
+        oid = sub._p_oid
+
+        handle, path = tempfile.mkstemp(suffix='.xml')
+        try:
+            ostream = os.fdopen(handle,'wb')
+            data = exportXML(connection, oid, ostream)
+            ostream.close()
+        finally:
+            os.remove(path)
+
+    def test_importXML(self):
+        from OFS.XMLExportImport import importXML
+
+        connection, app = self._makeJarAndRoot()
+        newobj = importXML(connection, xmldata)
+        img = newobj._getOb('image')
+        data = open(imagedata, 'rb').read()
+
+        self.assertEqual(img.data, data)
+        self.assertEqual(repr(img.getProperty('prop1')),
+                         repr(3.14159265359))
+        self.assertEqual(repr(img.getProperty('prop2')),
+                         repr(1))
+        self.assertEqual(repr(img.getProperty('prop3')),
+                         repr(2L**31-1))
+        self.assertEqual(repr(img.getProperty('prop4')),
+                         repr('xxx'))
+        self.assertEqual(repr(img.getProperty('prop5')),
+                         repr(('xxx', 'zzz')))
+        self.assertEqual(repr(img.getProperty('prop6')),
+                         repr(u'xxx'))
+        self.assertEqual(repr(img.getProperty('prop7')),
+                         repr((u'xxx', u'zzz')))
+        self.assertEqual(repr(img.getProperty('prop8')),
+                         repr('<&>'))
+        self.assertEqual(repr(img.getProperty('prop9')),
+                         repr(u'<&>'))
+        self.assertEqual(repr(img.getProperty('prop10')),
+                         repr('<]]>'))
+        self.assertEqual(repr(img.getProperty('prop11')),
+                         repr(u'<]]>'))
+        self.assertEqual(repr(img.getProperty('prop12')),
+                         repr(u'£'))
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(XMLExportImportTests),

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/BTreeFolder2.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/BTreeFolder2.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/tests/testBTreeFolder2.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/tests/testBTreeFolder2.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/BTreeFolder2/tests/testBTreeFolder2.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/ExternalMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/ExternalMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/ExternalMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/help/ExternalMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/help/ExternalMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/help/ExternalMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/testExternalMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/testExternalMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ExternalMethod/tests/testExternalMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/TODO.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/TODO.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/TODO.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -32,8 +32,6 @@
 v1.4
 ----
 
-- namedtemplate in Five.formlib?
-
 - l10n (philikon)
 
 - Figure out where add-view redirects should go.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/bbb.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/bbb.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/bbb.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/absoluteurl.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/absoluteurl.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/absoluteurl.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -62,7 +62,7 @@
     def _getContextName(self, context):
         if getattr(context, 'getId', None) is not None:
             return context.getId()
-        getattr(context, '__name__', None)
+        return getattr(context, '__name__', None)
 
     def breadcrumbs(self):
         context = self.context

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/adding.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/adding.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/adding.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002-2005 Zope Corporation and Contributors.
+# Copyright (c) 2002-2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/decode.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/decode.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/decode.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -32,23 +32,40 @@
             pass
     return text
 
+def processInputValue(value, charsets):
+    """Recursively look for values (e.g. elements of lists, tuples or dicts)
+    and attempt to decode.
+    """
+    
+    if isinstance(value, list):
+        return [processInputValue(v, charsets) for v in value]
+    elif isinstance(value, tuple):
+        return tuple([processInputValue(v, charsets) for v in value])
+    elif isinstance(value, dict):
+        for k, v in value.items():
+            value[k] = processInputValue(v, charsets)
+        return value
+    elif isinstance(value, str):
+        return _decode(value, charsets)
+    else:
+        return value
+
 def processInputs(request, charsets=None):
+    """Process the values in request.form to decode strings to unicode, using
+    the passed-in list of charsets. If none are passed in, look up the user's
+    preferred charsets. The default is to use utf-8.
+    """
+    
     if charsets is None:
-        envadapter = IUserPreferredCharsets(request)
-        charsets = envadapter.getPreferredCharsets() or ['utf-8']
-
+        envadapter = IUserPreferredCharsets(request, None)
+        if envadapter is None:
+            charsets = ['utf-8']
+        else:
+            charsets = envadapter.getPreferredCharsets() or ['utf-8']
+    
     for name, value in request.form.items():
         if not (isCGI_NAME(name) or name.startswith('HTTP_')):
-            if isinstance(value, str):
-                request.form[name] = _decode(value, charsets)
-            elif isinstance(value, list):
-                request.form[name] = [ _decode(val, charsets)
-                                       for val in value
-                                       if isinstance(val, str) ]
-            elif isinstance(value, tuple):
-                request.form[name] = tuple([ _decode(val, charsets)
-                                             for val in value
-                                             if isinstance(val, str) ])
+            request.form[name] = processInputValue(value, charsets)
 
 def setPageEncoding(request):
     """Set the encoding of the form page via the Content-Type header.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/menu.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/menu.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/menu.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -230,7 +230,7 @@
                 if view is not None:
                     return view
 
-                raise NotFoundError(self, name, request)
+                raise NotFound(self, name, request)
 
         cdict['publishTraverse'] = publishTraverse
 
@@ -421,6 +421,8 @@
         raise NotFound(self, name, request)
 
     def __getitem__(self, name):
+        if name == 'macros':
+            return self.index.macros
         return self.index.macros[name]
 
     def __call__(self, *args, **kw):

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/pagetemplatefile.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/pagetemplatefile.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/pagetemplatefile.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/resource.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/resource.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/resource.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -27,6 +27,7 @@
 from zope.app.publisher.fileresource import File, Image
 from zope.app.publisher.pagetemplateresource import PageTemplate
 
+from Acquisition import aq_base
 from Products.Five.browser import BrowserView
 
 
@@ -131,6 +132,7 @@
         'pt':   PageTemplateResourceFactory,
         'zpt':  PageTemplateResourceFactory,
         'html': PageTemplateResourceFactory,
+        'htm':  PageTemplateResourceFactory,
         }
 
     default_factory = FileResourceFactory
@@ -161,6 +163,12 @@
         resource = factory(name, filename)(self.request)
         resource.__name__ = name
         resource.__parent__ = self
+        
+        # We need to propagate security so that restrictedTraverse() will
+        # work
+        if hasattr(aq_base(self), '__roles__'):
+            resource.__roles__ = self.__roles__
+        
         return resource
 
 class DirectoryResourceFactory(ResourceFactory):

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/aqlegacy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/aqlegacy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/aqlegacy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/classes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/classes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/classes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/i18n.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/i18n.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/i18n.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -258,7 +258,7 @@
 
   >>> protected_view_names = [
   ...     'eagle.txt', 'falcon.html', 'owl.html', 'flamingo.html',
-  ...     'condor.html', 'protectededitform.html']
+  ...     'condor.html']
   >>> 
   >>> public_view_names = [
   ...     'public_attribute_page',

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.zcml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.zcml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages.zcml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -232,16 +232,7 @@
       class=".pages.SimpleView"
       permission="zope2.Public"
       />
-      
-  <!-- XXX this should really be in Five.form.tests -->
 
-  <!-- protected edit form for permission check -->
-  <browser:editform
-      schema="Products.Five.tests.testing.simplecontent.ISimpleContent"
-      name="protectededitform.html"
-      permission="zope2.ViewManagementScreens"
-      />
-
   <!-- stuff that we'll override in overrides.zcml -->
   <browser:page
       for="Products.Five.tests.testing.simplecontent.ISimpleContent"

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages_ftest.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages_ftest.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/pages_ftest.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -60,7 +60,7 @@
 
   >>> protected_view_names = [
   ...     'eagle.txt', 'falcon.html', 'owl.html', 'flamingo.html',
-  ...     'condor.html', 'protectededitform.html']
+  ...     'condor.html']
   >>> 
   >>> public_view_names = [
   ...     'public_attribute_page',

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -69,7 +69,6 @@
   ...     if not isinstance(resource, PageTemplateResource):
   ...         self.assertEquals(resource(), base_url % r)
 
-
 Security
 --------
 
@@ -108,7 +107,15 @@
   ...     path = base % resource
   ...     checkRestricted(self.folder, 'context.restrictedTraverse("%s")' % path)
 
+Let's make sure restrictedTraverse() works directly, too. It used to get
+tripped up on subdirectories due to missing security declarations.
 
+  >>> self.folder.restrictedTraverse('++resource++fivetest_resources/resource.txt') is not None
+  True
+  
+  >>> self.folder.restrictedTraverse('++resource++fivetest_resources/resource_subdir/resource.txt') is not None
+  True
+
 Clean up
 --------
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_ftest.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_ftest.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_ftest.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -92,6 +92,21 @@
   ...     response = self.publish(base_url % r, basic='manager:r00t')
   ...     self.assertEquals(200, response.getStatus())
 
+  >>> print http(r'''
+  ... GET /test_folder_1_/testoid/++resource++fivetest_resources/resource_subdir/resource.htm HTTP/1.1
+  ... Authorization: Basic manager:r00t
+  ... ''')
+  HTTP/1.1 200 OK
+  ...
+  <html>
+      <head>
+      </head>
+      <body>
+          This .html should not have a base tag automatically
+          added to the header.
+      </body>
+  </html>
+  <BLANKLINE>
 
 We also can traverse into sub-directories:
 

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_subdir/resource.htm (from rev 112805, Zope/branches/2.12/src/Products/Five/browser/tests/resource_subdir/resource.htm)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_subdir/resource.htm	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/resource_subdir/resource.htm	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,8 @@
+<html>
+    <head>
+    </head>
+    <body>
+        This .html should not have a base tag automatically
+        added to the header.
+    </body>
+</html>

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/skin.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/skin.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/skin.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_absoluteurl.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_absoluteurl.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_absoluteurl.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_adding.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_adding.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_adding.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_decode.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_decode.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_decode.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -46,8 +46,44 @@
       >>> processInputs(request, charsets)
       >>> request.form['foo'] == (u'f\xf6\xf6',)
       True
+     
+    Ints in lists are not lost::
+
+      >>> request.form['foo'] = [1, 2, 3]
+      >>> processInputs(request, charsets)
+      >>> request.form['foo'] == [1, 2, 3]
+      True
+    
+    Ints in tuples are not lost::
+
+      >>> request.form['foo'] = (1, 2, 3,)
+      >>> processInputs(request, charsets)
+      >>> request.form['foo'] == (1, 2, 3)
+      True
+    
+    Mixed lists work:
+
+      >>> request.form['foo'] = [u'f\xf6\xf6'.encode('iso-8859-1'), 2, 3]
+      >>> processInputs(request, charsets)
+      >>> request.form['foo'] == [u'f\xf6\xf6', 2, 3]
+      True
+    
+    Mixed dicts work:
+    
+      >>> request.form['foo'] = {'foo': u'f\xf6\xf6'.encode('iso-8859-1'), 'bar': 2}
+      >>> processInputs(request, charsets)
+      >>> request.form['foo'] == {'foo': u'f\xf6\xf6', 'bar': 2}
+      True
+    
+    Deep recursion works:
+    
+      >>> request.form['foo'] = [{'foo': u'f\xf6\xf6'.encode('iso-8859-1'), 'bar': 2}, {'foo': u"one", 'bar': 3}]
+      >>> processInputs(request, charsets)
+      >>> request.form['foo'] == [{'foo': u'f\xf6\xf6', 'bar': 2}, {'foo': u"one", 'bar': 3}]
+      True
+    
     """
 
 def test_suite():
-    from zope.testing.doctest import DocTestSuite
+    from doctest import DocTestSuite
     return DocTestSuite()

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_defaultview.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_defaultview.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_defaultview.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_i18n.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_i18n.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_i18n.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -86,5 +86,5 @@
 
 def test_suite():
     from Testing.ZopeTestCase import FunctionalDocTestSuite
-    from zope.testing.doctest import ELLIPSIS
+    from doctest import ELLIPSIS
     return FunctionalDocTestSuite(optionflags=ELLIPSIS)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_menu.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_menu.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_menu.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -41,6 +41,12 @@
         index.macros = {}
         index.macros['aaa'] = aaa = object()
         self.failUnless(view['aaa'] is aaa)
+    
+    def test__getitem__gives_shortcut_to_index_macros(self):
+        view = self._makeOne()
+        view.index = index = DummyTemplate()
+        index.macros = {}
+        self.failUnless(view['macros'] is index.macros)
 
     def test___call___no_args_no_kw(self):
         view = self._makeOne()
@@ -63,7 +69,7 @@
         self.failUnless(result is index)
         self.assertEqual(index._called_with, ((), {'foo': 'bar'}))
 
-    def test___call___no_args_no_kw(self):
+    def test___call___w_args_w_kw(self):
         view = self._makeOne()
         view.index = index = DummyTemplate()
         result = view('abc', foo='bar')

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pages.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pages.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pages.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pagetemplatefile.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pagetemplatefile.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_pagetemplatefile.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -37,13 +37,13 @@
         from zope.tales.expressions import DeferExpr
         from zope.tales.expressions import NotExpr
         from zope.tales.expressions import PathExpr
-        from zope.tales.expressions import StringExpr
         from zope.tales.expressions import Undefs
         from zope.tales.pythonexpr import PythonExpr
         from zope.contentprovider.tales import TALESProviderExpression
         from Products.PageTemplates.DeferExpr import LazyExpr
         from Products.PageTemplates.Expressions import TrustedZopePathExpr
         from Products.PageTemplates.Expressions import SecureModuleImporter
+        from Products.PageTemplates.Expressions import UnicodeAwareStringExpr
 
         vptf = self._makeOne('seagull.pt')
         engine = vptf.pt_getEngine()
@@ -51,7 +51,7 @@
         self.assertEqual(engine.types['path'], TrustedZopePathExpr)
         self.assertEqual(engine.types['exists'], TrustedZopePathExpr)
         self.assertEqual(engine.types['nocall'], TrustedZopePathExpr)
-        self.assertEqual(engine.types['string'], StringExpr)
+        self.assertEqual(engine.types['string'], UnicodeAwareStringExpr)
         self.assertEqual(engine.types['python'], PythonExpr)
         self.assertEqual(engine.types['not'], NotExpr)
         self.assertEqual(engine.types['defer'], DeferExpr)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_provider.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_provider.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_provider.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_recurse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_recurse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_recurse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_resource.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_resource.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_resource.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_skin.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_skin.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_skin.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_traversable.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_traversable.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_traversable.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_zope3security.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_zope3security.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/browser/tests/test_zope3security.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -55,5 +55,5 @@
 
 def test_suite():
     from Testing.ZopeTestCase import FunctionalDocTestSuite
-    from zope.testing.doctest import ELLIPSIS
+    from doctest import ELLIPSIS
     return FunctionalDocTestSuite(optionflags=ELLIPSIS)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/browser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/browser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/browser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/tests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/tests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/component/tests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -16,7 +16,7 @@
 $Id$
 """
 import unittest
-from zope.testing.doctestunit import DocFileSuite
+from doctest import DocFileSuite
 from Testing.ZopeTestCase import FunctionalDocFileSuite
 
 __docformat__ = "reStructuredText"

Deleted: Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/formlib.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/formlib.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/formlib.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,18 +0,0 @@
-============================
-zope.formlib support in Five
-============================
-
-Five supports zope.formlib, an alternative for constructing add, edit, and
-other forms based on schema. See zope/formlib/form.txt for a thorough
-description of the functionality provided by formlib.
-
-Formlib forms are normal view classes, registered as browser pages. Where
-in a pure Zope-3 context you would derive from one of the zope.formlib.form
-baseclasses, you now need to derive from one of the baseclasses provided by
-Products.Five.formlib.formbase.
-
-In almost all cases you need to import from zope.formlib.from as well -
-e.g. Fields and Actions in order to define and select fields and to add
-actions to your form.
-
-See Products.Five.formlib.tests for a minimal example.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/FiveMiscTutorial/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/FiveMiscTutorial/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/FiveMiscTutorial/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/module.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/module.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/module.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/other.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/other.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/doc/products/InterfaceTutorial/other.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/eventconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/eventconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/eventconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/fiveconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/fiveconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/fiveconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/fivedirectives.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/fivedirectives.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/fivedirectives.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,231 +1,3 @@
-##############################################################################
-#
-# Copyright (c) 2004, 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.
-#
-##############################################################################
-"""Add and edit views
-
-$Id$
-"""
-import sys
-from datetime import datetime
-
-import transaction
-from zope.event import notify
-from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
-from zope.lifecycleevent import Attributes
-from zope.location.interfaces import ILocation
-from zope.location import LocationProxy
-from zope.schema.interfaces import ValidationError
-from zope.i18nmessageid import MessageFactory
-_ = MessageFactory('zope')
-
-from zope.app.form.browser.submit import Update
-from zope.app.form.interfaces import IInputWidget
-from zope.app.form.interfaces import WidgetsError
-from zope.app.form.utility import setUpEditWidgets, applyWidgetsChanges
-from zope.app.form.utility import setUpWidgets, getWidgetsData
-
-from Products.Five.browser import BrowserView
-from Products.Five.browser.decode import processInputs, setPageEncoding
-from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
-
-class EditView(BrowserView):
-    """Simple edit-view base class
-
-    Subclasses should provide a schema attribute defining the schema
-    to be edited.
-    """
-
-    errors = ()
-    update_status = None
-    label = ''
-    charsets = None
-
-    # Fall-back field names computes from schema
-    fieldNames = property(lambda self: getFieldNamesInOrder(self.schema))
-    # Fall-back template
-    generated_form = ZopeTwoPageTemplateFile('edit.pt')
-
-    def __init__(self, context, request):
-        BrowserView.__init__(self, context, request)
-        processInputs(self.request, self.charsets)
-        setPageEncoding(self.request)
-        self._setUpWidgets()
-
-    def _setUpWidgets(self):
-        adapted = self.schema(self.context)
-        if adapted is not self.context:
-            if not ILocation.providedBy(adapted):
-                adapted = LocationProxy(adapted)
-            adapted.__parent__ = self.context
-        self.adapted = adapted
-        setUpEditWidgets(self, self.schema, source=self.adapted,
-                         names=self.fieldNames)
-
-    def setPrefix(self, prefix):
-        for widget in self.widgets():
-            widget.setPrefix(prefix)
-
-    def widgets(self):
-        return [getattr(self, name+'_widget')
-                for name in self.fieldNames]
-
-    def changed(self):
-        # This method is overridden to execute logic *after* changes
-        # have been made.
-        pass
-
-    def update(self):
-        if self.update_status is not None:
-            # We've been called before. Just return the status we previously
-            # computed.
-            return self.update_status
-
-        status = ''
-
-        content = self.adapted
-
-        if Update in self.request.form.keys():
-            changed = False
-            try:
-                changed = applyWidgetsChanges(self, self.schema,
-                    target=content, names=self.fieldNames)
-                # We should not generate events when an adapter is used.
-                # That's the adapter's job.  We need to unwrap the objects to
-                # compare them, as they are wrapped differently.
-                # Additionally, we can't use Acquisition.aq_base() because
-                # it strangely returns different objects for these two even
-                # when they are identical.  In particular
-                # aq_base(self.adapted) != self.adapted.aq_base :-(
-                if changed and getattr(self.context, 'aq_base', self.context)\
-                            is getattr(self.adapted, 'aq_base', self.adapted):
-                    description = Attributes(self.schema, *self.fieldNames)
-                    notify(ObjectModifiedEvent(content, description))
-            except WidgetsError, errors:
-                self.errors = errors
-                status = _("An error occurred.")
-                transaction.abort()
-            else:
-                setUpEditWidgets(self, self.schema, source=self.adapted,
-                                 ignoreStickyValues=True,
-                                 names=self.fieldNames)
-                if changed:
-                    self.changed()
-                    formatter = self.request.locale.dates.getFormatter(
-                       'dateTime', 'medium')
-                    status = _("Updated on ${date_time}",
-                              mapping={'date_time':
-                                       formatter.format(datetime.utcnow())})
-
-        self.update_status = status
-        return status
-
-class AddView(EditView):
-    """Simple edit-view base class.
-
-    Subclasses should provide a schema attribute defining the schema
-    to be edited.
-    """
-
-    def _setUpWidgets(self):
-        setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
-
-    def update(self):
-        if self.update_status is not None:
-            # We've been called before. Just return the previous result.
-            return self.update_status
-
-        if self.request.form.has_key(Update):
-
-            self.update_status = ''
-            try:
-                data = getWidgetsData(self, self.schema, names=self.fieldNames)
-                self.createAndAdd(data)
-            except WidgetsError, errors:
-                self.errors = errors
-                self.update_status = _("An error occurred.")
-                return self.update_status
-
-            self.request.response.redirect(self.nextURL())
-
-        return self.update_status
-
-    def create(self, *args, **kw):
-        """Do the actual instantiation."""
-        # hack to please typical Zope 2 factories, which expect id and title
-        # Any sane schema will use a unicode title, and may fail on a
-        # non-unicode one.
-        args = ('tmp_id', u'Temporary title') + args
-        return self._factory(*args, **kw)
-
-    def createAndAdd(self, data):
-        """Add the desired object using the data in the data argument.
-
-        The data argument is a dictionary with the data entered in the form.
-        """
-
-        args = []
-        if self._arguments:
-            for name in self._arguments:
-                args.append(data[name])
-
-        kw = {}
-        if self._keyword_arguments:
-            for name in self._keyword_arguments:
-                if name in data:
-                    kw[str(name)] = data[name]
-
-        content = self.create(*args, **kw)
-        adapted = self.schema(content)
-
-        errors = []
-
-        if self._set_before_add:
-            for name in self._set_before_add:
-                if name in data:
-                    field = self.schema[name]
-                    try:
-                        field.set(adapted, data[name])
-                    except ValidationError:
-                        errors.append(sys.exc_info()[1])
-
-        if errors:
-            raise WidgetsError(*errors)
-
-        notify(ObjectCreatedEvent(content))
-
-        content = self.add(content)
-        adapted = self.schema(content)
-
-        if self._set_after_add:
-            for name in self._set_after_add:
-                if name in data:
-                    field = self.schema[name]
-                    try:
-                        field.set(adapted, data[name])
-                    except ValidationError:
-                        errors.append(sys.exc_info()[1])
-            # We have modified the object, so we need to publish an
-            # object-modified event:
-            description = Attributes(self.schema, *self._set_after_add)
-            notify(ObjectModifiedEvent(content, description))
-
-        if errors:
-            raise WidgetsError(*errors)
-
-        return content
-
-    def add(self, content):
-        return self.context.add(content)
-
-    def nextURL(self):
-        return self.context.nextURL()
+# BBB
+from five.formlib import AddView
+from five.formlib import EditView

Deleted: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/add.pt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/add.pt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/add.pt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,74 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page"
-    i18n:domain="zope">
-  <body>
-  <div metal:fill-slot="body">
-
-  <div metal:define-macro="addform">
-
-    <form action="." tal:attributes="action request/URL" method="post"
-          enctype="multipart/form-data">
-
-      <div metal:define-macro="formbody">
-
-        <h3 tal:condition="view/label"
-            tal:content="view/label"
-            metal:define-slot="heading"
-            >Add something</h3>
-
-        <p tal:define="status view/update"
-           tal:condition="status"
-           tal:content="status" />
-
-        <p tal:condition="view/errors" i18n:translate="">
-          There are <strong tal:content="python:len(view.errors)"
-                            i18n:name="num_errors">6</strong> input errors.
-        </p>
-
-        <div metal:define-slot="extra_info" tal:replace="nothing">
-        </div>
-
-        <div class="row" metal:define-slot="extra_top" tal:replace="nothing">
-            <div class="label">Extra top</div>
-            <div class="label"><input type="text" style="width:100%" /></div>
-        </div>
-
-        <div metal:use-macro="context/@@form_macros/widget_rows" />
-
-        <div class="separator"></div>
-
-        <div class="row"
-            metal:define-slot="extra_bottom" tal:replace="nothing">
-          <div class="label">Extra bottom</div>
-          <div class="field"><input type="text" style="width:100%" /></div>
-        </div>
-
-        <div class="separator"></div>
-
-      </div>
-      <br/><br/>
-      <div class="row">
-        <div class="controls"><hr />
-          <input type='submit' value='Refresh'
-                 i18n:attributes='value refresh-button' />
-          <input type='submit' value='Add' name='UPDATE_SUBMIT'
-                 i18n:attributes='value add-button' />
-          <span tal:condition="context/nameAllowed|nothing" tal:omit-tag="">
-               &nbsp;&nbsp;<b i18n:translate="">Object Name</b>&nbsp;&nbsp;
-              <input type='text' name='add_input_name'
-                     tal:attributes="value context/contentName" />
-          </span>
-        </div>
-      </div>
-
-      <div class="row" metal:define-slot="extra_buttons" tal:replace="nothing">
-      </div>
-
-      <div class="separator"></div>
-    </form>
-  </div>
-
-  </div>
-  </body>
-
-</html>
-

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/configure.zcml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/configure.zcml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/configure.zcml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,14 +1,5 @@
-<configure xmlns="http://namespaces.zope.org/zope"
-           xmlns:browser="http://namespaces.zope.org/browser">
+<configure xmlns="http://namespaces.zope.org/zope">
 
-  <include package="zope.app.form.browser" />
+  <include package="five.formlib" />
 
-  <browser:page
-      for="*"
-      name="form_macros"
-      permission="zope2.View"
-      class=".macros.FormMacros"
-      allowed_interface="zope.interface.common.mapping.IItemMapping"
-      />
-
 </configure>
\ No newline at end of file

Deleted: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/edit.pt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/edit.pt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/edit.pt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,69 +0,0 @@
-<tal:tag condition="view/update"/>
-<html metal:use-macro="context/@@standard_macros/view"
-    i18n:domain="zope">
-  <body>
-  <div metal:fill-slot="body">
-
-  <div metal:define-macro="body">
-
-    <form action="." tal:attributes="action request/URL" method="POST"
-          enctype="multipart/form-data">
-
-      <div metal:define-macro="formbody">
-
-        <h3 tal:condition="view/label"
-            tal:content="view/label"
-            metal:define-slot="heading"
-            >Edit something</h3>
-
-        <p tal:define="status view/update"
-           tal:condition="status"
-           tal:content="status" />
-
-        <p tal:condition="view/errors" i18n:translate="">
-          There are <strong tal:content="python:len(view.errors)"
-                            i18n:name="num_errors">6</strong> input errors.
-        </p>
-
-        <div metal:define-slot="extra_info" tal:replace="nothing">
-        </div>
-
-        <div class="row"
-             metal:define-slot="extra_top" tal:replace="nothing">
-          <div class="label">Extra top</div>
-          <div class="field"><input type="text" style="width:100%" /></div>
-        </div>
-        
-        <div metal:use-macro="context/@@form_macros/widget_rows" />
-        
-        <div class="separator"></div>
-        
-        <div class="row"
-             metal:define-slot="extra_bottom" tal:replace="nothing">
-          <div class="label">Extra bottom</div>
-          <div class="field"><input type="text" style="width:100%" /></div>
-        </div>
-        <div class="separator"></div>
-      </div>
-
-      <div class="row">
-        <div class="controls">
-          <input type="submit" value="Refresh" 
-              i18n:attributes="value refresh-button" />
-          <input type="submit" name="UPDATE_SUBMIT" value="Change" 
-              i18n:attributes="value submit-button"/>
-        </div>
-      </div>
-      <div class="row" metal:define-slot="extra_buttons" tal:replace="nothing">
-      </div>
-
-      <div class="separator"></div>
-
-    </form>
-
-  </div>
-
-  </div>
-  </body>
-
-</html>

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/macros.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/macros.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/macros.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,22 +1,2 @@
-##############################################################################
-#
-# Copyright (c) 2004, 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.
-#
-##############################################################################
-"""Form macros
-
-$Id$
-"""
-from Products.Five.skin.standardmacros import StandardMacros
-
-# copy of zope.app.form.browser.macros.FormMacros
-class FormMacros(StandardMacros):    
-    macro_pages = ('widget_macros', 'addform_macros')
+# BBB
+from five.formlib.macros import FormMacros

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/meta.zcml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/meta.zcml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/meta.zcml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,35 +1,5 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:meta="http://namespaces.zope.org/meta">
+<configure xmlns="http://namespaces.zope.org/zope">
 
-  <meta:directives namespace="http://namespaces.zope.org/browser">
+  <include package="five.formlib" file="meta.zcml" />
 
-    <meta:complexDirective
-        name="editform"
-        schema="zope.app.form.browser.metadirectives.IEditFormDirective"
-        handler=".metaconfigure.EditFormDirective"
-        >
-
-      <meta:subdirective
-          name="widget"
-          schema="zope.app.form.browser.metadirectives.IWidgetSubdirective"
-          />
-
-    </meta:complexDirective>
-
-    <meta:complexDirective
-        name="addform"
-        schema="zope.app.form.browser.metadirectives.IAddFormDirective"
-        handler=".metaconfigure.AddFormDirective"
-        >
-
-      <meta:subdirective
-          name="widget"
-          schema="zope.app.form.browser.metadirectives.IWidgetSubdirective"
-          />
-
-    </meta:complexDirective>
-
-  </meta:directives>
-
 </configure>

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,218 +1,6 @@
-##############################################################################
-#
-# Copyright (c) 2004, 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.
-#
-##############################################################################
-"""Edit form directives
-
-$Id$
-"""
-from App.class_init import InitializeClass
-from ExtensionClass import Base
-
-import zope.component
-from zope.interface import Interface
-from zope.i18nmessageid import MessageFactory
-_ = MessageFactory('zope')
-
-from zope.app.publisher.browser.menumeta import menuItemDirective
-from zope.app.form.browser.metaconfigure import BaseFormDirective
-from zope.browser.interfaces import IAdding
-
-from Products.Five.form import EditView, AddView
-from Products.Five.metaclass import makeClass
-from Products.Five.security import protectClass
-from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
-from Products.Five.browser.metaconfigure import makeClassForTemplate
-
-def EditViewFactory(name, schema, label, permission, layer,
-                    template, default_template, bases, for_, fields,
-                    fulledit_path=None, fulledit_label=None, menu=u''):
-    class_ = makeClassForTemplate(template, globals(), used_for=schema,
-                                  bases=bases)
-    class_.schema = schema
-    class_.label = label
-    class_.fieldNames = fields
-
-    class_.fulledit_path = fulledit_path
-    if fulledit_path and (fulledit_label is None):
-        fulledit_label = "Full edit"
-
-    class_.fulledit_label = fulledit_label
-
-    class_.generated_form = ZopeTwoPageTemplateFile(default_template)
-
-    if layer is None:
-        layer = IDefaultBrowserLayer
-
-    s = zope.component.getGlobalSiteManager()
-    s.registerAdapter(class_, (for_, layer), Interface, name)
-
-    # Reminder: the permission we got has already been processed by
-    # BaseFormDirective, that means that zope.Public has been
-    # translated to the CheckerPublic object
-    protectClass(class_, permission)
-    InitializeClass(class_)
-
-class FiveFormDirective(BaseFormDirective):
-
-    def _processWidgets(self):
-        if self._widgets:
-            customWidgetsObject = makeClass(
-                'CustomWidgetsMixin', (Base,), self._widgets)
-            self.bases = self.bases + (customWidgetsObject,)
-
-class EditFormDirective(FiveFormDirective):
-
-    view = EditView
-    default_template = 'edit.pt'
-    title = _('Edit')
-
-    def _handle_menu(self):
-        if self.menu:
-            menuItemDirective(
-                self._context, self.menu, self.for_ or self.schema,
-                '@@' + self.name, self.title, permission=self.permission,
-                layer=self.layer)
-
-    def __call__(self):
-        self._processWidgets()
-        self._handle_menu()
-        self._context.action(
-            discriminator=self._discriminator(),
-            callable=EditViewFactory,
-            args=self._args(),
-            kw={'menu': self.menu},
-        )
-
-
-def AddViewFactory(name, schema, label, permission, layer,
-                   template, default_template, bases, for_,
-                   fields, content_factory, arguments,
-                   keyword_arguments, set_before_add, set_after_add,
-                   menu=u''):
-    class_ = makeClassForTemplate(template, globals(), used_for=schema,
-                                  bases=bases)
-
-    class_.schema = schema
-    class_.label = label
-    class_.fieldNames = fields
-    class_._factory = content_factory
-    class_._arguments = arguments
-    class_._keyword_arguments = keyword_arguments
-    class_._set_before_add = set_before_add
-    class_._set_after_add = set_after_add
-
-    class_.generated_form = ZopeTwoPageTemplateFile(default_template)
-
-    if layer is None:
-        layer = IDefaultBrowserLayer
-
-    s = zope.component.getGlobalSiteManager()
-    s.registerAdapter(class_, (for_, layer), Interface, name)
-
-    # Reminder: the permission we got has already been processed by
-    # BaseFormDirective, that means that zope.Public has been
-    # translated to the CheckerPublic object
-    protectClass(class_, permission)
-    InitializeClass(class_)
-
-class AddFormDirective(FiveFormDirective):
-
-    view = AddView
-    default_template = 'add.pt'
-    for_ = IAdding
-
-    # default add form information
-    description = None
-    content_factory = None
-    arguments = None
-    keyword_arguments = None
-    set_before_add = None
-    set_after_add = None
-
-    def _handle_menu(self):
-        if self.menu or self.title:
-            if (not self.menu) or (not self.title):
-                raise ValueError("If either menu or title are specified, "
-                                 "they must both be specified")
-            # Add forms are really for IAdding components, so do not use
-            # for=self.schema.
-            menuItemDirective(
-                self._context, self.menu, self.for_, '@@' + self.name,
-                self.title, permission=self.permission, layer=self.layer,
-                description=self.description)
-
-    def _handle_arguments(self, leftover=None):
-        schema = self.schema
-        fields = self.fields
-        arguments = self.arguments
-        keyword_arguments = self.keyword_arguments
-        set_before_add = self.set_before_add
-        set_after_add = self.set_after_add
-
-        if leftover is None:
-            leftover = fields
-
-        if arguments:
-            missing = [n for n in arguments if n not in fields]
-            if missing:
-                raise ValueError("Some arguments are not included in the form",
-                                 missing)
-            optional = [n for n in arguments if not schema[n].required]
-            if optional:
-                raise ValueError("Some arguments are optional, use"
-                                 " keyword_arguments for them",
-                                 optional)
-            leftover = [n for n in leftover if n not in arguments]
-
-        if keyword_arguments:
-            missing = [n for n in keyword_arguments if n not in fields]
-            if missing:
-                raise ValueError(
-                    "Some keyword_arguments are not included in the form",
-                    missing)
-            leftover = [n for n in leftover if n not in keyword_arguments]
-
-        if set_before_add:
-            missing = [n for n in set_before_add if n not in fields]
-            if missing:
-                raise ValueError(
-                    "Some set_before_add are not included in the form",
-                    missing)
-            leftover = [n for n in leftover if n not in set_before_add]
-
-        if set_after_add:
-            missing = [n for n in set_after_add if n not in fields]
-            if missing:
-                raise ValueError(
-                    "Some set_after_add are not included in the form",
-                    missing)
-            leftover = [n for n in leftover if n not in set_after_add]
-
-            self.set_after_add += leftover
-
-        else:
-            self.set_after_add = leftover
-
-    def __call__(self):
-        self._processWidgets()
-        self._handle_menu()
-        self._handle_arguments()
-
-        self._context.action(
-            discriminator=self._discriminator(),
-            callable=AddViewFactory,
-            args=self._args()+(self.content_factory, self.arguments,
-                                 self.keyword_arguments,
-                                 self.set_before_add, self.set_after_add),
-            kw={'menu': self.menu},
-            )
+# BBB
+from five.formlib.metaconfigure import EditViewFactory
+from five.formlib.metaconfigure import FiveFormDirective
+from five.formlib.metaconfigure import EditFormDirective
+from five.formlib.metaconfigure import AddViewFactory
+from five.formlib.metaconfigure import AddFormDirective

Deleted: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.pt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.pt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.pt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,15 +0,0 @@
-<fieldset>
-  <legend tal:content="context/legendTitle"
-        i18n:translate="">The Legend</legend>
-  <div class="row" tal:repeat="widget context/subwidgets">
-    <tal:comment condition="nothing">
-      This is why we have to duplicate this template: we want to look
-      up the @@form_macros browser page from something that's
-      definitely five:traversable (it doesn't really matter where we
-      look it up, just *that* we look it up); we know the object we're
-      editing is five:traversable, so we just use that.  Yes, three
-      times context.  Weird, eh?
-    </tal:comment>
-    <metal:block use-macro="context/context/context/@@form_macros/widget_row" />
-  </div>
-</fieldset>

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/form/objectwidget.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,53 +1,4 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Five-compatible version of ObjectWidget
-
-This is needed because ObjectWidget uses ViewPageTemplateFile whose
-macro definition is unfortunately incompatible with ZopeTwoPageTemplateFile.
-So this subclass uses ZopeTwoPageTemplateFile for the template that renders
-the widget's sub-editform.
-
-$Id$
-"""
-from AccessControl.SecurityInfo import ClassSecurityInfo
-from App.class_init import InitializeClass
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-from zope.app.form.browser.objectwidget import ObjectWidget as OWBase
-from zope.app.form.browser.objectwidget import ObjectWidgetView as OWVBase
-
-class ObjectWidgetView(OWVBase):
-    security = ClassSecurityInfo()
-    security.declareObjectPublic()
-
-    template = ViewPageTemplateFile('objectwidget.pt')
-
-InitializeClass(ObjectWidgetView)
-
-class ObjectWidgetClass(OWBase):
-
-    def setRenderedValue(self, value):
-        """Slightly more robust re-implementation this method."""
-        # re-call setupwidgets with the content
-        self._setUpEditWidgets()
-        for name in self.names:
-            val = getattr(value, name, None)
-            if val is None:
-                # this is where we are more robust than Zope 3.2's
-                # object widget: we supply subwidgets with the default
-                # from the schema, not None (Zope 3.2's list widget
-                # breaks when the rendered value is None)
-                val = self.context.schema[name].default
-            self.getSubWidget(name).setRenderedValue(val)
-
-ObjectWidget = ObjectWidgetClass
+# BBB
+from five.formlib.objectwidget import ObjectWidgetView
+from five.formlib.objectwidget import ObjectWidget
+from five.formlib.objectwidget import ObjectWidgetClass

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1 +1 @@
-# package
\ No newline at end of file
+# BBB
\ No newline at end of file

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/configure.zcml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/configure.zcml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/configure.zcml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,19 +1,5 @@
-<configure
-    package="zope.formlib"
-    xmlns="http://namespaces.zope.org/zope"
-    i18n_domain="zope">
+<configure xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".form.render_submit_button"
-      name="render"
-      />
+  <include package="five.formlib" />
 
-  <!-- Error view for 'Invalid' -->
-  <adapter
-      for="zope.interface.Invalid
-           zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".errors.InvalidErrorView"
-      permission="zope.Public"
-      />
-
 </configure>

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/formbase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/formbase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/formlib/formbase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,117 +1,17 @@
-##############################################################################
-#
-# Copyright (c) 2006 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.
-#
-##############################################################################
-"""Five baseclasses for zope.formlib.form
-
-$Id$
-"""
-import os.path
-
-import zope.event
-import zope.formlib
-import zope.lifecycleevent
-from zope import interface
-from zope.formlib import interfaces, form
-from zope.i18nmessageid import MessageFactory
-_ = MessageFactory("zope")
-
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-from Products.Five.browser.decode import processInputs, setPageEncoding
-
-_FORMLIB_DIR = os.path.dirname(zope.formlib.__file__)
-_PAGEFORM_PATH = os.path.join(_FORMLIB_DIR, 'pageform.pt')
-_SUBPAGEFORM_PATH = os.path.join(_FORMLIB_DIR, 'subpageform.pt')
-
-
-class FiveFormlibMixin(object):
-
-    # Overrides the formlib.form.FormBase.template attributes implemented 
-    # using NamedTemplates. NamedTemplates using ViewPageTemplateFile (like
-    # formlib does by default) cannot work in Zope2.
-
-    # XXX Maybe we need to have Five-compatible NamedTemplates?
-
-    template = ViewPageTemplateFile(_PAGEFORM_PATH)
-
-    # Overrides formlib.form.FormBase.update. Make sure user input is
-    # decoded first and the page encoding is set before proceeding.
-
-    def update(self):
-        processInputs(self.request)
-        setPageEncoding(self.request)
-        super(FiveFormlibMixin, self).update()
-
-
-class FormBase(FiveFormlibMixin, form.FormBase):
-    pass
-
-
-class EditFormBase(FiveFormlibMixin, form.EditFormBase):
-    pass
-
-
-class DisplayFormBase(FiveFormlibMixin, form.DisplayFormBase):
-    pass
-
-
-class AddFormBase(FiveFormlibMixin, form.AddFormBase):
-    pass
-
-
-class PageForm(FormBase):
-
-    interface.implements(interfaces.IPageForm)
-
-Form = PageForm
-
-
-class PageEditForm(EditFormBase):
-
-    interface.implements(interfaces.IPageForm)
-
-EditForm = PageEditForm
-
-
-class PageDisplayForm(DisplayFormBase):
-
-    interface.implements(interfaces.IPageForm)
-
-DisplayForm = PageDisplayForm
-
-
-class PageAddForm(AddFormBase):
-
-    interface.implements(interfaces.IPageForm)
-
-AddForm = PageAddForm
-
-
-class SubPageForm(FormBase):
-
-    template = ViewPageTemplateFile(_SUBPAGEFORM_PATH)
-
-    interface.implements(interfaces.ISubPageForm)
-
-
-class SubPageEditForm(EditFormBase):
-
-    template = ViewPageTemplateFile(_SUBPAGEFORM_PATH)
-
-    interface.implements(interfaces.ISubPageForm)
-
-
-class SubPageDisplayForm(DisplayFormBase):
-
-    template = ViewPageTemplateFile(_SUBPAGEFORM_PATH)
-
-    interface.implements(interfaces.ISubPageForm)
+# BBB
+from five.formlib.formbase import FiveFormlibMixin
+from five.formlib.formbase import FormBase
+from five.formlib.formbase import EditFormBase
+from five.formlib.formbase import DisplayFormBase
+from five.formlib.formbase import AddFormBase
+from five.formlib.formbase import PageForm
+from five.formlib.formbase import Form
+from five.formlib.formbase import PageEditForm
+from five.formlib.formbase import EditForm
+from five.formlib.formbase import PageDisplayForm
+from five.formlib.formbase import DisplayForm
+from five.formlib.formbase import PageAddForm
+from five.formlib.formbase import AddForm
+from five.formlib.formbase import SubPageForm
+from five.formlib.formbase import SubPageEditForm
+from five.formlib.formbase import SubPageDisplayForm

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaclass.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaclass.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaclass.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/schema.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/schema.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/schema.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/security.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/security.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/security.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/sizeconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/sizeconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/sizeconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/standardmacros.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/standardmacros.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/standardmacros.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/demomacros.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/demomacros.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/demomacros.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/test_standardmacros.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/test_standardmacros.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/skin/tests/test_standardmacros.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/testbrowser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/testbrowser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/testbrowser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -95,15 +95,10 @@
                         '_equiv', '_basicauth', '_digestauth' ]
 
     def __init__(self, *args, **kws):
-        inherited_handlers = ['_unknown', '_http_error',
-            '_http_request_upgrade', '_http_default_error', '_basicauth',
-            '_digestauth', '_redirect', '_cookies', '_referer',
-            '_refresh', '_equiv', '_gzip']
-
-        self.handler_classes = {"http": PublisherHTTPHandler}
-        for name in inherited_handlers:
-            self.handler_classes[name] = mechanize.Browser.handler_classes[name]
-
+        self.handler_classes = mechanize.Browser.handler_classes.copy()
+        self.handler_classes["http"] = PublisherHTTPHandler
+        self.default_others = [cls for cls in self.default_others 
+                               if cls in mechanize.Browser.handler_classes]
         mechanize.Browser.__init__(self, *args, **kws)
 
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/adapters.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/adapters.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/adapters.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/boilerplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/boilerplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/boilerplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/classes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/classes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/classes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/de/LC_MESSAGES/fivetest.po
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/de/LC_MESSAGES/fivetest.po	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/de/LC_MESSAGES/fivetest.po	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004-2005 Zope Corporation and Contributors.
+# Copyright (c) 2004-2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/en/LC_MESSAGES/fivetest.po
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/en/LC_MESSAGES/fivetest.po	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/en/LC_MESSAGES/fivetest.po	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004-2005 Zope Corporation and Contributors.
+# Copyright (c) 2004-2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/fivetest.pot
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/fivetest.pot	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/locales/fivetest.pot	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004-2005 Zope Corporation and Contributors.
+# Copyright (c) 2004-2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_directives.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_directives.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_directives.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_event.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_event.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_event.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -83,6 +83,6 @@
 
 
 def test_suite():
-    from zope.testing.doctest import DocFileSuite
+    from doctest import DocFileSuite
     return DocFileSuite('event.txt', package="Products.Five.tests",
                         setUp=setUp, tearDown=testing.tearDown)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_i18n.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_i18n.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_i18n.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -55,5 +55,5 @@
 
 
 def test_suite():
-    from zope.testing.doctest import DocTestSuite
+    from doctest import DocTestSuite
     return DocTestSuite(setUp=setUp, tearDown=tearDown)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerclass.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerclass.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerclass.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerpackage.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerpackage.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_registerpackage.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_schema.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_schema.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_schema.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_security.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_security.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_security.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_size.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_size.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_size.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_testbrowser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_testbrowser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/test_testbrowser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/fancycontent.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/fancycontent.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/fancycontent.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/folder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/folder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/folder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/pythonproduct1.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/pythonproduct1.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/pythonproduct1.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/restricted.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/restricted.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/restricted.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/simplecontent.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/simplecontent.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/tests/testing/simplecontent.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/marker.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/marker.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/marker.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/tests/test_marker.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/tests/test_marker.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/browser/tests/test_marker.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -48,7 +48,7 @@
 
     Try to add a marker interface that doesn't exist:
 
-      >>> view.update(('__builtin__.IFooMarker',), ())
+      >>> view.update(('__main__.IFooMarker',), ())
       Traceback (most recent call last):
       ...
       ComponentLookupError...
@@ -66,7 +66,7 @@
 
     And try again to add it to the object:
 
-      >>> view.update(('__builtin__.IFooMarker',), ())
+      >>> view.update(('__main__.IFooMarker',), ())
       >>> view.getAvailableInterfaceNames()
       []
       >>> view.getDirectlyProvidedNames()
@@ -74,7 +74,7 @@
 
     And remove it again:
 
-      >>> view.update((), ('__builtin__.IFooMarker',))
+      >>> view.update((), ('__main__.IFooMarker',))
       >>> view.getAvailableInterfaceNames()
       [...IFooMarker...]
       >>> view.getDirectlyProvidedNames()

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/marker.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/marker.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/utilities/marker.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/manager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/manager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/manager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/metaconfigure.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/metaconfigure.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/metaconfigure.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/tests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/tests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/tests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004 Zope Corporation and Contributors.
+# Copyright (c) 2004 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/viewlet.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/viewlet.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/viewlet/viewlet.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Five/zcml.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Five/zcml.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Five/zcml.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/MIMETag.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/MIMETag.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/MIMETag.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MIMETools/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/MailHost.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/MailHost.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/MailHost.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -15,6 +15,7 @@
 $Id$
 """
 import logging
+from os.path import realpath
 import re
 from cStringIO import StringIO
 from copy import deepcopy
@@ -266,32 +267,38 @@
                           force_tls=self.force_tls
                          )
 
+    security.declarePrivate('_getThreadKey')
+    def _getThreadKey(self):
+        """ Return the key used to find our processor thread.
+        """
+        return realpath(self.smtp_queue_directory)
+
     @synchronized(lock)
     def _stopQueueProcessorThread(self):
-        """ Stop thread for processing the mail queue """
-
-        path = self.absolute_url(1)
-        if queue_threads.has_key(path):
-            thread = queue_threads[path]
+        """ Stop thread for processing the mail queue.
+        """
+        key = self._getThreadKey()
+        if queue_threads.has_key(key):
+            thread = queue_threads[key]
             thread.stop()
             while thread.isAlive():
                 # wait until thread is really dead
                 time.sleep(0.3)
             del queue_threads[path]
-            LOG.info('Thread for %s stopped' % path)
+            LOG.info('Thread for %s stopped' % key)
 
     @synchronized(lock)
     def _startQueueProcessorThread(self):
-        """ Start thread for processing the mail queue """
-
-        path = self.absolute_url(1)
-        if not queue_threads.has_key(path):
+        """ Start thread for processing the mail queue.
+        """
+        key = self._getThreadKey()
+        if not queue_threads.has_key(key):
             thread = QueueProcessorThread()
             thread.setMailer(self._makeMailer())
             thread.setQueuePath(self.smtp_queue_directory)
             thread.start()
-            queue_threads[path] = thread     
-            LOG.info('Thread for %s started' % path)
+            queue_threads[key] = thread     
+            LOG.info('Thread for %s started' % key)
 
     security.declareProtected(view, 'queueLength')
     def queueLength(self):
@@ -307,9 +314,9 @@
 
     security.declareProtected(view, 'queueThreadAlive')
     def queueThreadAlive(self):
-        """ return True/False is queue thread is working """
-
-        th = queue_threads.get(self.absolute_url(1))
+        """ return True/False is queue thread is working
+        """
+        th = queue_threads.get(self._getThreadKey())
         if th:
             return th.isAlive()
         return False
@@ -417,16 +424,31 @@
         # we don't use get_content_type because that has a default
         # value of 'text/plain'
         mo.set_type(msg_type)
-    charset_match = CHARSET_RE.search(mo['Content-Type'] or '')
-    if charset and not charset_match:
-        # Don't change the charset if already set
-        # This encodes the payload automatically based on the default
-        # encoding for the charset
-        mo.set_charset(charset)
-    elif charset_match and not charset:
-        # If a charset parameter was provided use it for header encoding below,
-        # Otherwise, try to use the charset provided in the message.
-        charset = charset_match.groups()[0]
+    if not mo.is_multipart():
+        charset_match = CHARSET_RE.search(mo['Content-Type'] or '')
+        if charset and not charset_match:
+            # Don't change the charset if already set
+            # This encodes the payload automatically based on the default
+            # encoding for the charset
+            mo.set_charset(charset)
+        elif charset_match and not charset:
+            # If a charset parameter was provided use it for header encoding below,
+            # Otherwise, try to use the charset provided in the message.
+            charset = charset_match.groups()[0]
+    else:
+        # Do basically the same for each payload as for the complete
+        # multipart message.
+        for index, payload in enumerate(mo.get_payload()):
+            if not isinstance(payload, Message):
+                payload = message_from_string(payload)
+            charset_match = CHARSET_RE.search(payload['Content-Type'] or '')
+            if payload.get_filename() is None:
+                # No binary file
+                if charset and not charset_match:
+                    payload.set_charset(charset)
+                elif charset_match and not charset:
+                    charset = charset_match.groups()[0]
+            mo.get_payload()[index] = payload
 
     # Parameters given will *always* override headers in the messageText.
     # This is so that you can't override or add to subscribers by adding

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/SendMailTag.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/SendMailTag.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/SendMailTag.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/decorator.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/decorator.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/decorator.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/help/MailHost.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/help/MailHost.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/help/MailHost.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/mailer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/mailer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/mailer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -49,8 +49,10 @@
         # send EHLO
         code, response = connection.ehlo()
         if code < 200 or code >300:
-            raise RuntimeError('Error sending EHLO to the SMTP server '
-                                '(code=%s, response=%s)' % (code, response))
+            code, response = connection.helo()
+            if code < 200 or code >300:
+                raise RuntimeError('Error sending HELO to the SMTP server '
+                                   '(code=%s, response=%s)' % (code, response))
 
         # encryption support
         have_tls =  connection.has_extn('starttls') 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/testMailHost.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/testMailHost.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/MailHost/tests/testMailHost.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -110,6 +110,14 @@
         self.failUnlessEqual(resto, ['many at example.com'])
         self.failUnlessEqual(resfrom, 'me at example.com' )
 
+    def test__getThreadKey_uses_fspath(self):
+        mh1 = self._makeOne('mh1')
+        mh1.smtp_queue_directory = '/abc'
+        mh1.absolute_url = lambda self: 'http://example.com/mh1'
+        mh2 = self._makeOne('mh2')
+        mh2.smtp_queue_directory = '/abc'
+        mh2.absolute_url = lambda self: 'http://example.com/mh2'
+        self.assertEqual(mh1._getThreadKey(), mh2._getThreadKey())
 
     def testAddressParser( self ):
         msg = """To: "Name, Nick" <recipient at domain.com>, "Foo Bar" <foo at domain.com>
@@ -518,7 +526,93 @@
                                        statusTemplate='check_status')
         self.failUnlessEqual(result, 'Message Sent')
 
+    def testSendMultiPartAlternativeMessage(self):
+        msg = ("""\
+Content-Type: multipart/alternative; boundary="===============0490954888=="
+MIME-Version: 1.0
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+Subject: My multipart email
+To: Foo Bar <foo at domain.com>
+From: sender at domain.com
 
+--===============0490954888==
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: quoted-printable
+
+This is plain text.
+--===============0490954888==
+Content-Type: text/html; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: quoted-printable
+
+<p>This is html.</p>
+--===============0490954888==--
+""")
+
+        mailhost = self._makeOne('MailHost')
+        # Specifying a charset for the header may have unwanted side
+        # effects in the case of multipart mails.
+        # (TypeError: expected string or buffer)
+        mailhost.send(msg, charset='utf-8')
+        self.assertEqual(mailhost.sent, msg)
+
+    def testSendMultiPartMixedMessage(self):
+        msg = ("""\
+Content-Type: multipart/mixed; boundary="XOIedfhf+7KOe/yw"
+Content-Disposition: inline
+MIME-Version: 1.0
+Date: Sun, 27 Aug 2006 17:00:00 +0200
+Subject: My multipart email
+To: Foo Bar <foo at domain.com>
+From: sender at domain.com
+
+--XOIedfhf+7KOe/yw
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+This is a test with as attachment OFS/www/new.gif.
+
+--XOIedfhf+7KOe/yw
+Content-Type: image/gif
+Content-Disposition: attachment; filename="new.gif"
+Content-Transfer-Encoding: base64
+
+R0lGODlhCwAQAPcAAP8A/wAAAFBQUICAgMDAwP8AAIAAQAAAoABAgIAAgEAAQP//AP//gACA
+gECAgP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAALABAAAAg7AAEIFKhgoEGC
+CwoeRKhwoYKEBhVIfLgg4UQAFCtqbJixYkOEHg9SHDmQJEmMEBkS/IiR5cKXMGPKDAgAOw==
+
+--XOIedfhf+7KOe/yw
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: attachment; filename="test.txt"
+Content-Transfer-Encoding: quoted-printable
+
+D=EDt =EFs =E9=E9n test
+
+--XOIedfhf+7KOe/yw--
+""")
+
+        mailhost = self._makeOne('MailHost')
+        # Specifying a charset for the header may have unwanted side
+        # effects in the case of multipart mails.
+        # (TypeError: expected string or buffer)
+        mailhost.send(msg, charset='utf-8')
+        self.assertEqual(mailhost.sent, msg)
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( TestMailHost ) )

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Draft.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Draft.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Draft.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Version.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Version.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/Version.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/AuthenticatedUser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/AuthenticatedUser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/AuthenticatedUser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLDocument.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLDocument.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLDocument.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DTMLMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DateTime.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DateTime.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/DateTime.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/File.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/File.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/File.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Folder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Folder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Folder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Image.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Image.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Image.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManagerItem.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManagerItem.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/ObjectManagerItem.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderedFolder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderedFolder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/OrderedFolder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertyManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertyManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertyManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheet.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheet.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheet.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheets.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheets.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/PropertySheets.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Request.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Request.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Request.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Response.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Response.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/Response.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -110,7 +110,7 @@
 
         '''
 
-    def setCookie(name,value,**kw):
+    def setCookie(name, value, quoted=True, **kw):
         '''
 
         Set an HTTP cookie on the browser
@@ -120,6 +120,10 @@
         "value". This overwrites any previously set value for the
         cookie in the Response object.
 
+        By default, the cookie value will be enclosed in double quotes.
+        To suppress the double quotes you can pass the "quoted" argument
+        with a False value such as False or 0.
+
         Permission -- Always available
 
         '''

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/sequence.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/sequence.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/OFSP/help/sequence.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -27,8 +27,8 @@
       other -- A specified, user-defined comparison function, should
       return 1, 0, -1.
 
-      direction -- defines the sort direction for the key (optional).
-      (allowed values: "asc", "desc")
+    direction -- defines the sort direction for the key (optional).
+    (allowed values: "asc", "desc")
 
     DTML Examples
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/DeferExpr.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/DeferExpr.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/DeferExpr.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/Expressions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/Expressions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -372,12 +372,26 @@
             return False
         return ob1 == ob2
 
+class UnicodeAwareStringExpr(StringExpr):
+
+    def __call__(self, econtext):
+        vvals = []
+        if isinstance(self._expr, unicode):
+            # coerce values through the Unicode Conflict Resolver
+            evaluate = econtext.evaluateText
+        else:
+            evaluate = econtext.evaluate
+        for var in self._vars:
+            v = evaluate(var)
+            vvals.append(v)
+        return self._expr % tuple(vvals)
+
 def createZopeEngine(zpe=ZopePathExpr):
     e = ZopeEngine()
     e.iteratorFactory = PathIterator
     for pt in zpe._default_type_names:
         e.registerType(pt, zpe)
-    e.registerType('string', StringExpr)
+    e.registerType('string', UnicodeAwareStringExpr)
     e.registerType('python', ZRPythonExpr.PythonExpr)
     e.registerType('not', NotExpr)
     e.registerType('defer', DeferExpr)

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplateFile.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/PageTemplateFile.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZRPythonExpr.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZRPythonExpr.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZRPythonExpr.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZopePageTemplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/ZopePageTemplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/batch.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/batch.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/batch.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testDTMLTests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testDTMLTests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testDTMLTests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testExpressions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testExpressions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testExpressions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -25,12 +25,20 @@
             __allow_access_to_unprotected_subobjects__ = 1
             def __call__(self):
                 return 'dummy'
+            
+            management_page_charset = 'iso-8859-15'
 
         class DummyDocumentTemplate:
             __allow_access_to_unprotected_subobjects__ = 1
             isDocTemp = True
             def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
                 return 'dummy'
+            
+            def absolute_url(self, relative=0):
+                url = 'dummy'
+                if not relative:
+                    url = "http://server/" + url
+                return url
 
         _DEFAULT_BINDINGS = dict(
             one = 1,
@@ -38,6 +46,12 @@
             blank = '',
             dummy = Dummy(),
             dummy2 = DummyDocumentTemplate(),
+            eightbit = 'äüö',
+            # ZopeContext needs 'context' and 'template' keys for unicode
+            # conflict resolution, and 'context' needs a 
+            # 'management_page_charset'
+            context = Dummy(),
+            template = DummyDocumentTemplate(),
             )
 
         if bindings is None:
@@ -158,6 +172,34 @@
         ec = self._makeContext()
         self.assertEquals(ec.evaluate('  \n'), None)
 
+    def test_unicode(self):
+        # All our string expressions are unicode now
+        eng = self._makeEngine()
+        ec = self._makeContext()
+        # XXX: can't do ec.evaluate(u'string:x') directly because ZopeContext
+        # only bothers compiling true strings, not unicode strings
+        result = ec.evaluate(eng.compile(u'string:x'))
+        self.assertEqual(result, u'x')
+        self.failUnless(isinstance(result, unicode))
+
+    def test_mixed(self):
+        # 8-bit strings in unicode string expressions cause UnicodeDecodeErrors
+        eng = self._makeEngine()
+        ec = self._makeContext()
+        expr = eng.compile(u'string:$eightbit')
+        self.assertRaises(UnicodeDecodeError,
+                          ec.evaluate, expr)
+        # But registering an appropriate IUnicodeEncodingConflictResolver
+        # should fix it
+        from zope.component import provideUtility
+        from Products.PageTemplates.unicodeconflictresolver \
+            import StrictUnicodeEncodingConflictResolver
+        from Products.PageTemplates.interfaces \
+            import IUnicodeEncodingConflictResolver
+        provideUtility(StrictUnicodeEncodingConflictResolver, 
+                                      IUnicodeEncodingConflictResolver)        
+        self.assertEqual(ec.evaluate(expr), u'äüö')
+
 class UntrustedEngineTests(EngineTestsBase, unittest.TestCase):
 
     def _makeEngine(self):

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testHTMLTests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testHTMLTests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testHTMLTests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testZopePageTemplate.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/testZopePageTemplate.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -202,6 +202,26 @@
         state = cPickle.dumps(empty, protocol=1)
         clone = cPickle.loads(state)
 
+    def testBug246983(self):
+        # See https://bugs.launchpad.net/bugs/246983
+        self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'utf-8')
+        self.app.REQUEST.set('data', u'üöä'.encode('utf-8'))
+        # Direct inclusion of encoded strings is hadled normally by the unicode
+        # conflict resolver
+        textDirect = """
+        <tal:block content="request/data" />
+        """.strip()
+        manage_addPageTemplate(self.app, 'test', text=textDirect)
+        zpt = self.app['test']
+        self.assertEquals(zpt.pt_render(), u'üöä')
+        # Indirect inclusion of encoded strings through String Expressions
+        # should be resolved as well.
+        textIndirect = """
+        <tal:block content="string:x ${request/data}" />
+        """.strip()
+        zpt.pt_edit(textIndirect, zpt.content_type)
+        self.assertEquals(zpt.pt_render(), u'x üöä')
+
     def testDebugFlags(self):
         # Test for bug 229549
         manage_addPageTemplate(self.app, 'test', 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/util.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/util.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/tests/util.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/unicodeconflictresolver.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/unicodeconflictresolver.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/utils.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/utils.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PageTemplates/utils.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/DateIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/DateIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/DateIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/DateRangeIndex/tests/test_DateRangeIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/FieldIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/FieldIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/FieldIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/FieldIndex/tests/testFieldIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/KeywordIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -70,7 +70,8 @@
             try:
                 for kw in newKeywords:
                     self.insertForwardIndexEntry(kw, documentId)
-                self._unindex[documentId] = list(newKeywords)
+                if newKeywords:
+                    self._unindex[documentId] = list(newKeywords)
             except TypeError:
                 return 0
         else:
@@ -83,7 +84,10 @@
             rdiff = difference(newKeywords, oldKeywords)
             if fdiff or rdiff:
                 # if we've got forward or reverse changes
-                self._unindex[documentId] = list(newKeywords)
+                if newKeywords:
+                    self._unindex[documentId] = list(newKeywords)
+                else:
+                    del self._unindex[documentId]
                 if fdiff:
                     self.unindex_objectKeywords(documentId, fdiff)
                 if rdiff:
@@ -94,8 +98,13 @@
     def _get_object_keywords(self, obj, attr):
         newKeywords = getattr(obj, attr, ())
         if safe_callable(newKeywords):
-            newKeywords = newKeywords()
-        if isinstance(newKeywords, basestring): #Python 2.1 compat isinstance
+            try:
+                newKeywords = newKeywords()
+            except AttributeError:
+                return ()
+        if not newKeywords:
+            return ()
+        elif isinstance(newKeywords, basestring): #Python 2.1 compat isinstance
             return (newKeywords,)
         else:
             unique = {}

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -243,7 +243,32 @@
                  }
         self._checkApply(record, values[5:7])
 
+    def test_noindexing_when_noattribute(self):
+        to_index = Dummy(['hello'])
+        self._index._index_object(10, to_index, attr='UNKNOWN')
+        self.failIf(self._index._unindex.get(10))
+        self.failIf(self._index.getEntryForObject(10))
 
+    def test_noindexing_when_raising_attribute(self):
+        class FauxObject:
+            def foo(self):
+                raise AttributeError
+        to_index = FauxObject()
+        self._index._index_object(10, to_index, attr='foo')
+        self.failIf(self._index._unindex.get(10))
+        self.failIf(self._index.getEntryForObject(10))
+
+    def test_value_removes(self):
+        
+        to_index = Dummy(['hello'])
+        self._index._index_object(10, to_index, attr='foo')
+        self.failUnless(self._index._unindex.get(10))
+
+        to_index = Dummy('')
+        self._index._index_object(10, to_index, attr='foo')
+        self.failIf(self._index._unindex.get(10))
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( TestKeywordIndex ) )

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/PathIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/PathIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/PathIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -11,8 +11,6 @@
 #
 ##############################################################################
 """Path index.
-
-$Id$
 """
 
 from logging import getLogger
@@ -33,9 +31,9 @@
 from Products.PluginIndexes.common import safe_callable
 from Products.PluginIndexes.common.util import parseIndexRequest
 from Products.PluginIndexes.interfaces import IPathIndex
+from Products.PluginIndexes.interfaces import ISortIndex
 from Products.PluginIndexes.interfaces import IUniqueValueIndex
 
-_marker = []
 LOG = getLogger('Zope.PathIndex')
 
 
@@ -54,7 +52,7 @@
     - the value is a mapping 'level of the path component' to
       'all docids with this path component on this level'
     """
-    implements(IPathIndex, IUniqueValueIndex)
+    implements(IPathIndex, IUniqueValueIndex, ISortIndex)
 
     meta_type="PathIndex"
     query_options = ('query', 'level', 'operator')
@@ -71,34 +69,29 @@
         self.useOperator = 'or'
         self.clear()
 
-    def clear(self):
-        self._depth = 0
-        self._index = OOBTree()
-        self._unindex = IOBTree()
-        self._length = Length(0)
+    def __len__(self):
+        return self._length()
 
-    def insertEntry(self, comp, id, level):
-        """Insert an entry.
+    # IPluggableIndex implementation
 
-           comp is a path component
-           id is the docid
-           level is the level of the component inside the path
+    def getEntryForObject(self, docid, default=None):
+        """ See IPluggableIndex.
         """
+        try:
+            return self._unindex[docid]
+        except KeyError:
+            return default
 
-        if not self._index.has_key(comp):
-            self._index[comp] = IOBTree()
+    def getIndexSourceNames(self):
+        """ See IPluggableIndex.
+        """
+        return (self.id, 'getPhysicalPath', )
 
-        if not self._index[comp].has_key(level):
-            self._index[comp][level] = IITreeSet()
-
-        self._index[comp][level].insert(id)
-        if level > self._depth:
-            self._depth = level
-
     def index_object(self, docid, obj ,threshold=100):
-        """ hook for (Z)Catalog """
+        """ See IPluggableIndex.
+        """
+        f = getattr(obj, self.id, None)
 
-        f = getattr(obj, self.id, None)
         if f is not None:
             if safe_callable(f):
                 try:
@@ -118,6 +111,7 @@
 
         if isinstance(path, (list, tuple)):
             path = '/'+ '/'.join(path[1:])
+
         comps = filter(None, path.split('/'))
 
         if not self._unindex.has_key(docid):
@@ -129,9 +123,9 @@
         return 1
 
     def unindex_object(self, docid):
-        """ hook for (Z)Catalog """
-
-        if not self._unindex.has_key(docid):
+        """ See IPluggableIndex.
+        """
+        if docid not in self._unindex:
             LOG.debug('Attempt to unindex nonexistent document with id %s'
                       % docid)
             return
@@ -156,15 +150,114 @@
         self._length.change(-1)
         del self._unindex[docid]
 
-    def search(self, path, default_level=0):
+    def _apply_index(self, request):
+        """ See IPluggableIndex.
+
+        o Unpacks args from catalog and mapps onto '_search'.
         """
-        path is either a string representing a
-        relative URL or a part of a relative URL or
-        a tuple (path,level).
+        record = parseIndexRequest(request, self.id, self.query_options)
+        if record.keys is None:
+            return None
 
-        level >= 0  starts searching at the given level
-        level <  0  match at *any* level
+        level = record.get("level", 0)
+        operator = record.get('operator', self.useOperator).lower()
+
+        # depending on the operator we use intersection of union
+        if operator == "or":
+            set_func = union
+        else:
+            set_func = intersection
+
+        res = None
+        for k in record.keys:
+            rows = self._search(k,level)
+            res = set_func(res,rows)
+
+        if res:
+            return res, (self.id,)
+        else:
+            return IISet(), (self.id,)
+
+    def numObjects(self):
+        """ See IPluggableIndex.
         """
+        return len(self._unindex)
+
+    def indexSize(self):
+        """ See IPluggableIndex.
+        """
+        return len(self)
+
+    def clear(self):
+        """ See IPluggableIndex.
+        """
+        self._depth = 0
+        self._index = OOBTree()
+        self._unindex = IOBTree()
+        self._length = Length(0)
+
+    # IUniqueValueIndex implementation
+
+    def hasUniqueValuesFor(self, name):
+        """ See IUniqueValueIndex.
+        """
+        return name == self.id
+
+    def uniqueValues(self, name=None, withLength=0):
+        """  See IUniqueValueIndex.
+        """
+        if name in (None, self.id, 'getPhysicalPath'):
+            if withLength:
+                for key in self._index:
+                    yield key, len(self._search(key, -1))
+            else:
+                for key in self._index.keys():
+                    yield key
+
+    # ISortIndex implementation
+
+    def keyForDocument(self, documentId):
+        """ See ISortIndex.
+        """
+        return self._unindex.get(documentId)
+
+    def documentToKeyMap(self):
+        """ See ISortIndex.
+        """
+        return self._unindex
+
+    # IPathIndex implementation.
+
+    def insertEntry(self, comp, id, level):
+        """ See IPathIndex
+        """
+        if not self._index.has_key(comp):
+            self._index[comp] = IOBTree()
+
+        if not self._index[comp].has_key(level):
+            self._index[comp][level] = IITreeSet()
+
+        self._index[comp][level].insert(id)
+        if level > self._depth:
+            self._depth = level
+
+    # Helper methods
+
+    def _search(self, path, default_level=0):
+        """ Perform the actual search.
+
+        ``path``
+            a string representing a relative URL, or a part of a relative URL,
+            or a tuple ``(path, level)``.  In the first two cases, use
+            ``default_level`` as the level for the search.
+
+        ``default_level``
+            the level to use for non-tuple queries.
+
+        ``level >= 0`` =>  match ``path`` only at the given level.
+
+        ``level <  0`` =>  match ``path`` at *any* level
+        """
         if isinstance(path, str):
             level = default_level
         else:
@@ -174,7 +267,7 @@
         if level < 0:
             # Search at every level, return the union of all results
             return multiunion(
-                [self.search(path, level) 
+                [self._search(path, level) 
                  for level in xrange(self._depth + 1)])
 
         comps = filter(None, path.split('/'))
@@ -192,66 +285,6 @@
             results = intersection(results, self._index[comp][level+i])
         return results
 
-    def numObjects(self):
-        """Return the number of indexed objects."""
-        return len(self._unindex)
-
-    def indexSize(self):
-        """Return the size of the index in terms of distinct values."""
-        return len(self)
-
-    def __len__(self):
-        return self._length()
-
-    def _apply_index(self, request):
-        """ hook for (Z)Catalog
-            'request' --  mapping type (usually {"path": "..." }
-             additionaly a parameter "path_level" might be passed
-             to specify the level (see search())
-        """
-        record = parseIndexRequest(request, self.id, self.query_options)
-        if record.keys is None:
-            return None
-
-        level    = record.get("level",0)
-        operator = record.get('operator',self.useOperator).lower()
-
-        # depending on the operator we use intersection of union
-        if operator == "or":  set_func = union
-        else: set_func = intersection
-
-        res = None
-        for k in record.keys:
-            rows = self.search(k,level)
-            res = set_func(res,rows)
-
-        if res:
-            return res, (self.id,)
-        else:
-            return IISet(), (self.id,)
-
-    def hasUniqueValuesFor(self, name):
-        """has unique values for column name"""
-        return name == self.id
-
-    def uniqueValues(self, name=None, withLength=0):
-        """ needed to be consistent with the interface """
-        return self._index.keys()
-
-    def getIndexSourceNames(self):
-        """ return names of indexed attributes """
-        return ('getPhysicalPath', )
-
-    def getEntryForObject(self, docid, default=_marker):
-        """ Takes a document ID and returns all the information
-            we have on that specific object.
-        """
-        try:
-            return self._unindex[docid]
-        except KeyError:
-            # XXX Why is default ignored?
-            return None
-
     manage = manage_main = DTMLFile('dtml/managePathIndex', globals())
     manage_main._setName('manage_main')
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/tests/testPathIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/PathIndex/tests/testPathIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -11,15 +11,10 @@
 #
 ##############################################################################
 """PathIndex unit tests.
-
-$Id$
 """
 
 import unittest
-import Testing
-import Zope2
 
-from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
 
 
 class Dummy:
@@ -29,94 +24,272 @@
     def getPhysicalPath(self):
         return self.path.split('/')
 
+DUMMIES = {
+    1 : Dummy("/aa/aa/aa/1.html"),
+    2 : Dummy("/aa/aa/bb/2.html"),
+    3 : Dummy("/aa/aa/cc/3.html"),
+    4 : Dummy("/aa/bb/aa/4.html"),
+    5 : Dummy("/aa/bb/bb/5.html"),
+    6 : Dummy("/aa/bb/cc/6.html"),
+    7 : Dummy("/aa/cc/aa/7.html"),
+    8 : Dummy("/aa/cc/bb/8.html"),
+    9 : Dummy("/aa/cc/cc/9.html"),
+    10 : Dummy("/bb/aa/aa/10.html"),
+    11 : Dummy("/bb/aa/bb/11.html"),
+    12 : Dummy("/bb/aa/cc/12.html"),
+    13 : Dummy("/bb/bb/aa/13.html"),
+    14 : Dummy("/bb/bb/bb/14.html"),
+    15 : Dummy("/bb/bb/cc/15.html"),
+    16 : Dummy("/bb/cc/aa/16.html"),
+    17 : Dummy("/bb/cc/bb/17.html"),
+    18 : Dummy("/bb/cc/cc/18.html")
+}
 
+def _populateIndex(index):
+    for k, v in DUMMIES.items():
+        index.index_object(k, v)
+
+_marker = object()
+
 class PathIndexTests(unittest.TestCase):
     """ Test PathIndex objects """
 
-    def setUp(self):
-        self._index = PathIndex( 'path' )
-        self._values = {
-          1 : Dummy("/aa/aa/aa/1.html"),
-          2 : Dummy("/aa/aa/bb/2.html"),
-          3 : Dummy("/aa/aa/cc/3.html"),
-          4 : Dummy("/aa/bb/aa/4.html"),
-          5 : Dummy("/aa/bb/bb/5.html"),
-          6 : Dummy("/aa/bb/cc/6.html"),
-          7 : Dummy("/aa/cc/aa/7.html"),
-          8 : Dummy("/aa/cc/bb/8.html"),
-          9 : Dummy("/aa/cc/cc/9.html"),
-          10 : Dummy("/bb/aa/aa/10.html"),
-          11 : Dummy("/bb/aa/bb/11.html"),
-          12 : Dummy("/bb/aa/cc/12.html"),
-          13 : Dummy("/bb/bb/aa/13.html"),
-          14 : Dummy("/bb/bb/bb/14.html"),
-          15 : Dummy("/bb/bb/cc/15.html"),
-          16 : Dummy("/bb/cc/aa/16.html"),
-          17 : Dummy("/bb/cc/bb/17.html"),
-          18 : Dummy("/bb/cc/cc/18.html")
-        }
+    def _getTargetClass(self):
+        from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
+        return PathIndex
 
-    def _populateIndex(self):
-        for k, v in self._values.items():
-            self._index.index_object( k, v )
+    def _makeOne(self, id='path', caller=_marker):
+        if caller is not _marker:
+            return self._getTargetClass()(id, caller)
+        return self._getTargetClass()(id)
 
-    def test_z3interfaces(self):
-        from Products.PluginIndexes.interfaces import IPathIndex
+    def test_class_conforms_to_IPluggableIndex(self):
+        from Products.PluginIndexes.interfaces import IPluggableIndex
+        from zope.interface.verify import verifyClass
+        verifyClass(IPluggableIndex, self._getTargetClass())
+
+    def test_instance_conforms_to_IPluggableIndex(self):
+        from Products.PluginIndexes.interfaces import IPluggableIndex
+        from zope.interface.verify import verifyObject
+        verifyObject(IPluggableIndex, self._makeOne())
+
+    def test_class_conforms_to_IUniqueValueIndex(self):
         from Products.PluginIndexes.interfaces import IUniqueValueIndex
         from zope.interface.verify import verifyClass
+        verifyClass(IUniqueValueIndex, self._getTargetClass())
 
-        verifyClass(IPathIndex, PathIndex)
-        verifyClass(IUniqueValueIndex, PathIndex)
+    def test_instance_conforms_to_IUniqueValueIndex(self):
+        from Products.PluginIndexes.interfaces import IUniqueValueIndex
+        from zope.interface.verify import verifyObject
+        verifyObject(IUniqueValueIndex, self._makeOne())
 
-    def testEmpty(self):
-        self.assertEqual(self._index.numObjects() ,0)
-        self.assertEqual(self._index.getEntryForObject(1234), None)
-        self._index.unindex_object( 1234 ) # nothrow
-        self.assertEqual(self._index._apply_index(dict(suxpath="xxx")), None)
+    def test_class_conforms_to_ISortIndex(self):
+        from Products.PluginIndexes.interfaces import ISortIndex
+        from zope.interface.verify import verifyClass
+        verifyClass(ISortIndex, self._getTargetClass())
 
-    def testUnIndex(self):
-        self._populateIndex()
-        self.assertEqual(self._index.numObjects(), 18)
+    def test_instance_conforms_to_ISortIndex(self):
+        from Products.PluginIndexes.interfaces import ISortIndex
+        from zope.interface.verify import verifyObject
+        verifyObject(ISortIndex, self._makeOne())
 
-        for k in self._values.keys():
-            self._index.unindex_object(k)
+    def test_class_conforms_to_IPathIndex(self):
+        from Products.PluginIndexes.interfaces import IPathIndex
+        from zope.interface.verify import verifyClass
+        verifyClass(IPathIndex, self._getTargetClass())
 
-        self.assertEqual(self._index.numObjects(), 0)
-        self.assertEqual(len(self._index._index), 0)
-        self.assertEqual(len(self._index._unindex), 0)
+    def test_instance_conforms_to_IPathIndex(self):
+        from Products.PluginIndexes.interfaces import IPathIndex
+        from zope.interface.verify import verifyObject
+        verifyObject(IPathIndex, self._makeOne())
 
-    def testReindex(self):
-        self._populateIndex()
-        self.assertEqual(self._index.numObjects(), 18)
+    def test_ctor(self):
+        index = self._makeOne()
+        self.assertEqual(index.id, 'path')
+        self.assertEqual(index.operators, ('or', 'and'))
+        self.assertEqual(index.useOperator, 'or')
+        self.assertEqual(len(index), 0)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 0)
+        self.assertEqual(len(index._unindex), 0)
+        self.assertEqual(index._length(), 0)
 
+    def test_getEntryForObject_miss_no_default(self):
+        index = self._makeOne()
+        self.assertEqual(index.getEntryForObject(1234), None)
+
+    def test_getEntryForObject_miss_w_default(self):
+        index = self._makeOne()
+        default = object()
+        self.failUnless(index.getEntryForObject(1234, default) is default)
+
+    def test_getEntryForObject_hit(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        self.assertEqual(index.getEntryForObject(1), DUMMIES[1].path)
+
+    def test_getIndexSourceNames(self):
+        index = self._makeOne('foo')
+        self.assertEqual(list(index.getIndexSourceNames()),
+                         ['foo', 'getPhysicalPath'])
+
+    def test_index_object_broken_path_raises_TypeError(self):
+        index = self._makeOne()
+        doc = Dummy({})
+        self.assertRaises(TypeError, index.index_object, 1, doc)
+
+    def test_index_object_broken_callable(self):
+        index = self._makeOne()
+        doc = Dummy(lambda: self.nonesuch)
+        rc = index.index_object(1, doc)
+        self.assertEqual(rc, 0)
+        self.assertEqual(len(index), 0)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 0)
+        self.assertEqual(len(index._unindex), 0)
+        self.assertEqual(index._length(), 0)
+
+    def test_index_object_at_root(self):
+        index = self._makeOne()
+        doc = Dummy('/xx')
+        rc = index.index_object(1, doc)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(rc, 1)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '/xx')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_at_root_callable_attr(self):
+        index = self._makeOne()
+        doc = Dummy(lambda: '/xx')
+        rc = index.index_object(1, doc)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(rc, 1)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '/xx')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_at_root_no_attr_but_getPhysicalPath(self):
+        class Other:
+            def getPhysicalPath(self):
+                return '/xx'
+        index = self._makeOne()
+        doc = Other()
+        rc = index.index_object(1, doc)
+        self.assertEqual(rc, 1)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '/xx')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_at_root_attr_as_tuple(self):
+        index = self._makeOne()
+        doc = Dummy(('', 'xx'))
+        rc = index.index_object(1, doc)
+        self.assertEqual(rc, 1)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '/xx')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_strips_empty_path_elements(self):
+        index = self._makeOne()
+        doc = Dummy('////xx//')
+        rc = index.index_object(1, doc)
+        self.assertEqual(rc, 1)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '////xx//')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_below_root(self):
+        index = self._makeOne()
+        doc = Dummy('/xx/yy/zz')
+        rc = index.index_object(1, doc)
+        self.assertEqual(rc, 1)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index._depth, 2)
+        self.assertEqual(len(index._index), 3)
+        self.assertEqual(list(index._index['xx'][0]), [1])
+        self.assertEqual(list(index._index['yy'][1]), [1])
+        self.assertEqual(list(index._index['zz'][2]), [1])
+        self.assertEqual(len(index._unindex), 1)
+        self.assertEqual(index._unindex[1], '/xx/yy/zz')
+        self.assertEqual(index._length(), 1)
+
+    def test_index_object_again(self):
+        index = self._makeOne()
         o = Dummy('/foo/bar')
-        self._index.index_object(19, o)
-        self.assertEqual(self._index.numObjects(), 19)
-        self._index.index_object(19, o)
-        self.assertEqual(self._index.numObjects(), 19)
+        index.index_object(1234, o)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index.numObjects(), 1)
+        index.index_object(1234, o)
+        self.assertEqual(len(index), 1)
+        self.assertEqual(index.numObjects(), 1)
 
-    def testUnIndexError(self):
-        self._populateIndex()
-        # this should not raise an error
-        self._index.unindex_object(-1)
+    def test_unindex_object_nonesuch(self):
+        index = self._makeOne()
+        index.unindex_object( 1234 ) # nothrow
 
-        # nor should this
-        self._index._unindex[1] = "/broken/thing"
-        self._index.unindex_object(1)
+    def test_unindex_object_broken_path(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        index._unindex[1] = "/broken/thing"
+        index.unindex_object(1) # nothrow
 
-    def testRoot(self):
-        self._populateIndex()
+    def test_unindex_object_found(self):
+        index = self._makeOne()
+        _populateIndex(index)
 
-        queries = (
-            dict(path=dict(query='/', level=0)),
-            dict(path=(('/', 0),)),
-        )
-        for q in queries:
-            res = self._index._apply_index(q)
-            self.assertEqual(list(res[0].keys()), range(1,19))
+        for k in DUMMIES.keys():
+            index.unindex_object(k)
 
-    def testSimpleTests(self):
-        self._populateIndex()
+        self.assertEqual(index.numObjects(), 0)
+        self.assertEqual(len(index._index), 0)
+        self.assertEqual(len(index._unindex), 0)
+
+    def test__apply_index_no_match_in_query(self):
+        index = self._makeOne()
+        self.assertEqual(index._apply_index({'foo': 'xxx'}), None)
+
+    def test__apply_index_nonesuch(self):
+        index = self._makeOne()
+        res = index._apply_index({'path': 'xxx'})
+        self.assertEqual(len(res[0]), 0)
+        self.assertEqual(res[1], ('path',))
+
+    def test___apply_index_root_levelO_dict(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        query = {'path': {'query': '/', 'level': 0}}
+        res = index._apply_index(query)
+        self.assertEqual(list(res[0].keys()), range(1,19))
+
+    def test___apply_index_root_levelO_tuple(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        query = {'path': (('/', 0),)}
+        res = index._apply_index(query)
+        self.assertEqual(list(res[0].keys()), range(1,19))
+
+    def test__apply_index_simple(self):
+        index = self._makeOne()
+        _populateIndex(index)
         tests = [
             # component, level, expected results
             ("aa", 0, [1,2,3,4,5,6,7,8,9]),
@@ -135,34 +308,36 @@
             ("cc/18.html", 2, [18]),
         ]
 
-        for comp, level, results in tests:
+        for comp, level, expected in tests:
             for path in [comp, "/"+comp, "/"+comp+"/"]:
                 # Test with the level passed in as separate parameter
-                res = self._index._apply_index(dict(path=
-                    dict(query=path, level=level)))
-                self.assertEqual(list(res[0].keys()), results)
+                query = {'path': {'query':path, 'level': level}}
+                res = index._apply_index(query)
+                self.assertEqual(list(res[0].keys()), expected)
 
                 # Test with the level passed in as part of the path parameter
-                res = self._index._apply_index(dict(path=
-                    dict(query=((path, level),))))
-                self.assertEqual(list(res[0].keys()), results)
+                query = {'path': ((path, level),)}
+                res = index._apply_index(query)
+                self.assertEqual(list(res[0].keys()), expected)
 
-    def testComplexOrTests(self):
-        self._populateIndex()
+    def test__apply_index_ComplexOrTests(self):
+        index = self._makeOne()
+        _populateIndex(index)
         tests = [
             (['aa','bb'],1,[1,2,3,4,5,6,10,11,12,13,14,15]),
             (['aa','bb','xx'],1,[1,2,3,4,5,6,10,11,12,13,14,15]),
             ([('cc',1),('cc',2)],0,[3,6,7,8,9,12,15,16,17,18]),
         ]
 
-        for lst, level, results in tests:
-            res = self._index._apply_index(dict(path=
-                dict(query=lst, level=level, operator='or')))
+        for lst, level, expected in tests:
+            query = {'path': {'query': lst, 'level': level, 'operator': 'or'}}
+            res = index._apply_index(query)
             lst = list(res[0].keys())
-            self.assertEqual(lst, results)
+            self.assertEqual(lst, expected)
 
-    def testComplexANDTests(self):
-        self._populateIndex()
+    def test__apply_index_ComplexANDTests(self):
+        index = self._makeOne()
+        _populateIndex(index)
         tests = [
             # Path query (as list or (path, level) tuple), level, expected
             (['aa','bb'], 1, []),
@@ -170,27 +345,191 @@
             ([('aa',0), ('cc',2)], 0, [3,6,9]),
         ]
 
-        for lst, level, results in tests:
-            res = self._index._apply_index(dict(path=
-                dict(query=lst, level=level, operator='and')))
+        for lst, level, expected in tests:
+            query = {'path': {'query': lst, 'level': level, 'operator': 'and'}}
+            res = index._apply_index(query)
             lst = list(res[0].keys())
-            self.assertEqual(lst, results)
+            self.assertEqual(lst, expected)
 
-    def testQueryPathReturnedInResult(self):
-        index = self._index
+    def test__apply_index_QueryPathReturnedInResult(self):
+        index = self._makeOne()
         index.index_object(1, Dummy("/ff"))
         index.index_object(2, Dummy("/ff/gg"))
         index.index_object(3, Dummy("/ff/gg/3.html"))
         index.index_object(4, Dummy("/ff/gg/4.html"))
-        res = index._apply_index(dict(path=dict(query='/ff/gg')))
+        res = index._apply_index({'path': {'query': '/ff/gg'}})
         lst = list(res[0].keys())
         self.assertEqual(lst, [2, 3, 4])
 
+    def test_numObjects_empty(self):
+        index = self._makeOne()
+        self.assertEqual(index.numObjects(), 0)
 
+    def test_numObjects_filled(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        self.assertEqual(index.numObjects(), len(DUMMIES))
+
+    def test_indexSize_empty(self):
+        index = self._makeOne()
+        self.assertEqual(index.indexSize(), 0)
+
+    def test_indexSize_filled(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        self.assertEqual(index.indexSize(), len(DUMMIES))
+
+    def test_indexSize_multiple_items_same_path(self):
+        index = self._makeOne()
+        doc1 = Dummy('/shared')
+        doc2 = Dummy('/shared')
+        index.index_object(1, doc1)
+        index.index_object(2, doc2)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(len(index), 2)
+        self.assertEqual(index.numObjects(), 2)
+        self.assertEqual(index.indexSize(), 2)
+
+    def test_clear(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        index.clear()
+        self.assertEqual(len(index), 0)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 0)
+        self.assertEqual(len(index._unindex), 0)
+        self.assertEqual(index._length(), 0)
+
+    def test_hasUniqueValuesFor_miss(self):
+        index = self._makeOne()
+        self.failIf(index.hasUniqueValuesFor('miss'))
+
+    def test_hasUniqueValuesFor_hit(self):
+        index = self._makeOne()
+        self.failUnless(index.hasUniqueValuesFor('path'))
+
+    def test_uniqueValues_empty(self):
+        index = self._makeOne()
+        self.assertEqual(len(list(index.uniqueValues())), 0)
+
+    def test_uniqueValues_miss(self):
+        index = self._makeOne('foo')
+        _populateIndex(index)
+        self.assertEqual(len(list(index.uniqueValues('bar'))), 0)
+
+    def test_uniqueValues_hit(self):
+        index = self._makeOne('foo')
+        _populateIndex(index)
+        self.assertEqual(len(list(index.uniqueValues('foo'))),
+                         len(DUMMIES) + 3)
+
+    def test_uniqueValues_hit_w_withLength(self):
+        index = self._makeOne('foo')
+        _populateIndex(index)
+        results = dict(index.uniqueValues('foo', True))
+        self.assertEqual(len(results), len(DUMMIES) + 3)
+        for i in range(1, 19):
+            self.assertEqual(results['%s.html' % i], 1)
+        self.assertEqual(results['aa'],
+                         len([x for x in DUMMIES.values() if 'aa' in x.path]))
+        self.assertEqual(results['bb'],
+                         len([x for x in DUMMIES.values() if 'bb' in x.path]))
+        self.assertEqual(results['cc'],
+                         len([x for x in DUMMIES.values() if 'cc' in x.path]))
+
+    def test_keyForDocument_miss(self):
+        index = self._makeOne()
+        self.assertEqual(index.keyForDocument(1), None)
+
+    def test_keyForDocument_hit(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        self.assertEqual(index.keyForDocument(1), DUMMIES[1].path)
+
+    def test_documentToKeyMap_empty(self):
+        index = self._makeOne()
+        self.assertEqual(dict(index.documentToKeyMap()), {})
+
+    def test_documentToKeyMap_filled(self):
+        index = self._makeOne()
+        _populateIndex(index)
+        self.assertEqual(dict(index.documentToKeyMap()),
+                         dict([(k, v.path) for k, v in DUMMIES.items()]))
+
+    def test_insertEntry_empty_depth_0(self):
+        index = self._makeOne()
+        index.insertEntry('xx', 123, level=0)
+        self.assertEqual(index._depth, 0)
+        self.assertEqual(len(index._index), 1)
+        self.assertEqual(list(index._index['xx'][0]), [123])
+
+        # insertEntry oesn't update the length or the reverse index.
+        self.assertEqual(len(index), 0)
+        self.assertEqual(len(index._unindex), 0)
+        self.assertEqual(index._length(), 0)
+
+    def test_insertEntry_empty_depth_1(self):
+        index = self._makeOne()
+        index.insertEntry('xx', 123, level=0)
+        index.insertEntry('yy', 123, level=1)
+        self.assertEqual(index._depth, 1)
+        self.assertEqual(len(index._index), 2)
+        self.assertEqual(list(index._index['xx'][0]), [123])
+        self.assertEqual(list(index._index['yy'][1]), [123])
+
+    def test_insertEntry_multiple(self):
+        index = self._makeOne()
+        index.insertEntry('xx', 123, level=0)
+        index.insertEntry('yy', 123, level=1)
+        index.insertEntry('aa', 456, level=0)
+        index.insertEntry('bb', 456, level=1)
+        index.insertEntry('cc', 456, level=2)
+        self.assertEqual(index._depth, 2)
+        self.assertEqual(len(index._index), 5)
+        self.assertEqual(list(index._index['xx'][0]), [123])
+        self.assertEqual(list(index._index['yy'][1]), [123])
+        self.assertEqual(list(index._index['aa'][0]), [456])
+        self.assertEqual(list(index._index['bb'][1]), [456])
+        self.assertEqual(list(index._index['cc'][2]), [456])
+
+    def test__search_empty_index_string_query(self):
+        index = self._makeOne()
+        self.assertEqual(list(index._search('/xxx')), [])
+
+    def test__search_empty_index_tuple_query(self):
+        index = self._makeOne()
+        self.assertEqual(list(index._search(('/xxx', 0))), [])
+
+    def test__search_empty_path(self):
+        index = self._makeOne()
+        doc = Dummy('/aa')
+        index.index_object(1, doc)
+        self.assertEqual(list(index._search('/')), [1])
+
+    def test__search_matching_path(self):
+        index = self._makeOne()
+        doc = Dummy('/aa')
+        index.index_object(1, doc)
+        self.assertEqual(list(index._search('/aa')), [1])
+
+    def test__search_mismatched_path(self):
+        index = self._makeOne()
+        doc = Dummy('/aa')
+        index.index_object(1, doc)
+        self.assertEqual(list(index._search('/bb')), [])
+
+    def test__search_w_level_0(self):
+        index = self._makeOne()
+        doc = Dummy('/aa/bb')
+        index.index_object(1, doc)
+        self.assertEqual(list(index._search('aa', 0)), [1])
+        self.assertEqual(list(index._search('aa', 1)), [])
+        self.assertEqual(list(index._search('bb', 1)), [1])
+        self.assertEqual(list(index._search('aa/bb', 0)), [1])
+        self.assertEqual(list(index._search('aa/bb', 1)), [])
+
+
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite(PathIndexTests),
+            unittest.makeSuite(PathIndexTests),
         ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/FilteredSet.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/FilteredSet.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/FilteredSet.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/TopicIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/TopicIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/TopicIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/TopicIndex/tests/testTopicIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -11,41 +11,83 @@
 #
 ##############################################################################
 
-import PathIndex.PathIndex
-import FieldIndex.FieldIndex
-import KeywordIndex.KeywordIndex
-import TopicIndex.TopicIndex
-import DateIndex.DateIndex
-import DateRangeIndex.DateRangeIndex
-
-from Products.PluginIndexes.common import ResultList
-from Products.PluginIndexes.common import UnIndex
-
-_indexes =  ('KeywordIndex',
-             'FieldIndex',
-             'PathIndex',
-             'TopicIndex',
-             'DateIndex',
-             'DateRangeIndex',
-            )
-
 def initialize(context):
 
-    for idx in _indexes:
+    from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
+    from Products.PluginIndexes.FieldIndex.FieldIndex \
+        import manage_addFieldIndex
+    from Products.PluginIndexes.FieldIndex.FieldIndex \
+        import manage_addFieldIndexForm
+    context.registerClass(FieldIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addFieldIndexForm,
+                                        manage_addFieldIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )
 
-        s = "context.registerClass( \
-            %s.%s.%s,\
-            permission='Add Pluggable Index', \
-            constructors=(manage_add%sForm,\
-                          manage_add%s),\
-            icon='www/index.gif',\
-            visibility=None\
-         )" % (idx,idx,idx,idx,idx)
+    from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
+    from Products.PluginIndexes.KeywordIndex.KeywordIndex \
+        import manage_addKeywordIndex
+    from Products.PluginIndexes.KeywordIndex.KeywordIndex \
+        import manage_addKeywordIndexForm
+    context.registerClass(KeywordIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addKeywordIndexForm,
+                                        manage_addKeywordIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )
 
-        exec(s)
+    from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
+    from Products.PluginIndexes.TopicIndex.TopicIndex \
+        import manage_addTopicIndex
+    from Products.PluginIndexes.TopicIndex.TopicIndex \
+        import manage_addTopicIndexForm
+    context.registerClass(TopicIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addTopicIndexForm,
+                                        manage_addTopicIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )
 
+    from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
+    from Products.PluginIndexes.DateIndex.DateIndex \
+        import manage_addDateIndex
+    from Products.PluginIndexes.DateIndex.DateIndex \
+        import manage_addDateIndexForm
+    context.registerClass(DateIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addDateIndexForm,
+                                        manage_addDateIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )
 
-for idx in _indexes:
+    from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+        import DateRangeIndex
+    from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+        import manage_addDateRangeIndex
+    from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+        import manage_addDateRangeIndexForm
+    context.registerClass(DateRangeIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addDateRangeIndexForm,
+                                        manage_addDateRangeIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )
 
-    exec("manage_add%sForm = %s.%s.manage_add%sForm" % (idx,idx,idx,idx))
-    exec("manage_add%s     = %s.%s.manage_add%s" % (idx,idx,idx,idx))
+    from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
+    from Products.PluginIndexes.PathIndex.PathIndex \
+        import manage_addPathIndex
+    from Products.PluginIndexes.PathIndex.PathIndex \
+        import manage_addPathIndexForm
+    context.registerClass(PathIndex,
+                          permission='Add Pluggable Index', 
+                          constructors=(manage_addPathIndexForm,
+                                        manage_addPathIndex),
+                          icon='www/index.gif',
+                          visibility=None,
+                         )

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/ResultList.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/ResultList.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/ResultList.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/UnIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/UnIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/UnIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/randid.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/randid.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/randid.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_UnIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_UnIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_UnIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_util.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_util.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/tests/test_util.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/util.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/util.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/common/util.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PluginIndexes/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.
@@ -34,10 +34,22 @@
     def index_object(documentId, obj, threshold=None):
         """Index an object.
 
-        'documentId' is the integer ID of the document.
-        'obj' is the object to be indexed.
-        'threshold' is the number of words to process between committing
-        subtransactions.  If None, subtransactions are disabled.
+        - ``documentId`` is the integer ID of the document.
+
+        - ``obj`` is the object to be indexed.
+
+        - ``threshold`` is the number of words to process between committing
+          subtransactions.  If None, subtransactions are disabled.
+
+        For each name in ``getIndexSourceNames``, try to get the named
+        attribute from ``obj``.
+
+        - If the object does not have the attribute, do not add it to the
+          index for that name.
+
+        - If the attribute is a callable, call it to get the value.  If
+          calling it raises an AttributeError, do not add it to the index.
+          for that name.
         """
 
     def unindex_object(documentId):
@@ -157,8 +169,20 @@
     - the value is a mapping 'level of the path component' to
       'all docids with this path component on this level'
     """
+    def insertEntry(comp, id, level):
+        """ Insert an entry.
 
+        This method is intended for use by subclasses:  it is not
+        a normal API for the index.
 
+        'comp' is an individual path component
+
+        'id' is the docid
+
+        .level'is the level of the component inside the path
+        """
+
+
 class IFilteredSet(Interface):
 
     """A pre-calculated result list based on an expression.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/PythonScript.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/PythonScript.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/Utility.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/Utility.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/Utility.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/PythonScript.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/PythonScript.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/PythonScript.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/Script.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/Script.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/help/Script.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/standard.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/standard.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/standard.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/tests/testPythonScript.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/PythonScripts/tests/testPythonScript.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/BrowserIdManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/BrowserIdManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/BrowserIdManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ############################################################################
 # 
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -10,7 +10,6 @@
 # FOR A PARTICULAR PURPOSE
 #
 ############################################################################
-__version__='$Revision: 1.20 $'[11:-2]
 
 import binascii
 from cgi import escape
@@ -28,11 +27,9 @@
 from AccessControl.Role import RoleManager
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import Implicit
-from Acquisition import aq_base
 from Acquisition import aq_parent
 from Acquisition import aq_inner
 from App.class_init import InitializeClass
-from App.Dialogs import MessageDialog
 from App.Management import Tabs
 from App.special_dtml import DTMLFile
 from Persistence import Persistent
@@ -47,7 +44,6 @@
 from Products.Sessions.SessionPermissions import ACCESS_CONTENTS_PERM
 from Products.Sessions.SessionPermissions import CHANGE_IDMGR_PERM
 from Products.Sessions.SessionPermissions import MGMT_SCREEN_PERM
-from Products.Sessions.common import DEBUG
 
 b64_trans = string.maketrans('+/', '-.')
 b64_untrans = string.maketrans('-.', '+/')

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionDataManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionDataManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionDataManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ############################################################################
 # 
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -14,14 +14,11 @@
 from logging import getLogger
 import re
 import sys
-import time
 
 from AccessControl.Owned import Owned
 from AccessControl.Role import RoleManager
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import Implicit
-from Acquisition import Explicit
-from Acquisition import aq_base
 from App.class_init import InitializeClass
 from App.special_dtml import DTMLFile
 from App.Management import Tabs
@@ -39,8 +36,6 @@
 from Products.Sessions.SessionPermissions import CHANGE_DATAMGR_PERM
 from Products.Sessions.SessionPermissions import MGMT_SCREEN_PERM
 from Products.Sessions.common import DEBUG
-from Products.Sessions.BrowserIdManager import isAWellFormedBrowserId
-from Products.Sessions.BrowserIdManager import getNewBrowserId
 from Products.Sessions.BrowserIdManager import BROWSERID_MANAGER_NAME
 
 bad_path_chars_in=re.compile('[^a-zA-Z0-9-_~\,\. \/]').search

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionInterfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionInterfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionInterfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -10,224 +10,13 @@
 # FOR A PARTICULAR PURPOSE
 #
 ############################################################################
-""" Session APIs
+# BBB location for APIs now defined in Products.Sessions.interfaces
 
-o See Also
-
-    - "Transient Object API":../../Transience/Help/TransienceInterfaces.py
-
-"""
-
-from zope.interface import Interface
-
-class IBrowserIdManager(Interface):
-    """ Zope Browser Id Manager interface.
-
-    A Zope Browser Id Manager is responsible for assigning ids to site
-    visitors, and for servicing requests from Session Data Managers
-    related to the browser id.
-    """
-    def hasBrowserId():
-        """ Return true if there is a browser id for the current request.
-
-        o Permission required: Access contents information
-
-        o Does *not* raise an error if the request contains a broken
-          browser id.
-        """
-
-    def getBrowserId(create=1):
-        """ Return a browser id for the current request.
-
-        o If create is false, return None if there is no browser id associated
-          with the current request.
-          
-        o If create is true, return a newly-created browser id if
-          there is no browser id associated with the current request.
-          
-        o This method is useful in conjunction with 'getBrowserIdName' if you
-          wish to embed the browser-id-name/browser-id combination as a hidden
-          value in a POST-based form.
-          
-        o The browser id is opaque, has no business meaning, and its length,
-          type, and composition are subject to change.
-
-        o Permission required: Access contents information
-
-        o Raises BrowserIdManagerErr if an ill-formed browser id
-          is found in REQUEST.
-        """
-
-    def getBrowserIdName():
-        """
-        Returns a string with the name of the cookie/form variable which is
-        used by the current browser id manager as the name to look up when
-        attempting to obtain the browser id value.  For example, '_ZopeId'.
-
-        Permission required: Access contents information
-        """
-
-    def isBrowserIdNew():
-        """
-        Returns true if browser id is 'new'.  A browser id is 'new'
-        when it is first created and the client has therefore not sent it
-        back to the server in any request.
-
-        Permission required: Access contents information
-
-        Raises:  BrowserIdManagerErr.  If there is no current browser id.
-        """
-
-    def isBrowserIdFromCookie():
-        """ Return true if browser id comes from a cookie.
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if there is no current browser id.
-        """
-
-    def isBrowserIdFromForm():
-        """ Return true if browser id comes from a form variable.
-        
-        o Variable may come from either the query string or a post.
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if there is no current browser id.
-        """
-
-    def isBrowserIdFromUrl():
-        """ Return true if browser id comes from a cookie.
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if there is no current browser id.
-        """
-
-    def flushBrowserIdCookie():
-        """ Deletes the browser id cookie from the client browser.
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if the 'cookies' namespace isn't
-          a browser id namespace.
-        """
-
-    def setBrowserIdCookieByForce(bid):
-        """ Sets the browser id cookie to browser id 'bid' by force.
-
-        o Useful when you need to 'chain' browser id cookies across domains
-          for the same user (perhaps temporarily using query strings).
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if the 'cookies' namespace isn't
-          a browser id namespace.
-        """
-
-    def getHiddenFormField():
-        """ Return a string usable as a hidden form field for the browser id.
-        
-        o String is of the form::
-
-          <input type="hidden" name="_ZopeId" value="H7HJGYUFGFyHKH*" />
-
-        o name and the value represent the current browser id
-          name and current browser id.
-        """
-
-    def encodeUrl(url, style='querystring'):
-        """ Encode a given URL with the current browser id.
-        
-        o Two forms of URL-encoding are supported: 'querystring' and 'inline'.
-        
-        o 'querystring' is the default.
-
-        o If the 'querystring' form is used, the browser id name/value pair
-          are postfixed onto the URL as a query string.
-          
-        o If the 'inline' form is used, the browser id name/value pair
-          are prefixed onto the URL as the first two path segment elements.
-
-        o For example:
-
-          - The call encodeUrl('http://foo.com/amethod', style='querystring')
-            might return 'http://foo.com/amethod?_ZopeId=as9dfu0adfu0ad'.
-
-          - The call encodeUrl('http://foo.com/amethod, style='inline')
-            might return 'http://foo.com/_ZopeId/as9dfu0adfu0ad/amethod'.
-
-        o Permission required: Access contents information
-
-        o Raise BrowserIdManagerErr if there is no current browser id.
-        """
-
+from Products.Sessions.interfaces import IBrowserIdManager
 BrowserIdManagerInterface = IBrowserIdManager # BBB
 
-class ISessionDataManager(Interface):
-    """ Zope Session Data Manager interface.
+from Products.Sessions.interfaces import ISessionDataManager
+SessionDataManagerInterface = ISessionDataManager
 
-    A Zope Session Data Manager is responsible for maintaining Session
-    Data Objects, and for servicing requests from application code
-    related to Session Data Objects.  It also communicates with a Browser
-    Id Manager to provide information about browser ids.
-    """
-    def getBrowserIdManager():
-        """ Return the nearest acquirable browser id manager.
-
-        o Raise SessionDataManagerErr if no browser id manager can be found.
-
-        o Permission required: Access session data
-        """
-
-    def getSessionData(create=1):
-        """ Return a Session Data Object for the current browser id.
-        
-        o If there is no current browser id, and create is true,
-          return a new Session Data Object.
-          
-        o If there is no current browser id and create is false, returns None.
-
-        o Permission required: Access session data
-        """
-
-    def hasSessionData():
-        """ Does a Session Data Object exist for the current browser id?
-
-        o Do not create a Session Data Object if one does not exist.
-
-        o Permission required: Access session data
-        """
-
-    def getSessionDataByKey(key):
-        """ Return a Session Data Object associated with 'key'.
-        
-        o If there is no Session Data Object associated with 'key',
-          return None.
-
-        o Permission required: Access arbitrary user session data
-        """
-
-SessionDataManagerInterface = ISessionDataManager  # BBB
-
-class SessionDataManagerErr(ValueError):
-    """ Error raised during some session data manager operations
-    
-    o See ISesseionDataManager.
-
-    o This exception may be caught in PythonScripts.  A successful
-      import of the exception for PythonScript use would need to be::
-
-       from Products.Sessions import SessionDataManagerErr
-    """
-
-class BrowserIdManagerErr(ValueError):
-    """ Error raised during some browser id manager operations
-    
-    o See IBrowserIdManager methods.
-
-    o This exception may be caught in PythonScripts.  A successful
-      import of the exception for PythonScript use would need to be::
-
-       from Products.Sessions import BrowserIdManagerErr
-    """
+from Products.Sessions.interfaces import SessionDataManagerErr
+from Products.Sessions.interfaces import BrowserIdManagerErr

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionPermissions.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionPermissions.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/SessionPermissions.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -10,19 +10,16 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
+""" Session initialization routines
 """
-Session initialization routines
+from Products.Sessions.interfaces import BrowserIdManagerErr    #BBB
+from Products.Sessions.interfaces import SessionDataManagerErr  #BBB
 
-$Id$
-"""
+def initialize(context):
 
-import ZODB # this is for testrunner to be happy
-import BrowserIdManager
-import SessionDataManager
-from BrowserIdManager import BrowserIdManagerErr
-from SessionDataManager import SessionDataManagerErr
+    import BrowserIdManager
+    import SessionDataManager
 
-def initialize(context):
     context.registerClass(
         BrowserIdManager.BrowserIdManager,
         icon="www/idmgr.gif",
@@ -41,6 +38,7 @@
 
     context.registerHelp()
     context.registerHelpTitle("Zope Help")
+
     # do module security declarations so folks can use some of the
     # module-level stuff in PythonScripts
     #
@@ -51,8 +49,15 @@
     security = ModuleSecurityInfo('Products')
     security.declarePublic('Sessions')
     security.declarePublic('Transience')
+
+    security = ModuleSecurityInfo('Products.Sessions.interfaces')
+    security.declareObjectPublic()
+    security.setDefaultAccess('allow')
+
+    security = ModuleSecurityInfo('Products.Transience')
+    security.declarePublic('MaxTransientObjectsExceeded')
+
+    #BBB for names which should be imported from Products.Sessions.interfaces
     security = ModuleSecurityInfo('Products.Sessions')
     security.declarePublic('BrowserIdManagerErr')
     security.declarePublic('SessionDataManagerErr')
-    security = ModuleSecurityInfo('Products.Transience')
-    security.declarePublic('MaxTransientObjectsExceeded')

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/common.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/common.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/common.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/interfaces.py (from rev 112805, Zope/branches/2.12/src/Products/Sessions/interfaces.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/interfaces.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,233 @@
+############################################################################
+#
+# Copyright (c) 2002 Zope Foundation and Contributors.
+#
+# 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
+#
+############################################################################
+""" Session APIs
+
+o See Also
+
+    - "Transient Object API":../../Transience/Help/TransienceInterfaces.py
+
+"""
+
+from zope.interface import Interface
+
+class IBrowserIdManager(Interface):
+    """ Zope Browser Id Manager interface.
+
+    A Zope Browser Id Manager is responsible for assigning ids to site
+    visitors, and for servicing requests from Session Data Managers
+    related to the browser id.
+    """
+    def hasBrowserId():
+        """ Return true if there is a browser id for the current request.
+
+        o Permission required: Access contents information
+
+        o Does *not* raise an error if the request contains a broken
+          browser id.
+        """
+
+    def getBrowserId(create=1):
+        """ Return a browser id for the current request.
+
+        o If create is false, return None if there is no browser id associated
+          with the current request.
+          
+        o If create is true, return a newly-created browser id if
+          there is no browser id associated with the current request.
+          
+        o This method is useful in conjunction with 'getBrowserIdName' if you
+          wish to embed the browser-id-name/browser-id combination as a hidden
+          value in a POST-based form.
+          
+        o The browser id is opaque, has no business meaning, and its length,
+          type, and composition are subject to change.
+
+        o Permission required: Access contents information
+
+        o Raises BrowserIdManagerErr if an ill-formed browser id
+          is found in REQUEST.
+        """
+
+    def getBrowserIdName():
+        """
+        Returns a string with the name of the cookie/form variable which is
+        used by the current browser id manager as the name to look up when
+        attempting to obtain the browser id value.  For example, '_ZopeId'.
+
+        Permission required: Access contents information
+        """
+
+    def isBrowserIdNew():
+        """
+        Returns true if browser id is 'new'.  A browser id is 'new'
+        when it is first created and the client has therefore not sent it
+        back to the server in any request.
+
+        Permission required: Access contents information
+
+        Raises:  BrowserIdManagerErr.  If there is no current browser id.
+        """
+
+    def isBrowserIdFromCookie():
+        """ Return true if browser id comes from a cookie.
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if there is no current browser id.
+        """
+
+    def isBrowserIdFromForm():
+        """ Return true if browser id comes from a form variable.
+        
+        o Variable may come from either the query string or a post.
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if there is no current browser id.
+        """
+
+    def isBrowserIdFromUrl():
+        """ Return true if browser id comes from a cookie.
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if there is no current browser id.
+        """
+
+    def flushBrowserIdCookie():
+        """ Deletes the browser id cookie from the client browser.
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if the 'cookies' namespace isn't
+          a browser id namespace.
+        """
+
+    def setBrowserIdCookieByForce(bid):
+        """ Sets the browser id cookie to browser id 'bid' by force.
+
+        o Useful when you need to 'chain' browser id cookies across domains
+          for the same user (perhaps temporarily using query strings).
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if the 'cookies' namespace isn't
+          a browser id namespace.
+        """
+
+    def getHiddenFormField():
+        """ Return a string usable as a hidden form field for the browser id.
+        
+        o String is of the form::
+
+          <input type="hidden" name="_ZopeId" value="H7HJGYUFGFyHKH*" />
+
+        o name and the value represent the current browser id
+          name and current browser id.
+        """
+
+    def encodeUrl(url, style='querystring'):
+        """ Encode a given URL with the current browser id.
+        
+        o Two forms of URL-encoding are supported: 'querystring' and 'inline'.
+        
+        o 'querystring' is the default.
+
+        o If the 'querystring' form is used, the browser id name/value pair
+          are postfixed onto the URL as a query string.
+          
+        o If the 'inline' form is used, the browser id name/value pair
+          are prefixed onto the URL as the first two path segment elements.
+
+        o For example:
+
+          - The call encodeUrl('http://foo.com/amethod', style='querystring')
+            might return 'http://foo.com/amethod?_ZopeId=as9dfu0adfu0ad'.
+
+          - The call encodeUrl('http://foo.com/amethod, style='inline')
+            might return 'http://foo.com/_ZopeId/as9dfu0adfu0ad/amethod'.
+
+        o Permission required: Access contents information
+
+        o Raise BrowserIdManagerErr if there is no current browser id.
+        """
+
+BrowserIdManagerInterface = IBrowserIdManager # BBB
+
+class ISessionDataManager(Interface):
+    """ Zope Session Data Manager interface.
+
+    A Zope Session Data Manager is responsible for maintaining Session
+    Data Objects, and for servicing requests from application code
+    related to Session Data Objects.  It also communicates with a Browser
+    Id Manager to provide information about browser ids.
+    """
+    def getBrowserIdManager():
+        """ Return the nearest acquirable browser id manager.
+
+        o Raise SessionDataManagerErr if no browser id manager can be found.
+
+        o Permission required: Access session data
+        """
+
+    def getSessionData(create=1):
+        """ Return a Session Data Object for the current browser id.
+        
+        o If there is no current browser id, and create is true,
+          return a new Session Data Object.
+          
+        o If there is no current browser id and create is false, returns None.
+
+        o Permission required: Access session data
+        """
+
+    def hasSessionData():
+        """ Does a Session Data Object exist for the current browser id?
+
+        o Do not create a Session Data Object if one does not exist.
+
+        o Permission required: Access session data
+        """
+
+    def getSessionDataByKey(key):
+        """ Return a Session Data Object associated with 'key'.
+        
+        o If there is no Session Data Object associated with 'key',
+          return None.
+
+        o Permission required: Access arbitrary user session data
+        """
+
+SessionDataManagerInterface = ISessionDataManager  # BBB
+
+class SessionDataManagerErr(ValueError):
+    """ Error raised during some session data manager operations
+    
+    o See ISesseionDataManager.
+
+    o This exception may be caught in PythonScripts.  A successful
+      import of the exception for PythonScript use would need to be::
+
+       from Products.Sessions import SessionDataManagerErr
+    """
+
+class BrowserIdManagerErr(ValueError):
+    """ Error raised during some browser id manager operations
+    
+    o See IBrowserIdManager methods.
+
+    o This exception may be caught in PythonScripts.  A successful
+      import of the exception for PythonScript use would need to be::
+
+       from Products.Sessions import BrowserIdManagerErr
+    """

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/stresstests/stresstestMultiThread.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/stresstests/stresstestMultiThread.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/stresstests/stresstestMultiThread.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testBrowserIdManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testBrowserIdManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testBrowserIdManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testSessionDataManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testSessionDataManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Sessions/tests/testSessionDataManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -10,31 +10,8 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-import sys, os, time
+import unittest
 
-from Testing import makerequest
-import ZODB
-from ZODB.POSException import InvalidObjectReference, ConflictError
-from Persistence import Persistent
-from ZODB.DemoStorage import DemoStorage
-import transaction
-from OFS.DTMLMethod import DTMLMethod
-import Acquisition
-from Acquisition import aq_base
-from Products.Sessions.BrowserIdManager import BrowserIdManager
-from Products.Sessions.SessionDataManager import \
-     SessionDataManager, SessionDataManagerErr, SessionDataManagerTraverser
-from Products.Transience.Transience import \
-     TransientObjectContainer, TransientObject
-from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
-from DateTime import DateTime
-from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
-import time, threading
-from cPickle import UnpickleableError
-from OFS.Application import Application
-from ZPublisher.BeforeTraverse import registerBeforeTraverse, \
-     unregisterBeforeTraverse
-
 tf_name = 'temp_folder'
 idmgr_name = 'browser_id_manager'
 toc_name = 'temp_transient_container'
@@ -42,11 +19,16 @@
 
 stuff = {}
 
+
 def _getDB():
+    from OFS.Application import Application
+    import transaction
     db = stuff.get('db')
     if not db:
+        from ZODB import DB
+        from ZODB.DemoStorage import DemoStorage
         ds = DemoStorage()
-        db = ZODB.DB(ds, pool_size=60)
+        db = DB(ds, pool_size=60)
         conn = db.open()
         root = conn.root()
         app = Application()
@@ -57,17 +39,20 @@
         conn.close()
     return db
 
+
 def _delDB():
+    import transaction
     transaction.abort()
     del stuff['db']
 
-class DummyAqImplicit(Acquisition.Implicit):
-    pass
 
-class DummyPersistent(Persistent):
-    pass
-
 def _populate(app):
+    from OFS.DTMLMethod import DTMLMethod
+    from Products.Sessions.BrowserIdManager import BrowserIdManager
+    from Products.Sessions.SessionDataManager import SessionDataManager
+    from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
+    from Products.Transience.Transience import TransientObjectContainer
+    import transaction
     bidmgr = BrowserIdManager(idmgr_name)
     tf = MountedTemporaryFolder(tf_name, title="Temporary Folder")
     toc = TransientObjectContainer(toc_name, title='Temporary '
@@ -76,17 +61,25 @@
         path='/'+tf_name+'/'+toc_name, title='Session Data Manager',
         requestName='TESTOFSESSION')
 
-    try: app._delObject(idmgr_name)
-    except (AttributeError, KeyError): pass
+    try:
+        app._delObject(idmgr_name)
+    except (AttributeError, KeyError):
+        pass
 
-    try: app._delObject(tf_name)
-    except (AttributeError, KeyError): pass
+    try:
+        app._delObject(tf_name)
+    except (AttributeError, KeyError):
+        pass
 
-    try: app._delObject(sdm_name)
-    except (AttributeError, KeyError): pass
+    try:
+        app._delObject(sdm_name)
+    except (AttributeError, KeyError):
+        pass
 
-    try: app._delObject('index_html')
-    except (AttributeError, KeyError): pass
+    try:
+        app._delObject('index_html')
+    except (AttributeError, KeyError):
+        pass
 
     app._setObject(idmgr_name, bidmgr)
 
@@ -102,8 +95,11 @@
     app._setObject('index_html', DTMLMethod('', __name__='foo'))
     transaction.commit()
 
-class TestBase(TestCase):
+
+class TestSessionManager(unittest.TestCase):
+
     def setUp(self):
+        from Testing import makerequest
         db = _getDB()
         conn = db.open()
         root = conn.root()
@@ -114,7 +110,6 @@
         _delDB()
         del self.app
 
-class TestSessionManager(TestBase):
     def testHasId(self):
         self.failUnless(self.app.session_data_manager.id == \
                         sdm_name)
@@ -128,6 +123,7 @@
         self.failUnless(sd is None)
 
     def testGetSessionDataCreate(self):
+        from Products.Transience.Transience import TransientObject
         sd = self.app.session_data_manager.getSessionData(1)
         self.failUnless(sd.__class__ is TransientObject)
 
@@ -139,6 +135,7 @@
         self.failUnless(not self.app.session_data_manager.hasSessionData())
 
     def testSessionDataWrappedInSDMandTOC(self):
+        from Acquisition import aq_base
         sd = self.app.session_data_manager.getSessionData(1)
         sdm = aq_base(getattr(self.app, sdm_name))
         toc = aq_base(getattr(self.app.temp_folder, toc_name))
@@ -147,6 +144,8 @@
         self.failUnless(aq_base(sd.aq_parent.aq_parent) is toc)
 
     def testNewSessionDataObjectIsValid(self):
+        from Acquisition import aq_base
+        from Products.Transience.Transience import TransientObject
         sdType = type(TransientObject(1))
         sd = self.app.session_data_manager.getSessionData()
         self.failUnless(type(aq_base(sd)) is sdType)
@@ -165,6 +164,7 @@
         self.failUnless(sd == bykeysd)
 
     def testBadExternalSDCPath(self):
+        from Products.Sessions.SessionDataManager import SessionDataManagerErr
         sdm = self.app.session_data_manager
         # fake out webdav
         sdm.REQUEST['REQUEST_METHOD'] = 'GET'
@@ -182,6 +182,7 @@
         self.failUnless(not sdm.getSessionData().has_key('test'))
 
     def testGhostUnghostSessionManager(self):
+        import transaction
         sdm = self.app.session_data_manager
         transaction.commit()
         sd = sdm.getSessionData()
@@ -191,6 +192,11 @@
         self.failUnless(sdm.getSessionData().get('foo') == 'bar')
 
     def testSubcommitAssignsPJar(self):
+        global DummyPersistent # so pickle can find it
+        from Persistence import Persistent
+        import transaction
+        class DummyPersistent(Persistent):
+            pass
         sd = self.app.session_data_manager.getSessionData()
         dummy = DummyPersistent()
         sd.set('dp', dummy)
@@ -199,9 +205,11 @@
         self.failIf(sd['dp']._p_jar is None)
 
     def testForeignObject(self):
+        from ZODB.POSException import InvalidObjectReference
         self.assertRaises(InvalidObjectReference, self._foreignAdd)
 
     def _foreignAdd(self):
+        import transaction
         ob = self.app.session_data_manager
 
         # we don't want to fail due to an acquisition wrapper
@@ -213,6 +221,11 @@
         transaction.commit()
 
     def testAqWrappedObjectsFail(self):
+        from Acquisition import Implicit
+        import transaction
+
+        class DummyAqImplicit(Implicit):
+            pass
         a = DummyAqImplicit()
         b = DummyAqImplicit()
         aq_wrapped = a.__of__(b)
@@ -227,6 +240,8 @@
         self.failUnless(self.app.REQUEST.has_key('TESTOFSESSION'))
 
     def testUnlazifyAutoPopulated(self):
+        from Acquisition import aq_base
+        from Products.Transience.Transience import TransientObject
         self.app.REQUEST['PARENTS'] = [self.app]
         self.app.REQUEST['URL'] = 'a'
         self.app.REQUEST.traverse('/')
@@ -234,11 +249,8 @@
         sdType = type(TransientObject(1))
         self.failUnless(type(aq_base(sess)) is sdType)
 
+
 def test_suite():
-    test_datamgr = makeSuite(TestSessionManager, 'test')
-    suite = TestSuite((test_datamgr,))
-    return suite
-
-if __name__ == '__main__':
-    runner = TextTestRunner(verbosity=9, descriptions=9)
-    runner.run(test_suite())
+    return unittest.TestSuite((
+        unittest.makeSuite(TestSessionManager),
+    ))

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/AccessRule.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/AccessRule.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/AccessRule.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -18,21 +18,10 @@
     meta_type = 'Set Access Rule'
 
     def __call__(self, container, request):
-        if SUPPRESS_ACCESSRULE: return
-        if '_SUPPRESS_ACCESSRULE' in _swallow(request, '_SUPPRESS'):
-            request.setVirtualRoot(request.steps)
+        if SUPPRESS_ACCESSRULE:
             return
         NameCaller.__call__(self, container, request)
 
-def _swallow(request, prefix):
-    path = request['TraversalRequestNameStack']
-    steps = request.steps
-    i = len(steps)
-    while i > 0 and steps[i - 1][:1] == '_':
-        i = i - 1
-    while path and path[-1][:len(prefix)] == prefix:
-        steps.append(path.pop())
-    return steps[i:]
 
 def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored):
     """Point a __before_traverse__ entry at the specified method"""
@@ -44,8 +33,10 @@
     if method_id is None or (REQUEST and REQUEST.form.has_key('none')):
         rules = unregisterBeforeTraverse(self, 'AccessRule')
         if rules:
-            try: del getattr(self, rules[0].name).icon
-            except: pass
+            try:
+                del getattr(self, rules[0].name).icon
+            except:
+                pass
         if REQUEST:
             return MessageDialog(title='No Access Rule',
               message='This object now has no Access Rule',
@@ -53,13 +44,16 @@
     elif method_id and hasattr(self, method_id):
         rules = unregisterBeforeTraverse(self, 'AccessRule')
         if rules:
-            try: del getattr(self, rules[0].name).icon
-            except: pass
+            try:
+                del getattr(self, rules[0].name).icon
+            except:
+                pass
         hook = AccessRule(method_id)
         registerBeforeTraverse(self, hook, 'AccessRule', 1)
         try:
             getattr(self, method_id).icon = 'misc_/SiteAccess/AccessRule.gif'
-        except: pass
+        except:
+            pass
         if REQUEST:
             return MessageDialog(title='Access Rule Set',
               message='"%s" is now the Access Rule for this object'

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/COPYRIGHT.txt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/COPYRIGHT.txt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/COPYRIGHT.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 This software is released under the following Wide-Open Source licence:
 
-Copyright (c) 1999 Evan Simpson
+Copyright (c) 1999 Zope Foundation and Contributors
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/SiteRoot.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/SiteRoot.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/SiteRoot.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -6,27 +6,23 @@
 import os
 
 from Acquisition import Implicit
-from Acquisition import ImplicitAcquisitionWrapper
 from App.Dialogs import MessageDialog
 from App.special_dtml import DTMLFile
-from ExtensionClass import Base
 from OFS.SimpleItem import Item
 from Persistence import Persistent
 from ZPublisher.BeforeTraverse import NameCaller
 from ZPublisher.BeforeTraverse import registerBeforeTraverse
 from ZPublisher.BeforeTraverse import unregisterBeforeTraverse
 
-from Products.SiteAccess.AccessRule import _swallow
-
 SUPPRESS_SITEROOT = os.environ.has_key('SUPPRESS_SITEROOT')
 
 class Traverser(Persistent, Item):
-    """Class for overriding container's __before_traverse__
+    """ Class for overriding container's __before_traverse__
 
     Containers are expected to have at most one instance of any particular
-    subclass, with Id equal to the meta_type of the subclass."""
-
-    meta_type='Traverser'
+    subclass, with Id equal to the meta_type of the subclass.
+    """
+    meta_type = 'Traverser'
     priority = 100
 
     __ac_permissions__=()
@@ -64,42 +60,35 @@
                                                   self.priority)
     def _setId(self, id):
         if id != self.id:
-            raise MessageDialog(
-                title='Invalid Id',
-                message='Cannot change the id of a %s' % escape(self.meta_type),
-                action ='./manage_main',)
+            raise ValueError('Cannot change the id of a %s'
+                                % escape(self.meta_type))
 
 class SiteRoot(Traverser, Implicit):
-    """SiteAccess.SiteRoot object
+    """ SiteAccess.SiteRoot object
 
     A SiteRoot causes traversal of its container to replace the part
-    of the Request path traversed so far with the request's SiteRootURL."""
-
+    of the Request path traversed so far with the request's SiteRootURL.
+    """
     id = meta_type = 'SiteRoot'
     title = ''
     priority = 50
 
-    manage_options=({'label':'Edit', 'action':'manage_main', 'help': ('SiteAccess', 'SiteRoot_Edit.stx')},)
+    manage_options=({'label':'Edit',
+                     'action':'manage_main',
+                     'help': ('SiteAccess', 'SiteRoot_Edit.stx'),
+                    },)
 
     manage = manage_main = DTMLFile('www/SiteRootEdit', globals())
     manage_main._setName('manage_main')
 
     def __init__(self, title, base, path):
-        '''Title'''
         self.title = title.strip()
         self.base = base = base.strip()
         self.path = path = path.strip()
-        if base: self.SiteRootBASE = base
-        else:
-            try: del self.SiteRootBASE
-            except: pass
-        if path: self.SiteRootPATH = path
-        else:
-            try: del self.SiteRootPATH
-            except: pass
 
     def manage_edit(self, title, base, path, REQUEST=None):
-        '''Set the title, base, and path'''
+        """ Set the title, base, and path.
+        """
         self.__init__(title, base, path)
         if REQUEST:
             return MessageDialog(title='SiteRoot changed.',
@@ -107,37 +96,36 @@
               action='%s/manage_main' % REQUEST['URL1'])
 
     def __call__(self, client, request, response=None):
-        '''Traversing'''
-        if SUPPRESS_SITEROOT: return
-        if '_SUPPRESS_SITEROOT' in _swallow(request, '_SUPPRESS'):
-            request.setVirtualRoot(request.steps)
+        """ Traversing.
+        """
+        rq = request
+        if SUPPRESS_SITEROOT:
             return
-        srd = [None, None]
-        for i in (0, 1):
-            srp = ('SiteRootBASE', 'SiteRootPATH')[i]
-            try:
-                srd[i] = getattr(self, srp)
-            except AttributeError:
-                srd[i] = request.get(srp, None)
-                if srd[i] is None:
-                    srd[i] = request.environ.get(srp, None)
-        if srd[0] is not None:
-            request['ACTUAL_URL'] = request['ACTUAL_URL'].replace(request['SERVER_URL'], srd[0])
-            request['SERVER_URL'] = srd[0]
-            request._resetURLS()
-        if srd[1] is not None:
-            old = request['URL']
-            request.setVirtualRoot(srd[1])
-            request['ACTUAL_URL'] = request['ACTUAL_URL'].replace(old, request['URL'])
+        base = (self.base or
+                rq.get('SiteRootBASE') or
+                rq.environ.get('SiteRootBASE'))
+        path = (self.path or
+                rq.get('SiteRootPATH') or
+                rq.environ.get('SiteRootPATH'))
+        if base is not None:
+            rq['ACTUAL_URL'] = rq['ACTUAL_URL'].replace(rq['SERVER_URL'], base)
+            rq['SERVER_URL'] = base
+            rq._resetURLS()
+        if path is not None:
+            old = rq['URL']
+            rq.setVirtualRoot(path)
+            rq['ACTUAL_URL'] = rq['ACTUAL_URL'].replace(old, rq['URL'])
 
     def get_size(self):
-        '''Make FTP happy'''
+        """ Make FTP happy
+        """
         return 0
 
 def manage_addSiteRoot(self, title='', base='', path='', REQUEST=None,
                        **ignored):
-    """ """
-    sr=SiteRoot(title, base, path)
+    """ Add a SiteRoot to a container.
+    """
+    sr = SiteRoot(title, base, path)
     if REQUEST:
         return sr.manage_addToContainer(self.this(),
                                         '%s/manage_main' % REQUEST['URL1'])

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/VirtualHostMonster.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/VirtualHostMonster.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/VirtualHostMonster.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -2,12 +2,8 @@
 
 Defines the VirtualHostMonster class
 """
-import os
-
 from AccessControl.Permissions import view as View
 from AccessControl.SecurityInfo import ClassSecurityInfo
-from Acquisition import aq_inner
-from Acquisition import aq_parent
 from Acquisition import Implicit
 from App.class_init import InitializeClass
 from App.Dialogs import MessageDialog
@@ -21,8 +17,6 @@
 from ZPublisher.BaseRequest import quote
 from zExceptions import BadRequest
 
-from AccessRule import _swallow
-
 class VirtualHostMonster(Persistent, Item, Implicit):
     """Provide a simple drop-in solution for virtual hosting.
     """
@@ -30,6 +24,7 @@
     meta_type='Virtual Host Monster'
     priority = 25
 
+    id = 'VHM'
     title = ''
     lines = ()
     have_map = 0
@@ -63,8 +58,9 @@
                 try:
                     host, path = [x.strip() for x in  line.split('/', 1)]
                 except:
-                    raise ValueError, (
-                        'Line needs a slash between host and path: %s' % line )
+                    raise ValueError(
+                        'Line needs a slash between host and path: %s'
+                            % line )
                 pp = filter(None, path.split( '/'))
                 if pp:
                     obpath = pp[:]
@@ -110,7 +106,8 @@
         self.lines = tuple(new_lines)
         self.have_map = not not (fixed_map or sub_map) # booleanize
         if RESPONSE is not None:
-            RESPONSE.redirect('manage_edit?manage_tabs_message=Changes%20Saved.')
+            RESPONSE.redirect(
+                'manage_edit?manage_tabs_message=Changes%20Saved.')
 
     def addToContainer(self, container):
         container._setObject(self.id, self)
@@ -200,15 +197,17 @@
                         vh_part = path.pop(0)[1:]
                     if vh_part:
                         request['VIRTUAL_URL_PARTS'] = vup = (
-                            request['SERVER_URL'], vh_part, quote('/'.join(path)))
+                            request['SERVER_URL'],
+                            vh_part, quote('/'.join(path)))
                     else:
                         request['VIRTUAL_URL_PARTS'] = vup = (
                             request['SERVER_URL'], quote('/'.join(path)))
                     request['VIRTUAL_URL'] = '/'.join(vup)
 
                     # new ACTUAL_URL
-                    add = (path and request['ACTUAL_URL'].endswith('/')) and '/' or ''
-                    request['ACTUAL_URL'] = request['VIRTUAL_URL']+add
+                    add = (path and
+                           request['ACTUAL_URL'].endswith('/')) and '/' or ''
+                    request['ACTUAL_URL'] = request['VIRTUAL_URL'] + add
 
                 return
             vh_used = 1 # Only retry once.
@@ -255,17 +254,17 @@
 InitializeClass(VirtualHostMonster)
 
 
-def manage_addVirtualHostMonster(self, id, REQUEST=None, **ignored):
+def manage_addVirtualHostMonster(self, REQUEST=None, **ignored):
     """ """
+    container = self.this()
     vhm = VirtualHostMonster()
-    vhm.id = str(id)
-    if REQUEST:
-        return vhm.manage_addToContainer(self.this(),
-                                        '%s/manage_main' % REQUEST['URL1'])
-    else:
-        vhm.addToContainer(self.this())
+    container._setObject(vhm.getId(), vhm)
 
+    if REQUEST is not None:
+        goto = '%s/manage_main' % self.absolute_url()
+        qs = 'manage_tabs_message=Virtual+Host+Monster+added.'
+        REQUEST['RESPONSE'].redirect('%s?%s' % (goto, qs))
+
 constructors = (
-  ('manage_addVirtualHostMonsterForm', DTMLFile('www/VirtualHostMonsterAdd', globals())),
   ('manage_addVirtualHostMonster', manage_addVirtualHostMonster),
 )

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,17 +1,22 @@
-__doc__="""SiteAccess product"""
+"""SiteAccess product
+"""
+def initialize(context):
+    import SiteRoot
+    import AccessRule
+    import VirtualHostMonster
 
-import SiteRoot, AccessRule, VirtualHostMonster
-
-def initialize(context):
     context.registerClass(instance_class=SiteRoot.SiteRoot,
       permission='Add Site Roots',
       constructors=SiteRoot.constructors, legacy=SiteRoot.constructors,
       icon='www/SiteRoot.gif')
+
     context.registerClass(instance_class=AccessRule.AccessRule,
       permission='Manage Access Rules', constructors=AccessRule.constructors,
       icon='www/AccessRule.gif')
+
     context.registerClass(instance_class=VirtualHostMonster.VirtualHostMonster,
       permission='Add Virtual Host Monsters',
       constructors=VirtualHostMonster.constructors,
       icon='www/VirtualHostMonster.gif')
+
     context.registerHelp()

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testAccessRule.py (from rev 112805, Zope/branches/2.12/src/Products/SiteAccess/tests/testAccessRule.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testAccessRule.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testAccessRule.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,225 @@
+import unittest
+
+
+class AccessRuleTests(unittest.TestCase):
+
+    _old_SAR = None
+
+    def setUp(self):
+        from Testing.ZopeTestCase import ZopeLite
+        ZopeLite.startup()
+
+    def tearDown(self):
+        if self._old_SAR is not None:
+            self._set_SUPPRESS_ACCESSRULE(self._old_SAR)
+
+    def _set_SUPPRESS_ACCESSRULE(self, value):
+        from Products.SiteAccess import AccessRule as AR
+        (self._old_SAR,
+         AR.SUPPRESS_ACCESSRULE) = (AR.SUPPRESS_ACCESSRULE, value)
+
+    def _getTargetClass(self):
+        from Products.SiteAccess.AccessRule import AccessRule
+        return AccessRule
+
+    def _makeOne(self, method_id='testing'):
+        return self._getTargetClass()(method_id)
+
+    def test___call___w_SUPPRESS_ACCESSRULE_set(self):
+        self._set_SUPPRESS_ACCESSRULE(1)
+        _called = []
+        def _func(*args):
+            _called.append(args)
+        rule = self._makeOne()
+        request = DummyRequest(TraversalRequestNameStack=[])
+        container = DummyContainer(testing=_func)
+        rule(container, request)
+        self.failIf(_called)
+
+    def test___call___w_SUPPRESS_ACCESSRULE_in_URL(self):
+        # This behavior changed in landing lp:142878.
+        _called = []
+        def _func(*args):
+            _called.append(args)
+        rule = self._makeOne()
+        request = DummyRequest(TraversalRequestNameStack=
+                                    ['_SUPPRESS_ACCESSRULE'])
+        request.steps = []
+        container = DummyContainer(testing=_func)
+        rule(container, request)
+        self.failUnless(_called)
+        self.assertEqual(request._virtual_root, None)
+
+    def test___call___wo_SUPPRESS_ACCESSRULE(self):
+        _called = []
+        def _func(*args):
+            _called.append(args)
+        rule = self._makeOne()
+        request = DummyRequest(TraversalRequestNameStack=[])
+        request.steps = []
+        container = DummyContainer(testing=_func)
+        rule(container, request)
+        self.failUnless(_called)
+        self.assertEqual(request._virtual_root, None)
+
+
+class Test_manage_addAccessRule(unittest.TestCase):
+
+    def _callFUT(self, container, method_id, REQUEST):
+        from Products.SiteAccess.AccessRule import manage_addAccessRule
+        return manage_addAccessRule(container, method_id, REQUEST)
+
+    def test_no_method_id_no_existing_rules_no_request(self):
+        container = DummyContainer()
+        result = self._callFUT(container, None, None)
+        self.failUnless(result is None)
+        self.failIf(container.__dict__)
+
+    def test_no_method_id_no_existing_rules_w_request(self):
+        container = DummyContainer()
+        result = self._callFUT(container, None, {'URL1': 'http://example.com/'})
+        self.failUnless(isinstance(result, str))
+        self.failUnless('<TITLE>No Access Rule</TITLE>' in result)
+        self.failIf(container.__dict__)
+
+    def test_no_method_id_w_existing_rules_no_request(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        result = self._callFUT(container, None, None)
+        self.failUnless(result is None)
+        self.failIf(container.__before_traverse__)
+        self.failIf('icon' in old_rule.__dict__)
+
+    def test_w_method_id_w_existing_rules_w_request_none(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        request = DummyRequest(URL1 = 'http://example.com/')
+        request.form = {'none': '1'}
+        result = self._callFUT(container, None, request)
+        self.failUnless(isinstance(result, str))
+        self.failUnless('<TITLE>No Access Rule</TITLE>' in result)
+        self.failIf(container.__before_traverse__)
+        self.failIf('icon' in old_rule.__dict__)
+
+    def test_w_invalid_method_id_w_existing_rules_no_request(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        result = self._callFUT(container, 'nonesuch', None)
+        self.failUnless(result is None)
+        self.failUnless((99, 'AccessRule') in container.__before_traverse__)
+        rule = container.__before_traverse__[(99, 'AccessRule')]
+        self.assertEqual(rule.name, 'old_rule')
+        self.assertEqual(old_rule.icon, 'rule_icon.jpg')
+
+    def test_w_invalid_method_id_w_existing_rules_w_request(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        request = DummyRequest(URL1 = 'http://example.com/')
+        request.form = {}
+        result = self._callFUT(container, 'nonesuch', request)
+        self.failUnless(isinstance(result, str))
+        self.failUnless('<TITLE>Invalid Method Id</TITLE>' in result)
+        self.failUnless((99, 'AccessRule') in container.__before_traverse__)
+        rule = container.__before_traverse__[(99, 'AccessRule')]
+        self.assertEqual(rule.name, 'old_rule')
+        self.assertEqual(old_rule.icon, 'rule_icon.jpg')
+
+    def test_w_valid_method_id_w_existing_rules_no_request(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        new_rule = container.new_rule = DummyObject(name='new_rule')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        result = self._callFUT(container, 'new_rule', None)
+        self.failUnless(result is None)
+        self.failIf((99, 'AccessRule') in container.__before_traverse__)
+        self.failUnless((1, 'AccessRule') in container.__before_traverse__)
+        rule = container.__before_traverse__[(1, 'AccessRule')]
+        self.assertEqual(rule.name, 'new_rule')
+        self.failIf('icon' in old_rule.__dict__)
+        self.assertEqual(new_rule.icon, 'misc_/SiteAccess/AccessRule.gif')
+
+    def test_w_valid_method_id_w_existing_rules_w_request(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        old_rule = container.old_rule = DummyObject(name='old_rule',
+                                                    icon='rule_icon.jpg')
+        new_rule = container.new_rule = DummyObject(name='new_rule')
+        registerBeforeTraverse(container, old_rule, 'AccessRule')
+        request = DummyRequest(URL1 = 'http://example.com/')
+        request.form = {}
+        result = self._callFUT(container, 'new_rule', request)
+        self.failUnless(isinstance(result, str))
+        self.failUnless('<TITLE>Access Rule Set</TITLE>' in result)
+        self.failIf((99, 'AccessRule') in container.__before_traverse__)
+        self.failUnless((1, 'AccessRule') in container.__before_traverse__)
+        rule = container.__before_traverse__[(1, 'AccessRule')]
+        self.assertEqual(rule.name, 'new_rule')
+        self.failIf('icon' in old_rule.__dict__)
+        self.assertEqual(new_rule.icon, 'misc_/SiteAccess/AccessRule.gif')
+
+
+class Test_getAccessRule(unittest.TestCase):
+
+    def _callFUT(self, container, REQUEST=None):
+        from Products.SiteAccess.AccessRule import getAccessRule
+        return getAccessRule(container, REQUEST)
+
+    def test_no_rules(self):
+        container = DummyContainer()
+        self.assertEqual(self._callFUT(container), '')
+
+    def test_w_rule_invalid(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        registerBeforeTraverse(container, DummyObject(), 'AccessRule')
+        self.failUnless(self._callFUT(container).startswith(
+                                        'Invalid BeforeTraverse data: '))
+
+    def test_w_rule_valid(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        container = DummyContainer()
+        registerBeforeTraverse(container, DummyObject(name='foo'), 'AccessRule')
+        self.assertEqual(self._callFUT(container), 'foo')
+
+
+class DummyRequest(dict):
+    _virtual_root = None
+    def setVirtualRoot(self, root):
+        self._virtual_root = root
+
+
+class DummyObject(object):
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+
+class DummyContainer(object):
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+    def this(self):
+        return self
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(AccessRuleTests),
+        unittest.makeSuite(Test_manage_addAccessRule),
+        unittest.makeSuite(Test_getAccessRule),
+    ))
+

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testSiteRoot.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testSiteRoot.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testSiteRoot.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -4,47 +4,309 @@
 set correctly when a SiteRoot is used.
 
 See http://www.zope.org/Collectors/Zope/2077
-
 """
+import unittest
 
-from Testing.makerequest import makerequest
 
-import Zope2
-Zope2.startup()
+class TraverserTests(unittest.TestCase):
 
-import transaction
+    def _getTargetClass(self):
+        from Products.SiteAccess.SiteRoot import Traverser
+        return Traverser
 
-import unittest
+    def _makeOne(self):
+        traverser = self._getTargetClass()()
+        traverser.id = 'testing'
+        return traverser
 
+    def test_addToContainer(self):
+        traverser = self._makeOne()
+        container = DummyContainer()
+        traverser.addToContainer(container)
+        self.failUnless(container.testing is traverser)
+        hook = container.__before_traverse__[(100, 'Traverser')]
+        self.assertEqual(hook.name, 'testing')
+
+    def test_manage_addToContainer_no_nextUrl(self):
+        traverser = self._makeOne()
+        container = DummyContainer()
+        result = traverser.manage_addToContainer(container)
+        self.failUnless(result is None)
+        self.failUnless(container.testing is traverser)
+        hook = container.__before_traverse__[(100, 'Traverser')]
+        self.assertEqual(hook.name, 'testing')
+
+    def test_manage_addToContainer_w_nextUrl_w_name_collision(self):
+        NEXTURL='http://example.com/manage_main'
+        traverser = self._makeOne()
+        container = DummyContainer()
+        container.testing = object()
+        result = traverser.manage_addToContainer(container, nextURL=NEXTURL)
+        self.failUnless('<TITLE>Item Exists</TITLE>' in result)
+        self.failIf(container.testing is traverser)
+
+    def test_manage_addToContainer_w_nextUrl_wo_name_collision(self):
+        NEXTURL='http://example.com/manage_main'
+        traverser = self._makeOne()
+        container = DummyContainer()
+        result = traverser.manage_addToContainer(container, nextURL=NEXTURL)
+        self.failUnless('<TITLE>Item Added</TITLE>' in result)
+        self.failUnless(container.testing is traverser)
+        hook = container.__before_traverse__[(100, 'Traverser')]
+        self.assertEqual(hook.name, 'testing')
+
+    def test_manage_beforeDelete_item_is_not_self(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        traverser = self._makeOne()
+        container = DummyContainer()
+        other = container.other = DummyObject(name='other')
+        registerBeforeTraverse(container, other, 'Traverser', 100)
+        item = object()
+        traverser.manage_beforeDelete(item, container)
+        hook = container.__before_traverse__[(100, 'Traverser')]
+        self.assertEqual(hook.name, 'other')
+
+    def test_manage_beforeDelete_item_is_self(self):
+        from ZPublisher.BeforeTraverse import registerBeforeTraverse
+        traverser = self._makeOne()
+        container = DummyContainer()
+        other = container.other = DummyObject(name='other')
+        registerBeforeTraverse(container, other, 'Traverser', 100)
+        traverser.manage_beforeDelete(traverser, container)
+        self.failIf(container.__before_traverse__)
+
+    def test_manage_afterAdd_item_not_self(self):
+        traverser = self._makeOne()
+        container = DummyContainer()
+        item = object()
+        traverser.manage_afterAdd(item, container)
+        self.failIf('__before_traverse__' in container.__dict__)
+
+    def test_manage_afterAdd_item_is_self(self):
+        traverser = self._makeOne()
+        container = DummyContainer()
+        traverser.manage_afterAdd(traverser, container)
+        hook = container.__before_traverse__[(100, 'Traverser')]
+        self.assertEqual(hook.name, 'testing')
+
+    def test__setId_same(self):
+        traverser = self._makeOne()
+        traverser._setId('testing') # doesn't raise
+
+    def test__setId_different(self):
+        traverser = self._makeOne()
+        self.assertRaises(ValueError, traverser._setId, 'other')
+
+
+class SiteRootTests(unittest.TestCase):
+
+    _old_SSR = None
+
+    def setUp(self):
+        from Testing.ZopeTestCase import ZopeLite
+        ZopeLite.startup()
+
+    def tearDown(self):
+        if self._old_SSR is not None:
+            self._set_SUPPRESS_SITEROOT(self._old_SSR)
+
+    def _set_SUPPRESS_SITEROOT(self, value):
+        from Products.SiteAccess import SiteRoot as SR
+        (self._old_SSR,
+         SR.SUPPRESS_SITEROOT) = (SR.SUPPRESS_SITEROOT, value)
+
+    def _getTargetClass(self):
+        from Products.SiteAccess.SiteRoot import SiteRoot
+        return SiteRoot
+
+    def _makeOne(self, title='TITLE', base='', path=''):
+        return self._getTargetClass()(title, base, path)
+
+    def test___init___strips_base_and_path(self):
+        siteroot = self._makeOne(base=' ', path=' ')
+        self.assertEqual(siteroot.title, 'TITLE')
+        self.assertEqual(siteroot.base, '')
+        self.assertEqual(siteroot.path, '')
+
+    def test___init___w_base_and_path(self):
+        siteroot = self._makeOne(base='http://example.com', path='/path')
+        self.assertEqual(siteroot.title, 'TITLE')
+        self.assertEqual(siteroot.base, 'http://example.com')
+        self.assertEqual(siteroot.path, '/path')
+
+    def test_manage_edit_no_REQUEST(self):
+        siteroot = self._makeOne(title='Before',
+                                 base='http://before.example.com',
+                                 path='/before')
+        result = siteroot.manage_edit('After', 'http://after.example.com ',
+                                      '/after ')
+        self.failUnless(result is None)
+        self.assertEqual(siteroot.title, 'After')
+        self.assertEqual(siteroot.base, 'http://after.example.com')
+        self.assertEqual(siteroot.path, '/after')
+
+    def test_manage_edit_w_REQUEST(self):
+        siteroot = self._makeOne(title='Before',
+                                 base='http://before.example.com',
+                                 path='/before')
+        result = siteroot.manage_edit('After', 'http://after.example.com ',
+                                      '/after ',
+                                      REQUEST = {'URL1':
+                                        'http://localhost:8080/manage_main'})
+        self.failUnless('<TITLE>SiteRoot changed.</TITLE>' in result)
+        self.assertEqual(siteroot.title, 'After')
+        self.assertEqual(siteroot.base, 'http://after.example.com')
+        self.assertEqual(siteroot.path, '/after')
+
+    def test___call___w_SUPPRESS_SITEROOT_set(self):
+        self._set_SUPPRESS_SITEROOT(1)
+        siteroot = self._makeOne(base='http://example.com', path='/path')
+        request = {}
+        siteroot(None, request)
+        self.assertEqual(request, {})
+
+    def test___call___w_SUPPRESS_SITEROOT_in_URL(self):
+        # This behavior changed in landing lp:142878.
+        URL='http://localhost:8080/example/folder/'
+        siteroot = self._makeOne(base='http://example.com', path='/example')
+        request = DummyRequest(TraversalRequestNameStack=
+                                    ['_SUPPRESS_SITEROOT'],
+                               URL=URL,
+                               ACTUAL_URL=URL,
+                               SERVER_URL='http://localhost:8080',
+                              )
+        request.steps = []
+        request.environ = {}
+        siteroot(None, request)
+        self.assertEqual(request['URL'], URL)
+        self.assertEqual(request['SERVER_URL'], 'http://example.com')
+        self.assertEqual(request['ACTUAL_URL'], 
+                         'http://example.com/example/folder/')
+        self.assertEqual(request._virtual_root, '/example')
+        self.failUnless(request._urls_reset)
+
+    def test___call___wo_SUPPRESS_SITEROOT_w_base_wo_path(self):
+        URL='http://localhost:8080/example/folder/'
+        siteroot = self._makeOne(base='http://example.com', path='')
+        request = DummyRequest(TraversalRequestNameStack=[],
+                               URL=URL,
+                               ACTUAL_URL=URL,
+                               SERVER_URL='http://localhost:8080',
+                              )
+        request.steps = []
+        request.environ = {}
+        siteroot(None, request)
+        self.assertEqual(request['URL'], URL)
+        self.assertEqual(request['SERVER_URL'], 'http://example.com')
+        self.assertEqual(request['ACTUAL_URL'],
+                         'http://example.com/example/folder/')
+        self.assertEqual(request._virtual_root, None)
+        self.failUnless(request._urls_reset)
+
+    def test___call___wo_SUPPRESS_SITEROOT_wo_base_w_path(self):
+        URL='http://localhost:8080/example/folder/'
+        siteroot = self._makeOne(base='', path='/example')
+        request = DummyRequest(TraversalRequestNameStack=[],
+                               URL=URL,
+                               ACTUAL_URL=URL,
+                               SERVER_URL='http://localhost:8080',
+                              )
+        request.steps = []
+        request.environ = {}
+        siteroot(None, request)
+        self.assertEqual(request['URL'], URL)
+        self.assertEqual(request['SERVER_URL'], 'http://localhost:8080')
+        self.assertEqual(request['ACTUAL_URL'], URL)
+        self.assertEqual(request._virtual_root, '/example')
+        self.failIf(request._urls_reset)
+
+    def test___call___wo_SUPPRESS_SITEROOT_w_base_w_path(self):
+        URL='http://localhost:8080/example/folder/'
+        siteroot = self._makeOne(base='http://example.com', path='/example')
+        request = DummyRequest(TraversalRequestNameStack=[],
+                               URL=URL,
+                               ACTUAL_URL=URL,
+                               SERVER_URL='http://localhost:8080',
+                              )
+        request.steps = []
+        request.environ = {}
+        siteroot(None, request)
+        self.assertEqual(request['URL'], URL)
+        self.assertEqual(request['SERVER_URL'], 'http://example.com')
+        self.assertEqual(request['ACTUAL_URL'], 
+                         'http://example.com/example/folder/')
+        self.assertEqual(request._virtual_root, '/example')
+        self.failUnless(request._urls_reset)
+
+    def test_get_size(self):
+        siteroot = self._makeOne()
+        self.assertEqual(siteroot.get_size(), 0)
+
+
+class DummyObject(object):
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+
+class DummyContainer(object):
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+    def _setObject(self, name, object):
+        setattr(self, name, object)
+
+    def this(self):
+        return self
+
+
+class DummyRequest(dict):
+
+    _virtual_root = None
+    _urls_reset = False
+
+    def setVirtualRoot(self, root):
+        self._virtual_root = root
+
+    def _resetURLS(self):
+        self._urls_reset = True
+
+
 class SiteRootRegressions(unittest.TestCase):
 
     def setUp(self):
+        import transaction
+        from Testing.makerequest import makerequest
+        from Testing.ZopeTestCase.ZopeLite import app
         transaction.begin()
-        self.app = makerequest(Zope2.app())
-        try:
-            self.app.manage_addFolder('folder')
-	    self.app.folder.manage_addProduct['SiteAccess'].manage_addSiteRoot(title = 'SiteRoot', base = 'http://test_base', path = '/test_path')
-	    self.app.REQUEST.set('PARENTS', [self.app])
-	    self.app.REQUEST.traverse('/folder')
-	    
-        except:
-            self.tearDown()
+        self.app = makerequest(app())
+        self.app.manage_addFolder('folder')
+        p_disp = self.app.folder.manage_addProduct['SiteAccess']
+        p_disp.manage_addSiteRoot(title='SiteRoot',
+                                    base='http://test_base',
+                                    path='/test_path')
+        self.app.REQUEST.set('PARENTS', [self.app])
+        self.app.REQUEST.traverse('/folder')
 
     def tearDown(self):
+        import transaction
         transaction.abort()
         self.app._p_jar.close()
-	
+        
     def testRequest(self):
         self.assertEqual(self.app.REQUEST['SERVER_URL'], 'http://test_base') 
-	self.assertEqual(self.app.REQUEST['URL'], 'http://test_base/test_path/index_html')
-	self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://test_base/test_path')
-    def testAbsoluteUrl(self):	    
-	self.assertEqual(self.app.folder.absolute_url(), 'http://test_base/test_path')
+        self.assertEqual(self.app.REQUEST['URL'],
+                         'http://test_base/test_path/index_html')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://test_base/test_path')
+    def testAbsoluteUrl(self):            
+        self.assertEqual(self.app.folder.absolute_url(),
+                         'http://test_base/test_path')
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(SiteRootRegressions))
-    return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')
+    return unittest.TestSuite((
+        unittest.makeSuite(TraverserTests),
+        unittest.makeSuite(SiteRootTests),
+        unittest.makeSuite(SiteRootRegressions),
+    ))

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testVirtualHostMonster.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testVirtualHostMonster.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/tests/testVirtualHostMonster.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -6,38 +6,30 @@
 Also see http://zope.org/Collectors/Zope/809
 
 Note: Tests require Zope >= 2.7
-
-$Id$
 """
-
-from Testing.makerequest import makerequest
-
-import Zope2
-Zope2.startup()
-
-import transaction
-
 import unittest
 
-
 class VHMRegressions(unittest.TestCase):
 
     def setUp(self):
+        import transaction
+        from Testing.makerequest import makerequest
+        from Testing.ZopeTestCase.ZopeLite import app
         transaction.begin()
-        self.app = makerequest(Zope2.app())
-        try:
-            if not hasattr(self.app, 'virtual_hosting'):
-                # If ZopeLite was imported, we have no default virtual host monster
-                from Products.SiteAccess.VirtualHostMonster import manage_addVirtualHostMonster
-                manage_addVirtualHostMonster(self.app, 'virtual_hosting')
-            self.app.manage_addFolder('folder')
-            self.app.folder.manage_addDTMLMethod('doc', '')
-            self.app.REQUEST.set('PARENTS', [self.app])
-            self.traverse = self.app.REQUEST.traverse
-        except:
-            self.tearDown()
+        self.app = makerequest(app())
+        if 'virtual_hosting' not in  self.app.objectIds():
+            # If ZopeLite was imported, we have no default virtual
+            # host monster
+            from Products.SiteAccess.VirtualHostMonster \
+                import manage_addVirtualHostMonster
+            manage_addVirtualHostMonster(self.app, 'virtual_hosting')
+        self.app.manage_addFolder('folder')
+        self.app.folder.manage_addDTMLMethod('doc', '')
+        self.app.REQUEST.set('PARENTS', [self.app])
+        self.traverse = self.app.REQUEST.traverse
 
     def tearDown(self):
+        import transaction
         transaction.abort()
         self.app._p_jar.close()
 
@@ -59,17 +51,54 @@
         m = self.app.folder.doc.getPhysicalPath
         self.assertEqual(m(), ('', 'folder', 'doc'))
 
-    def test_actual_url(self):
-        self.app.folder.manage_addDTMLMethod('index_html', '')
-        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/doc/')
-        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/doc/')
-        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/doc')
-        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/doc')
-        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot/')
-        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/')
-        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80/folder/VirtualHostRoot')
-        self.assertEqual(self.app.REQUEST['ACTUAL_URL'], 'http://www.mysite.com/') 
+    def test_actual_url_no_VHR_no_doc_w_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                        'http://www.mysite.com/folder/')
 
+    def test_actual_url_no_VHR_no_doc_no_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://www.mysite.com/folder')
+
+    def test_actual_url_no_VHR_w_doc_w_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/doc/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                        'http://www.mysite.com/folder/doc/')
+
+    def test_actual_url_no_VHR_w_doc_no_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/doc')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://www.mysite.com/folder/doc')
+
+    def test_actual_url_w_VHR_w_doc_w_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/VirtualHostRoot/doc/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                        'http://www.mysite.com/doc/')
+
+    def test_actual_url_w_VHR_w_doc_no_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/VirtualHostRoot/doc')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://www.mysite.com/doc')
+
+    def test_actual_url_w_VHR_no_doc_w_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/VirtualHostRoot/')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://www.mysite.com/')
+
+    def test_actual_url_w_VHR_no_doc_no_trailing_slash(self):
+        ob = self.traverse('/VirtualHostBase/http/www.mysite.com:80'
+                           '/folder/VirtualHostRoot')
+        self.assertEqual(self.app.REQUEST['ACTUAL_URL'],
+                         'http://www.mysite.com/') 
+
 def gen_cases():
     for vbase, ubase in (
         ('', 'http://foo'),
@@ -111,11 +140,66 @@
     setattr(VHMRegressions, 'testTraverse%s' % i, test)
 
 
+class VHMAddingTests(unittest.TestCase):
+
+    def setUp(self):
+        from OFS.Folder import Folder
+        super(VHMAddingTests, self).setUp()
+        self.root = Folder('root')
+
+    def _makeOne(self):
+        from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster
+        return VirtualHostMonster()
+
+    def test_add_with_existing_vhm(self):
+        from Products.SiteAccess.VirtualHostMonster import \
+            manage_addVirtualHostMonster
+        from zExceptions import BadRequest
+        vhm1 = self._makeOne()
+        vhm1.manage_addToContainer(self.root)
+
+        vhm2 = self._makeOne()
+        self.assertRaises(BadRequest, vhm2.manage_addToContainer, self.root)
+        self.assertRaises( BadRequest
+                         , manage_addVirtualHostMonster
+                         , self.root
+                         )
+
+    def test_add_id_collision(self):
+        from OFS.Folder import Folder
+        from Products.SiteAccess.VirtualHostMonster import \
+            manage_addVirtualHostMonster
+        from zExceptions import BadRequest
+        self.root._setObject('VHM', Folder('VHM'))
+        vhm1 = self._makeOne()
+
+        self.assertRaises(BadRequest, vhm1.manage_addToContainer, self.root)
+        self.assertRaises( BadRequest
+                         , manage_addVirtualHostMonster
+                         , self.root
+                         )
+
+    def test_add_addToContainer(self):
+        from ZPublisher.BeforeTraverse import queryBeforeTraverse
+        vhm1 = self._makeOne()
+        vhm1.manage_addToContainer(self.root)
+
+        self.failUnless(vhm1.getId() in self.root.objectIds())
+        self.failUnless(queryBeforeTraverse(self.root, vhm1.meta_type))
+
+    def test_add_manage_addVirtualHostMonster(self):
+        from Products.SiteAccess.VirtualHostMonster import \
+            manage_addVirtualHostMonster
+        from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster
+        from ZPublisher.BeforeTraverse import queryBeforeTraverse
+        manage_addVirtualHostMonster(self.root)
+
+        self.failUnless(VirtualHostMonster.id in self.root.objectIds())
+        hook = queryBeforeTraverse(self.root, VirtualHostMonster.meta_type)
+        self.failUnless(hook)
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(VHMRegressions))
+    suite.addTest(unittest.makeSuite(VHMAddingTests))
     return suite
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')
-

Deleted: Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/www/VirtualHostMonsterAdd.dtml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/www/VirtualHostMonsterAdd.dtml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteAccess/www/VirtualHostMonsterAdd.dtml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,61 +0,0 @@
-<dtml-var manage_page_header>
-
-<dtml-let form_title="'Add Virtual Host Monster'">
-  <dtml-var manage_form_title>
-</dtml-let>
-
-<p class="form-help">
-A Virtual Host Monster changes the URLs generated by all objects 
-within the same Folder, using information passed to it in special URL 
-path elements. This is useful if you are using some rewriting tool 
-(Apache or an Access Rule, for example) to insert these special 
-elements into your URL.
-</p>
-
-<p class="form-help">
-To set the protocol ('http', 'https') and host ('www.foo.com') portion
-of generated URLs, insert &quot;VirtualHostBase&quot;, the protocol,
-and the host into the path.
-</p>
-
-<p class="form-help">
-Insert &quot;VirtualHostRoot&quot; directly after the name of the
-Folder that is supposed to be the root of the virtual host.<br><br>
-For example, to publish Folder &quot;/foo&quot; as <b>http://www.foo.com/</b>,
-put a Virtual Host Monster in the root folder and rewrite requests for that
-URL to <b>/VirtualHostBase/http/www.foo.com/foo/VirtualHostRoot/</b>
-</p>
-
-<p class="form-help">
-Values affected include DTML variables starting with URL or BASE, and 
-the absolute_url() methods of objects.
-</p> 
-
-
-<form action="manage_addVirtualHostMonster" method="post">
-<table cellspacing="0" cellpadding="2" border="0">
-  <tr>
-    <td align="left" valign="top">
-    <div class="form-label">
-    Id
-    </div>
-    </td>
-    <td align="left" valign="top">
-    <input type="text" name="id" size="40" />
-    </td>
-  </tr>
-  <tr>
-    <td align="left" valign="top">
-    </td>
-    <td align="left" valign="top">
-    <div class="form-element">
-    <input class="form-element" type="submit" name="submit" 
-     value=" Add " /> 
-    </div>
-    </td>
-  </tr>
-</table>
-</form>
-
-<dtml-var manage_page_footer>
-

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/SiteErrorLog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/SiteErrorLog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/SiteErrorLog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/www/main.pt
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/www/main.pt	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/SiteErrorLog/www/main.pt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -85,7 +85,7 @@
     >
     <span tal:content="entry/type">AttributeError</span>:
     <span tal:define="value entry/value"
-      tal:content="python: len(value) < 70 and value or value[:70] + '...'">
+      tal:content="python: len(value) &lt; 70 and value or value[:70] + '...'">
       Application object has no attribute "zzope"</span>
    </a>
   </td>
@@ -93,7 +93,7 @@
      tal:attributes="href string:${context/absolute_url}/forgetEntry?id=${entry/id}"
   ><img title="Forget this entry" src="/misc_/SiteErrorLog/ok.gif" border="0"
      tal:attributes="src string:${request/BASEPATH1}/misc_/SiteErrorLog/ok.gif"
-  ></a></td>
+  /></a></td>
  </tr>
 </table>
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -166,12 +166,16 @@
         self._settings = {'anonymous_only':1,
                           'interval':3600,
                           'notify_urls':()}
-        self.__cacheid = '%s_%f' % (id(self), time.time())
+        self._resetCacheId()
 
     def getId(self):
         ' '
         return self.id
 
+    security.declarePrivate('_resetCacheId')
+    def _resetCacheId(self):
+        self.__cacheid = '%s_%f' % (id(self), time.time())
+
     security.declarePrivate('ZCacheManager_getCache')
     def ZCacheManager_getCache(self):
         cacheid = self.__cacheid

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/RAMCacheManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/RAMCacheManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/RAMCacheManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -374,12 +374,16 @@
             'request_vars': ('AUTHENTICATED_USER',),
             'max_age': 3600,
             }
-        self.__cacheid = '%s_%f' % (id(self), time.time())
+        self._resetCacheId()
 
     def getId(self):
         ' '
         return self.id
 
+    security.declarePrivate('_resetCacheId')
+    def _resetCacheId(self):
+        self.__cacheid = '%s_%f' % (id(self), time.time())
+
     ZCacheManager_getCache__roles__ = ()
     def ZCacheManager_getCache(self):
         cacheid = self.__cacheid

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/configure.zcml (from rev 112805, Zope/branches/2.12/src/Products/StandardCacheManagers/configure.zcml)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/configure.zcml	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/configure.zcml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,13 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+  <subscriber
+    for="Products.StandardCacheManagers.RAMCacheManager.RAMCacheManager
+         OFS.interfaces.IObjectClonedEvent"
+    handler="Products.StandardCacheManagers.subscribers.cloned" />
+
+  <subscriber
+    for="Products.StandardCacheManagers.AcceleratedHTTPCacheManager.AcceleratedHTTPCacheManager
+         OFS.interfaces.IObjectClonedEvent"
+    handler="Products.StandardCacheManagers.subscribers.cloned" />
+
+</configure>

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/subscribers.py (from rev 112805, Zope/branches/2.12/src/Products/StandardCacheManagers/subscribers.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/subscribers.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/subscribers.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation 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.
+#
+##############################################################################
+""" subscribers to events affecting StandardCacheManagers
+"""
+
+
+def cloned(obj, event):
+    """
+    Reset the Id of the module level cache so the clone gets a different cache
+    than its source object
+    """ 
+    obj._resetCacheId()
+

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_AcceleratedHTTPCacheManager.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_AcceleratedHTTPCacheManager.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_AcceleratedHTTPCacheManager.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Copied: Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py (from rev 112805, Zope/branches/2.12/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/StandardCacheManagers/tests/test_CacheManagerLocation.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,133 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation 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 tests for AcceleratedCacheManager module.
+
+$Id$
+"""
+
+import unittest
+
+import transaction
+import zope.component
+
+from zope.component import testing as componenttesting
+from zope.component import eventtesting
+
+from AccessControl import SecurityManager
+from AccessControl.SecurityManagement import newSecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
+from OFS.Folder import Folder
+from OFS.tests.testCopySupport import CopySupportTestBase
+from OFS.tests.testCopySupport import UnitTestSecurityPolicy
+from OFS.tests.testCopySupport import UnitTestUser
+
+from Products.Five import zcml
+from Products.StandardCacheManagers.RAMCacheManager import RAMCacheManager
+from Products.StandardCacheManagers.AcceleratedHTTPCacheManager \
+     import AcceleratedHTTPCacheManager
+import Products.StandardCacheManagers
+
+CACHE_META_TYPES = tuple(dict(name=instance_class.meta_type,
+                              action='unused_constructor_name',
+                              permission="Add %ss" % instance_class.meta_type)
+                         for instance_class in (RAMCacheManager,
+                                                AcceleratedHTTPCacheManager)
+                         )
+
+class CacheManagerLocationTests(CopySupportTestBase):
+
+    _targetClass = None
+
+    def _makeOne(self, *args, **kw):
+        return self._targetClass(*args, **kw)
+
+    def setUp( self ):
+        componenttesting.setUp()
+        eventtesting.setUp()
+        zcml.load_config('meta.zcml', zope.component)
+        zcml.load_config('configure.zcml', Products.StandardCacheManagers)
+
+        folder1, folder2 = self._initFolders()
+
+        folder1.all_meta_types = folder2.all_meta_types = CACHE_META_TYPES
+
+        self.folder1 = folder1
+        self.folder2 = folder2
+
+        self.policy = UnitTestSecurityPolicy()
+        self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
+
+        cm_id = 'cache'
+        manager = self._makeOne(cm_id)
+        self.folder1._setObject(cm_id, manager)
+        self.cachemanager = self.folder1[cm_id]
+        transaction.savepoint(optimistic=True)
+
+        newSecurityManager( None, UnitTestUser().__of__( self.root ) )
+
+        CopySupportTestBase.setUp(self)
+
+    def tearDown( self ):
+
+        noSecurityManager()
+        SecurityManager.setSecurityPolicy( self.oldPolicy )
+        del self.oldPolicy
+        del self.policy
+        del self.folder2
+        del self.folder1
+
+        self._cleanApp()
+        componenttesting.tearDown()
+        CopySupportTestBase.tearDown(self)
+
+    def test_cache_differs_on_copy(self):
+        # ensure copies don't hit the same cache
+        cache = self.cachemanager.ZCacheManager_getCache()
+        cachemanager_copy = self.folder2.manage_clone(self.cachemanager,
+                                                      'cache_copy')
+        cache_copy = cachemanager_copy.ZCacheManager_getCache()
+        self.assertNotEqual(cache, cache_copy)
+
+    def test_cache_remains_on_move(self):
+        # test behaviour of cache on move.
+        # NOTE: This test verifies current behaviour, but there is no actual
+        # need for cache managers to maintain the same cache on move.
+        # if physical path starts being used as a cache key, this test might
+        # need to be fixed.
+        cache = self.cachemanager.ZCacheManager_getCache()
+        cut = self.folder1.manage_cutObjects(['cache'])
+        self.folder2.manage_pasteObjects(cut)
+        cachemanager_moved = self.folder2['cache']
+        cache_moved = cachemanager_moved.ZCacheManager_getCache()
+        self.assertEqual(cache, cache_moved)
+
+    # XXX test cache is removed if cachemanager is deleted to prevent leaks?
+
+class AcceleratedHTTPCacheManagerLocationTests(CacheManagerLocationTests):
+
+    _targetClass = AcceleratedHTTPCacheManager
+
+class RamCacheManagerLocationTests(CacheManagerLocationTests):
+
+    _targetClass = RAMCacheManager
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(AcceleratedHTTPCacheManagerLocationTests))
+    suite.addTest(unittest.makeSuite(RamCacheManagerLocationTests))
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')
+

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/LowConflictConnection.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/LowConflictConnection.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/LowConflictConnection.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/TemporaryFolder.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/TemporaryFolder.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/TemporaryFolder.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/mount.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/mount.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/mount.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/patchfs.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/patchfs.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/TemporaryFolder/patchfs.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -2,7 +2,7 @@
 # id manager, and session data manager
 ############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Fake.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Fake.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Fake.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Transience.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Transience.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/Transience.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransienceInterfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransienceInterfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransienceInterfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##########################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransientObject.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransientObject.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/TransientObject.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/help/TransienceInterfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/help/TransienceInterfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/help/TransienceInterfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##########################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransactionHelper.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransactionHelper.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransactionHelper.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObject.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObject.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObject.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObjectContainer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObjectContainer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/Transience/tests/testTransientObjectContainer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/BaseIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/BaseIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/BaseIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/CosineIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/CosineIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/CosineIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/HTMLSplitter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/HTMLSplitter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/HTMLSplitter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/INBest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/INBest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/INBest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElement.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElement.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElement.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElementFactory.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElementFactory.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IPipelineElementFactory.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParseTree.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParseTree.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParseTree.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/IQueryParser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ISplitter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ISplitter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ISplitter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/Lexicon.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/Lexicon.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/Lexicon.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/NBest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/NBest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/NBest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/OkapiIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/OkapiIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/OkapiIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ParseTree.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ParseTree.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ParseTree.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/PipelineFactory.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/PipelineFactory.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/PipelineFactory.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/QueryParser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/QueryParser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/QueryParser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/RiceCode.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/RiceCode.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/RiceCode.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/SetOps.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/SetOps.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/SetOps.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/StopDict.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/StopDict.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/StopDict.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/WidCode.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/WidCode.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/WidCode.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ZCTextIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ZCTextIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/ZCTextIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -253,7 +253,7 @@
             del self._v_lexicon
         except (AttributeError, KeyError):
             pass
-        self.index = self._index_factory(self.getLexicon())
+        self.index = self._index_factory(aq_base(self.getLexicon()))
 
     ## User Interface Methods ##
 
@@ -358,7 +358,7 @@
         """
         if words:
             wids = []
-            for word in words:
+            for word in self.parseTerms(words):
                 wids.extend(self.globToWordIds(word))
             words = [self.get_word(wid) for wid in wids]
         else:
@@ -384,17 +384,21 @@
             columns.append(words[i:i + rows])
             i += rows
 
-        return self._queryLexicon(self, REQUEST,
-                                  page=page,
-                                  rows=rows,
-                                  cols=cols,
-                                  start_word=start+1,
-                                  end_word=end,
-                                  word_count=word_count,
-                                  page_count=page_count,
-                                  page_range=xrange(page_count),
-                                  page_columns=columns)
+        info = dict(page=page,
+                    rows=rows,
+                    cols=cols,
+                    start_word=start+1,
+                    end_word=end,
+                    word_count=word_count,
+                    page_count=page_count,
+                    page_range=xrange(page_count),
+                    page_columns=columns)
 
+        if REQUEST is not None:
+            return self._queryLexicon(self, REQUEST, **info)
+
+        return info
+
     security.declareProtected(LexiconMgmtPerm, 'manage_main')
     manage_main = DTMLFile('dtml/manageLexicon', globals())
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/okascore.c
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/okascore.c	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/okascore.c	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-  Copyright (c) 2002 Zope Corporation and Contributors.
+  Copyright (c) 2002 Zope Foundation and Contributors.
   All Rights Reserved.
 
   This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/stopper.c
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/stopper.c	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/stopper.c	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-  Copyright (c) 2002 Zope Corporation and Contributors.
+  Copyright (c) 2002 Zope Foundation and Contributors.
   All Rights Reserved.
   
   This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testLexicon.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testLexicon.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testLexicon.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testNBest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testNBest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testNBest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testParseTree.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testParseTree.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testParseTree.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2008 Zope Corporation and Contributors.
+# Copyright (c) 2008 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testPipelineFactory.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testPipelineFactory.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testPipelineFactory.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryEngine.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryEngine.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryEngine.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryParser.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryParser.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testQueryParser.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testSetOps.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testSetOps.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testSetOps.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testStopper.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testStopper.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testStopper.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testZCTextIndex.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testZCTextIndex.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCTextIndex/tests/testZCTextIndex.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -245,6 +245,7 @@
                     nbest, total = self.zc_index.query(w)
                     self.assertEqual(total, 0, "did not expect to find %s" % w)
 
+
 class CosineIndexTests(ZCIndexTestsBase, testIndex.CosineIndexTest):
 
     # A fairly involved test of the ranking calculations based on
@@ -566,15 +567,146 @@
 
 class PLexiconTests(unittest.TestCase):
 
-    def test_z3interfaces(self):
+    def _getTargetClass(self):
+        from Products.ZCTextIndex.ZCTextIndex import PLexicon
+        return PLexicon
+
+    def _makeOne(self, id='testing', title='Testing', *pipeline):
+        return self._getTargetClass()(id, title, *pipeline)
+
+    def test_class_conforms_to_ILexicon(self):
         from Products.ZCTextIndex.interfaces import ILexicon
+        from zope.interface.verify import verifyClass
+        verifyClass(ILexicon, self._getTargetClass())
+
+    def test_instance_conforms_to_ILexicon(self):
+        from Products.ZCTextIndex.interfaces import ILexicon
+        from zope.interface.verify import verifyObject
+        verifyObject(ILexicon, self._makeOne())
+
+    def test_class_conforms_to_IZCLexicon(self):
         from Products.ZCTextIndex.interfaces import IZCLexicon
         from zope.interface.verify import verifyClass
+        verifyClass(IZCLexicon, self._getTargetClass())
 
-        verifyClass(ILexicon, PLexicon)
-        verifyClass(IZCLexicon, PLexicon)
+    def test_instance_conforms_to_IZCLexicon(self):
+        from Products.ZCTextIndex.interfaces import IZCLexicon
+        from zope.interface.verify import verifyObject
+        verifyObject(IZCLexicon, self._makeOne())
 
+    def test_queryLexicon_defaults_empty(self):
+        lexicon = self._makeOne()
+        info = lexicon.queryLexicon(REQUEST=None, words=None)
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 20)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 0)
+        self.assertEqual(info['word_count'], 0)
+        self.assertEqual(list(info['page_range']), [])
+        self.assertEqual(info['page_columns'], [])
 
+    def test_queryLexicon_defaults_non_empty(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=None)
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 20)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 7)
+        self.assertEqual(info['word_count'], 7)
+        self.assertEqual(list(info['page_range']), [0])
+        self.assertEqual(info['page_columns'], [WORDS])
+
+    def test_queryLexicon_row_breaks(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=None, rows=4)
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 4)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 7)
+        self.assertEqual(info['word_count'], 7)
+        self.assertEqual(list(info['page_range']), [0])
+        self.assertEqual(info['page_columns'], [WORDS[0:4], WORDS[4:]])
+
+    def test_queryLexicon_page_breaks(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=None, rows=2, cols=2)
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 2)
+        self.assertEqual(info['cols'], 2)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 4)
+        self.assertEqual(info['word_count'], 7)
+        self.assertEqual(list(info['page_range']), [0, 1])
+        self.assertEqual(info['page_columns'], [WORDS[0:2], WORDS[2:4]])
+
+    def test_queryLexicon_page_break_not_first(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=None,
+                                    page=1, rows=2, cols=2)
+        self.assertEqual(info['page'], 1)
+        self.assertEqual(info['rows'], 2)
+        self.assertEqual(info['cols'], 2)
+        self.assertEqual(info['start_word'], 5)
+        self.assertEqual(info['end_word'], 7)
+        self.assertEqual(info['word_count'], 7)
+        self.assertEqual(list(info['page_range']), [0, 1])
+        self.assertEqual(info['page_columns'], [WORDS[4:6], WORDS[6:]])
+
+    def test_queryLexicon_words_no_globbing(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=['aaa', 'bbb'])
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 20)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 2)
+        self.assertEqual(info['word_count'], 2)
+        self.assertEqual(list(info['page_range']), [0])
+        self.assertEqual(info['page_columns'], [['aaa', 'bbb']])
+
+    def test_queryLexicon_words_w_globbing(self):
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne()
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=['aa*', 'bbb*'])
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 20)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 2)
+        self.assertEqual(info['word_count'], 2)
+        self.assertEqual(list(info['page_range']), [0])
+        self.assertEqual(info['page_columns'], [['aaa', 'bbb']])
+
+    def test_queryLexicon_uses_pipeline_for_normalization(self):
+        from Products.ZCTextIndex.Lexicon import CaseNormalizer
+        WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+        lexicon = self._makeOne('test', 'Testing', CaseNormalizer())
+        lexicon.sourceToWordIds(WORDS)
+        info = lexicon.queryLexicon(REQUEST=None, words=['AA*', 'Bbb*'])
+        self.assertEqual(info['page'], 0)
+        self.assertEqual(info['rows'], 20)
+        self.assertEqual(info['cols'], 4)
+        self.assertEqual(info['start_word'], 1)
+        self.assertEqual(info['end_word'], 2)
+        self.assertEqual(info['word_count'], 2)
+        self.assertEqual(list(info['page_range']), [0])
+        self.assertEqual(info['page_columns'], [['aaa', 'bbb']])
+
+
 def test_suite():
     s = unittest.TestSuite()
     for klass in (CosineIndexTests, OkapiIndexTests,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Catalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Catalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,7 @@
 
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogAwareness.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogAwareness.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogAwareness.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogBrains.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogBrains.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogBrains.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogPathAwareness.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogPathAwareness.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/CatalogPathAwareness.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Lazy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Lazy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/Lazy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ProgressHandler.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ProgressHandler.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalogIndexes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalogIndexes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/ZCatalogIndexes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/help/ZCatalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/help/ZCatalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/help/ZCatalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/regressiontests/unittest_patched.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/regressiontests/unittest_patched.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/regressiontests/unittest_patched.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -12,7 +12,7 @@
 text-based utility class for running the tests and reporting the results
 (TextTestRunner).
 
-Copyright (c) 1999, 2000, 2001 Steve Purcell
+Copyright (c) 1999, 2000, 2001 Zope Foundation and Contributors
 This module is free software, and you may redistribute it and/or modify
 it under the same terms as Python itself, so long as this copyright message
 and disclaimer are retained in their original form.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testBrains.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testBrains.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testBrains.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testCatalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testCatalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testCatalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testLazySequences.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testLazySequences.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZCatalog/tests/testLazySequences.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/MountedObject.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/MountedObject.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/MountedObject.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 # 
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 # 
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/tests/testMountPoint.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/tests/testMountPoint.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZODBMountPoint/tests/testMountPoint.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/SQL.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/SQL.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/SQL.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/help/ZSQLMethod.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/help/ZSQLMethod.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/ZSQLMethods/help/ZSQLMethod.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Products/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Products/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Products/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Bindings.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Bindings.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Bindings.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/BindingsUI.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/BindingsUI.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/BindingsUI.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Script.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Script.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Script.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Signature.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Signature.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/Signature.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/Scripts/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Aqueduct.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Aqueduct.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Aqueduct.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Connection.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Connection.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Connection.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/DA.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/DA.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/DA.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/RDB.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/RDB.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/RDB.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Results.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Results.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Results.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Search.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Search.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/Search.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/THUNK.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/THUNK.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/THUNK.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/TM.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/TM.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/TM.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/dbi_db.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/dbi_db.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/dbi_db.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlgroup.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlgroup.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlgroup.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqltest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqltest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqltest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlvar.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlvar.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/sqlvar.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlgroup.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlgroup.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlgroup.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlvar.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlvar.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/ZRDB/tests/test_sqlvar.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/ppml.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/ppml.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/DC/xml/ppml.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -17,119 +17,68 @@
 __version__ = "1.9"                     # Code version
 
 from pickle import *
-from string import replace
 import struct
 import base64
-import string
-import pickle
-import tempfile
-import marshal
-import xyap
+import re
+from marshal import loads as mloads
+from xyap import NoBlanks
+from xyap import xyap
 
-mdumps = marshal.dumps
-mloads = marshal.loads
+binary = re.compile('[^\x1f-\x7f]').search
 
-xyap=xyap.xyap
 
-ListType=type([])
-
-# Create repr mappong
-reprs = {}
-for c in map(chr,range(256)): reprs[c] = repr(c)[1:-1]
-reprs['\n'] = "\\n\n"
-reprs['\t'] = "\\t"
-reprs['\\'] = "\\\\"
-reprs['\r'] = "\\r"
-reprs["'"] = "\\'"
-reprs2={}
-reprs2['<'] = "\\074"
-reprs2['>'] = "\\076"
-reprs2['&'] = "\\046"
-
-
-#  Function convert takes a string and converts it to either
-#  repr or base64 format
-
-def convert(S, find=string.find):
-    new = ''
-    encoding = 'repr'
-    new = string.join(map(reprs.get, S), '')
-    if len(new) > (1.4*len(S)):
+def escape(s, encoding='repr'):
+    if binary(s) and isinstance(s, str):
+        s = base64.encodestring(s)[:-1]
         encoding = 'base64'
-        new = base64.encodestring(S)[:-1]
-    elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0:
-        if find(new, ']]>') <0 :
-            new='<![CDATA[\n\n'+new+'\n\n]]>'
-            encoding='cdata'
+    elif '>' in s or '<' in s or '&' in s:
+        if not ']]>' in s:
+            s = '<![CDATA[' + s + ']]>'
+            encoding = 'cdata'
         else:
-            new=string.join(map(lambda s: reprs2.get(s,s), new), '')
-    return encoding, new
+            s = s.replace('&', '&amp;')
+            s = s.replace('>', '&gt;')
+            s = s.replace('<', '&lt;')
+    return encoding, s
 
-#  Function unconvert takes a encoding and a string and
-#  returns the original string
-
-def unconvert(encoding,S):
-    original = ''
+def unescape(s, encoding):
     if encoding == 'base64':
-        original = base64.decodestring(S)
+        return base64.decodestring(s)
     else:
-        x = string.replace(S, '\n', '')
-        original = eval("'"+x+"'")
-    return original
+        s = s.replace('&lt;', '<')
+        s = s.replace('&gt;', '>')
+        return s.replace('&amp;', '&')
 
-t32 = 1L << 32
-
-def p64(v, pack=struct.pack):
-    if v < t32: h=0
-    else:
-        h=v/t32
-        v=v%t32
-    return pack(">II", h, v)
-
-def u64(v, unpack=struct.unpack):
-    h, v = unpack(">ii", v)
-    if v < 0: v=t32+v
-    if h:
-        if h < 0: h=t32+h
-        v=h*t32+v
-    return v
-
 class Global:
-
     def __init__(self, module, name):
-        self.module=module
-        self.name=name
+        self.module = module
+        self.name = name
 
     def __str__(self, indent=0):
-        if hasattr(self, 'id'): id=' id="%s"' % self.id
-        else: id=''
-        name=string.lower(self.__class__.__name__)
+        if hasattr(self, 'id'):
+            id = ' id="%s"' % self.id
+        else:
+            id = ''
+        name = self.__class__.__name__.lower()
         return '%s<%s%s name="%s" module="%s"/>\n' % (
-            ' '*indent, name, id, self.name, self.module)
+            ' ' * indent, name, id, self.name, self.module)
 
 class Scalar:
-
     def __init__(self, v):
-        self._v=v
+        self._v = v
 
-    def value(self): return self._v
+    def value(self):
+        return self._v
 
     def __str__(self, indent=0):
-        if hasattr(self, 'id'): id=' id="%s"' % self.id
-        else: id=''
-        name=string.lower(self.__class__.__name__)
+        if hasattr(self, 'id'):
+            id = ' id="%s"' % self.id
+        else:
+            id = ''
+        name = self.__class__.__name__.lower()
         return '%s<%s%s>%s</%s>\n' % (
-            ' '*indent, name, id, self.value(), name)
+            ' ' * indent, name, id, self.value(), name)
 
-def xmlstr(v):
-    v=`v`
-    if v[:1]=='\'':
-        v=string.replace(v,'"','\\"')
-    v=replace(v,'%','\\045')
-    v=replace(v,'&','\\046')
-    return v[1:-1]
-
-class Int(Scalar): pass
 class Long(Scalar):
     def value(self):
         result = str(self._v)
@@ -137,65 +86,84 @@
             return result[:-1]
         return result
 
-class Float(Scalar): pass
 class String(Scalar):
     def __init__(self, v, encoding=''):
-        encoding, v = convert(v)
-        self.encoding=encoding
-        self._v=v
-    def __str__(self,indent=0):
-        if hasattr(self,'id'):id=' id="%s"' % self.id
-        else: id=''
-        if hasattr(self, 'encoding'):encoding=' encoding="%s"' % self.encoding
-        else: encoding=''
-        name=string.lower(self.__class__.__name__)
+        encoding, v = escape(v, encoding)
+        self.encoding = encoding
+        self._v = v
+
+    def __str__(self, indent=0):
+        if hasattr(self,'id'):
+            id = ' id="%s"' % self.id
+        else:
+            id = ''
+        if hasattr(self, 'encoding'):
+            encoding = ' encoding="%s"' % self.encoding
+        else:
+            encoding = ''
+        name = self.__class__.__name__.lower()
         return '%s<%s%s%s>%s</%s>\n' % (
-            ' '*indent, name, id, encoding, self.value(), name)
+            ' ' * indent, name, id, encoding, self.value(), name)
 
-class Wrapper:
+class Unicode(String):
+    def __init__(self, v, encoding):
+        v = unicode(v, encoding)
+        String.__init__(self, v)
 
-    def __init__(self, v): self._v=v
+    def value(self):
+        return self._v.encode('utf-8')
 
-    def value(self): return self._v
+class Wrapper:
+    def __init__(self, v):
+        self._v = v
 
+    def value(self):
+        return self._v
+
     def __str__(self, indent=0):
-        if hasattr(self, 'id'): id=' id="%s"' % self.id
-        else: id=''
-        name=string.lower(self.__class__.__name__)
-        v=self._v
-        i=' '*indent
-        if isinstance(v,Scalar):
-            return '%s<%s%s> %s </%s>\n' % (i, name, id, str(v)[:-1], name)
+        if hasattr(self, 'id'):
+            id = ' id="%s"' % self.id
         else:
+            id = ''
+        name = self.__class__.__name__.lower()
+        v = self._v
+        i = ' ' * indent
+        if isinstance(v, Scalar):
+            return '%s<%s%s>%s</%s>\n' % (i, name, id, str(v)[:-1], name)
+        else:
             try:
-                v=v.__str__(indent+2)
+                v = v.__str__(indent + 2)
             except TypeError:
-                v=v.__str__()
+                v = v.__str__()
             return '%s<%s%s>\n%s%s</%s>\n' % (i, name, id, v, i, name)
 
 class Collection:
-
     def __str__(self, indent=0):
-        if hasattr(self, 'id'): id=' id="%s"' % self.id
-        else: id=''
-        name=string.lower(self.__class__.__name__)
-        i=' '*indent
+        if hasattr(self, 'id'):
+            id = ' id="%s"' % self.id
+        else:
+            id = ''
+        name = self.__class__.__name__.lower()
+        i = ' ' * indent
         if self:
             return '%s<%s%s>\n%s%s</%s>\n' % (
-                i, name, id, self.value(indent+2), i, name)
+                i, name, id, self.value(indent + 2), i, name)
         else:
             return '%s<%s%s/>\n' % (i, name, id)
 
-class Key(Wrapper): pass
-class Value(Wrapper): pass
-
 class Dictionary(Collection):
-    def __init__(self): self._d=[]
-    def __len__(self): return len(self._d)
-    def __setitem__(self, k, v): self._d.append((k,v))
+    def __init__(self):
+        self._d = []
+
+    def __len__(self):
+        return len(self._d)
+
+    def __setitem__(self, k, v):
+        self._d.append((k, v))
+
     def value(self, indent):
-        return string.join(
-            map(lambda i, ind=' '*indent, indent=indent+4:
+        return ''.join(
+            map(lambda i, ind=' ' * indent, indent=indent + 4:
                 '%s<item>\n'
                 '%s'
                 '%s'
@@ -206,62 +174,73 @@
                  Value(i[1]).__str__(indent),
                  ind),
                 self._d
-                ),
-            '')
+                ))
 
 class Sequence(Collection):
-
     def __init__(self, v=None):
-        if not v: v=[]
-        self._subs=v
+        if not v:
+            v = []
+        self._subs = v
 
-    def __len__(self): return len(self._subs)
+    def __len__(self):
+        return len(self._subs)
 
-    def append(self, v): self._subs.append(v)
-    def extend(self, v): self._subs.extend(v)
+    def append(self, v):
+        self._subs.append(v)
 
+    def extend(self, v):
+        self._subs.extend(v)
+
     def _stringify(self, v, indent):
         try:
-            return v.__str__(indent+2)
+            return v.__str__(indent + 2)
         except TypeError:
             return v.__str__()
 
     def value(self, indent):
-        return string.join(map(
+        return ''.join(map(
             lambda v, indent=indent: self._stringify(v, indent),
-            self._subs),'')
+            self._subs))
 
-class List(Sequence): pass
-class Tuple(Sequence): pass
-
-class Klass(Wrapper): pass
-class State(Wrapper): pass
-class Pickle(Wrapper): pass
-class Persistent(Wrapper): pass
-
 class none:
-    def __str__(self, indent=0): return ' '*indent+'<none/>\n'
-none=none()
+    def __str__(self, indent=0):
+        return ' ' * indent + '<none/>\n'
+none = none()
 
 class Reference(Scalar):
-    def __init__(self, v): self._v=v
+    def __init__(self, v):
+        self._v = v
+
     def __str__(self, indent=0):
-        v=self._v
-        name=string.lower(self.__class__.__name__)
-        return '%s<%s id="%s"/>\n' % (' '*indent,name,v)
+        v = self._v
+        name = self.__class__.__name__.lower()
+        return '%s<%s id="%s"/>\n' % (' ' * indent, name, v)
 
-Get=Reference
+Get = Reference
 
 class Object(Sequence):
     def __init__(self, klass, args):
-        self._subs=[Klass(klass), args]
+        self._subs = [Klass(klass), args]
 
-    def __setstate__(self, v): self.append(State(v))
+    def __setstate__(self, v):
+        self.append(State(v))
 
-class ToXMLUnpickler(Unpickler):
+class Int(Scalar): pass
+class Float(Scalar): pass
+class List(Sequence): pass
+class Tuple(Sequence): pass
+class Key(Wrapper): pass
+class Value(Wrapper): pass
+class Klass(Wrapper): pass
+class State(Wrapper): pass
+class Pickle(Wrapper): pass
+class Persistent(Wrapper): pass
 
-    def load(self): return Pickle(Unpickler.load(self))
 
+class ToXMLUnpickler(Unpickler):
+    def load(self):
+        return Pickle(Unpickler.load(self))
+
     dispatch = {}
     dispatch.update(Unpickler.dispatch)
 
@@ -278,7 +257,7 @@
     dispatch[NONE] = load_none
 
     def load_int(self):
-        self.append(Int(string.atoi(self.readline()[:-1])))
+        self.append(Int(int(self.readline()[:-1])))
     dispatch[INT] = load_int
 
     def load_binint(self):
@@ -286,7 +265,7 @@
     dispatch[BININT] = load_binint
 
     def load_binint1(self):
-        self.append(Int(mloads('i' + self.read(1) + '\000\000\000')))
+        self.append(Int(ord(self.read(1))))
     dispatch[BININT1] = load_binint1
 
     def load_binint2(self):
@@ -294,11 +273,11 @@
     dispatch[BININT2] = load_binint2
 
     def load_long(self):
-        self.append(Long(string.atol(self.readline()[:-1], 0)))
+        self.append(Long(long(self.readline()[:-1], 0)))
     dispatch[LONG] = load_long
 
     def load_float(self):
-        self.append(Float(string.atof(self.readline()[:-1])))
+        self.append(Float(float(self.readline()[:-1])))
     dispatch[FLOAT] = load_float
 
     def load_binfloat(self, unpack=struct.unpack):
@@ -306,8 +285,16 @@
     dispatch[BINFLOAT] = load_binfloat
 
     def load_string(self):
-        self.append(String(eval(self.readline()[:-1],
-                                {'__builtins__': {}}))) # Let's be careful
+        rep = self.readline()[:-1]
+        for q in "\"'":
+            if rep.startswith(q):
+                if not rep.endswith(q):
+                    raise ValueError, 'insecure string pickle'
+                rep = rep[len(q):-len(q)]
+                break
+        else:
+            raise ValueError, 'insecure string pickle'
+        self.append(String(rep.decode('string-escape')))
     dispatch[STRING] = load_string
 
     def load_binstring(self):
@@ -315,14 +302,23 @@
         self.append(String(self.read(len)))
     dispatch[BINSTRING] = load_binstring
 
+    def load_unicode(self):
+        self.append(Unicode(self.readline()[:-1],'raw-unicode-escape'))
+    dispatch[UNICODE] = load_unicode
+
+    def load_binunicode(self):
+        len = mloads('i' + self.read(4))
+        self.append(Unicode(self.read(len),'utf-8'))
+    dispatch[BINUNICODE] = load_binunicode
+
     def load_short_binstring(self):
-        len = mloads('i' + self.read(1) + '\000\000\000')
+        len = ord(self.read(1))
         self.append(String(self.read(len)))
     dispatch[SHORT_BINSTRING] = load_short_binstring
 
     def load_tuple(self):
         k = self.marker()
-        self.stack[k:] = [Tuple(self.stack[k+1:])]
+        self.stack[k:] = [Tuple(self.stack[k + 1:])]
     dispatch[TUPLE] = load_tuple
 
     def load_empty_tuple(self):
@@ -339,27 +335,27 @@
 
     def load_list(self):
         k = self.marker()
-        self.stack[k:] = [List(self.stack[k+1:])]
+        self.stack[k:] = [List(self.stack[k + 1:])]
     dispatch[LIST] = load_list
 
     def load_dict(self):
         k = self.marker()
         d = Dictionary()
-        items = self.stack[k+1:]
+        items = self.stack[k + 1:]
         for i in range(0, len(items), 2):
             key = items[i]
-            value = items[i+1]
+            value = items[i + 1]
             d[key] = value
         self.stack[k:] = [d]
     dispatch[DICT] = load_dict
 
     def load_inst(self):
         k = self.marker()
-        args = Tuple(self.stack[k+1:])
+        args = Tuple(self.stack[k + 1:])
         del self.stack[k:]
         module = self.readline()[:-1]
         name = self.readline()[:-1]
-        value=Object(Global(module, name), args)
+        value = Object(Global(module, name), args)
         self.append(value)
     dispatch[INST] = load_inst
 
@@ -370,7 +366,7 @@
         del stack[k + 1]
         args = Tuple(stack[k + 1:])
         del stack[k:]
-        value=Object(klass,args)
+        value = Object(klass, args)
         self.append(value)
     dispatch[OBJ] = load_obj
 
@@ -384,45 +380,45 @@
         stack = self.stack
 
         callable = stack[-2]
-        arg_tup  = stack[-1]
+        arg_tup = stack[-1]
         del stack[-2:]
 
-        value=Object(callable, arg_tup)
+        value = Object(callable, arg_tup)
         self.append(value)
     dispatch[REDUCE] = load_reduce
 
     idprefix=''
 
     def load_get(self):
-        self.append(Get(self.idprefix+self.readline()[:-1]))
+        self.append(Get(self.idprefix + self.readline()[:-1]))
     dispatch[GET] = load_get
 
     def load_binget(self):
-        i = mloads('i' + self.read(1) + '\000\000\000')
-        self.append(Get(self.idprefix+`i`))
+        i = ord(self.read(1))
+        self.append(Get(self.idprefix + repr(i)))
     dispatch[BINGET] = load_binget
 
     def load_long_binget(self):
         i = mloads('i' + self.read(4))
-        self.append(Get(self.idprefix+`i`))
+        self.append(Get(self.idprefix + repr(i)))
     dispatch[LONG_BINGET] = load_long_binget
 
     def load_put(self):
-        self.stack[-1].id=self.idprefix+self.readline()[:-1]
+        self.stack[-1].id = self.idprefix + self.readline()[:-1]
     dispatch[PUT] = load_put
 
     def load_binput(self):
-        i = mloads('i' + self.read(1) + '\000\000\000')
+        i = ord(self.read(1))
         last = self.stack[-1]
         if getattr(last, 'id', last) is last:
-            last.id = self.idprefix + `i`
+            last.id = self.idprefix + repr(i)
     dispatch[BINPUT] = load_binput
 
     def load_long_binput(self):
         i = mloads('i' + self.read(4))
         last = self.stack[-1]
         if getattr(last, 'id', last) is last:
-            last.id = self.idprefix + `i`
+            last.id = self.idprefix + repr(i)
     dispatch[LONG_BINPUT] = load_long_binput
 
 
@@ -430,230 +426,169 @@
     return ToXMLUnpickler(file).load()
 
 def ToXMLloads(str):
+    from StringIO import StringIO
     file = StringIO(str)
     return ToXMLUnpickler(file).load()
 
+def name(self, tag, data):
+    return ''.join(data[2:]).strip()
 
-
-class NoBlanks:
-
-    def handle_data(self, data):
-        if string.strip(data): self.append(data)
-
-def name(self, tag, data, join=string.join, strip=string.strip):
-    return strip(join(data[2:],''))
-
 def start_pickle(self, tag, attrs):
-    self._pickleids={}
-    return [tag,attrs]
+    self._pickleids = {}
+    return [tag, attrs]
 
-def end_string(self, tag, data):
-    v=data[2]
-    a=data[1]
-    if a['encoding'] is not '':
-        v=unconvert(a['encoding'],v)
-    if a.has_key('id'): self._pickleids[a['id']]=v
-    return v
-
-def end_list(self, tag, data):
-    v=data[2:]
-    a=data[1]
-    if a.has_key('id'): self._pickleids[data[1]['id']]=v
-    return v
-
-def end_tuple(self, tag, data):
-    v=tuple(data[2:])
-    a=data[1]
-    if a.has_key('id'): self._pickleids[data[1]['id']]=v
-    return v
-
-def end_dictionary(self, tag, data):
-    D={}
-    a=data[1]
-    for k, v in data[2:]: D[k]=v
-    if a.has_key('id'): self._pickleids[a['id']]=D
-    return D
-
-class xmlUnpickler(NoBlanks, xyap):
-    start_handlers={'pickle': start_pickle}
-    end_handlers={
-        'int':
-        lambda self,tag,data,atoi=string.atoi,name=name:
-            atoi(name(self, tag, data)),
-        'long':
-        lambda self,tag,data,atoi=string.atoi,name=name:
-            atoi(name(self, tag, data)),
-        'boolean':
-        lambda self,tag,data,atoi=string.atoi,name=name:
-            atoi(name(self, tag, data)),
-        'string': end_string ,
-        'double':
-        lambda self,tag,data,atof=string.atof,name=name:
-            atof(name(self, tag, data)),
-        'float':
-        lambda self,tag,data,atof=string.atof,name=name:
-            atof(name(self, tag, data)),
-        'none': lambda self, tag, data: None,
-        'list': end_list,
-        'tuple': end_tuple,
-        'dictionary': end_dictionary,
-        'key': lambda self, tag, data: data[2],
-        'value': lambda self, tag, data: data[2],
-        'item': lambda self, tag, data: data[2:],
-        'reference': lambda self, tag, data: self._pickleids[data[1]['id']],
-        'state': lambda self, tag, data: data[2],
-        'klass': lambda self, tag, data: data[2],
-        }
-
 def save_int(self, tag, data):
-    binary=self.binary
-    if binary:
-        v=string.atoi(name(self, tag, data))
-        i=mdumps(v)[1:]
-        if (i[-2:] == '\000\000'):
-            if (i[-3] == '\000'):
-                v='K'+i[:-3]
-                return v
-            v='M'+i[:-2]
-            return v
-        v='J'+i
-        return v
-    v='I'+name(self, tag, data)+'\012'
-    return v
+    if self.binary:
+        v = int(name(self, tag, data))
+        if v >= 0:
+            if v <= 0xff:
+                return BININT1 + chr(v)
+            if v <= 0xffff:
+                return '%c%c%c' % (BININT2, v & 0xff, v >> 8)
+        hb = v >> 31
+        if hb == 0 or hb == -1:
+            return BININT + struct.pack('<i', v)
+    return INT + name(self, tag, data) + '\n'
 
 def save_float(self, tag, data):
-    binary=self.binary
-    if binary: v='G'+struct.pack('>d',string.atof(name(self, tag, data)))
-    else: v='F'+name(self, tag, data)+'\012'
-    return v
+    if self.binary:
+        return BINFLOAT + struct.pack('>d', float(name(self, tag, data)))
+    else:
+        return FLOAT + name(self, tag, data) + '\n'
 
 def save_put(self, v, attrs):
-    id=attrs.get('id','')
+    id = attrs.get('id', '')
     if id:
-        prefix=string.rfind(id,'.')
-        if prefix >= 0: id=id[prefix+1:]
-        elif id[0]=='i': id=id[1:]
+        prefix = id.rfind('.')
+        if prefix >= 0:
+            id = id[prefix + 1:]
+        elif id[0] == 'i':
+            id = id[1:]
         if self.binary:
-            id=string.atoi(id)
-            s=mdumps(id)[1:]
-            if (id < 256):
-                id=s[0]
-                put='q'
+            id = int(id)
+            if id < 256:
+                id = BINPUT + chr(id)
             else:
-                id=s
-                put='r'
-            id=put+id
+                id = LONG_BINPUT + struct.pack('<i', id)
         else:
-            id="p"+id+"\012"
-        return v+id
+            id = PUT + repr(id) + '\n'
+        return v + id
     return v
 
 def save_string(self, tag, data):
-    binary=self.binary
-    v=''
-    a=data[1]
-    if len(data)>2:
-        for x in data[2:]:
-            v=v+x
-    encoding=a['encoding']
+    a = data[1]
+    v = ''.join(data[2:])
+    encoding = a['encoding']
     if encoding is not '':
-        v=unconvert(encoding,v)
-    put='p'
-    if binary:
-        l=len(v)
-        s=mdumps(l)[1:]
-        if (l<256):
-            v='U'+s[0]+v
+        v = unescape(v, encoding)
+    if self.binary:
+        l = len(v)
+        if l < 256:
+            v = SHORT_BINSTRING + chr(l) + v
         else:
-            v='T'+s+v
-        put='q'
-    else: v="S'"+v+"'\012"
+            v = BINSTRING + struct.pack('<i', l) + v
+    else:
+        v = STRING + repr(v) + '\n'
     return save_put(self, v, a)
 
+def save_unicode(self, tag, data):
+    a = data[1]
+    v = ''.join(data[2:])
+    encoding = a['encoding']
+    if encoding is not '':
+        v = unescape(v, encoding)
+    if self.binary:
+        v = v.encode('utf-8')
+        v = BINUNICODE + struct.pack("<i", len(v)) + v
+    else:
+        v = v.replace("\\", "\\u005c")
+        v = v.replace("\n", "\\u000a")
+        v.encode('raw-unicode-escape')
+        v = UNICODE + v + '\n'
+    return save_put(self, v, a)
+
 def save_tuple(self, tag, data):
-    T=data[2:]
-    if not T: return ')'
-    return save_put(self, '('+string.join(T,'')+'t', data[1])
+    T = data[2:]
+    if not T:
+        return EMPTY_TUPLE
+    return save_put(self, MARK + ''.join(T) + TUPLE, data[1])
 
 def save_list(self, tag, data):
-    L=data[2:]
-    a=data[1]
+    L = data[2:]
     if self.binary:
-        v=save_put(self, ']', a)
-        if L: v=v+'('+string.join(L,'')+'e'
+        v = save_put(self, EMPTY_LIST, data[1])
+        if L:
+            v = v + MARK + ''.join(L) + APPENDS
     else:
-        v=save_put(self, '(l', a)
-        if L: v=string.join(L,'a')+'a'
+        v = save_put(self, MARK + LIST, data[1])
+        if L:
+            v = APPEND.join(L) + APPEND
     return v
 
 def save_dict(self, tag, data):
-    D=data[2:]
+    D = data[2:]
     if self.binary:
-        v=save_put(self, '}', data[1])
-        if D: v=v+'('+string.join(D,'')+'u'
+        v = save_put(self, EMPTY_DICT, data[1])
+        if D:
+            v = v + MARK + ''.join(D) + SETITEMS
     else:
-        v=save_put(self, '(d', data[1])
-        if D: v=v+string.join(D,'s')+'s'
+        v = save_put(self, MARK + DICT, data[1])
+        if D:
+            v = v + SETITEM.join(D) + SETITEM
     return v
 
 def save_reference(self, tag, data):
-    binary=self.binary
-    a=data[1]
-    id=a['id']
-    prefix=string.rfind(id,'.')
-    if prefix>=0: id=id[prefix+1:]
-    get='g'
-    if binary:
-        id=string.atoi(id)
-        s=mdumps(id)[1:]
-        if (id < 256):
-            id=s[0]
-            get='h'
+    a = data[1]
+    id = a['id']
+    prefix = id.rfind('.')
+    if prefix >= 0:
+        id = id[prefix + 1:]
+    if self.binary:
+        id = int(id)
+        if id < 256:
+            return BINGET + chr(id)
         else:
-            id=s
-            get='j'
-        v=get+id
-    else: v=get+id+'\012'
+            return LONG_BINGET + struct.pack('<i', i)
+    else:
+        return GET + repr(id) + '\n'
 
-    return v
-
 def save_object(self, tag, data):
-    v='('+data[2]
-    x=data[3][1:]
-    stop=string.rfind(x,'t')  # This seems
-    if stop>=0: x=x[:stop]    # wrong!
-    v=save_put(self, v+x+'o', data[1])
-    v=v+data[4]+'b' # state
+    v = MARK + data[2]
+    x = data[3][1:]
+    stop = x.rfind('t')  # This seems
+    if stop >= 0:        # wrong!
+        x = x[:stop]
+    v = save_put(self, v + x + OBJ, data[1])
+    v = v + data[4] + BUILD # state
     return v
 
 def save_global(self, tag, data):
-    a=data[1]
-    return save_put(self, 'c'+a['module']+'\012'+a['name']+'\012', a)
+    a = data[1]
+    return save_put(self, GLOBAL + a['module'] + '\n' + a['name'] + '\n', a)
 
 def save_persis(self, tag, data):
-    v=data[2]
-    if  self.binary:
-        v=v+'Q'
+    v = data[2]
+    if self.binary:
+        return v + BINPERSID
     else:
-        v='P'+v
-    return v
+        return PERSID + v
 
 class xmlPickler(NoBlanks, xyap):
-    start_handlers={
+    start_handlers = {
         'pickle': lambda self, tag, attrs: [tag, attrs],
         }
-    end_handlers={
-        'pickle': lambda self, tag, data: str(data[2])+'.',
-        'none': lambda self, tag, data: 'N',
+    end_handlers = {
+        'pickle': lambda self, tag, data: str(data[2]) + STOP,
+        'none': lambda self, tag, data: NONE,
         'int': save_int,
-        'long': lambda self, tag, data: 'L'+str(data[2])+'L\012',
+        'long': lambda self, tag, data: LONG + str(data[2]) + LONG + '\n',
         'float': save_float,
         'string': save_string,
         'reference': save_reference,
         'tuple': save_tuple,
         'list': save_list,
         'dictionary': save_dict,
-        'item': lambda self, tag, data, j=string.join: j(data[2:],''),
+        'item': lambda self, tag, data: ''.join(map(str, data[2:])),
         'value': lambda self, tag, data: data[2],
         'key' : lambda self, tag, data: data[2],
         'object': save_object,
@@ -661,6 +596,7 @@
         'state': lambda self, tag, data: data[2],
         'global': save_global,
         'persistent': save_persis,
+        'unicode': save_unicode,
         }
 
 
@@ -672,16 +608,17 @@
 
 def test():
     import xmllib
-    c=C()
-    c.foo=1
-    c.bar=2
-    x=[0,1,2,3]
-    y=('abc','abc',c,c)
+    import pickle
+    c = C()
+    c.foo = 1
+    c.bar = 2
+    x = [0, 1, 2, 3]
+    y = ('abc', 'abc', c, c)
     x.append(y)
     x.append(y)
-    t=()
-    l=[]
-    s=''
+    t = ()
+    l = []
+    s = ''
     L = long('999999999999')
     x.append(t)
     x.append(l)
@@ -689,78 +626,52 @@
     x.append(L)
     x.append(55555)
     x.append(13)
-    r=[x]
+    r = [x]
     print x
-    f=pickle.dumps(x)
+    f = pickle.dumps(x)
     print f
     r.append(f)
-    q=ToXMLloads(f)
-    q=str(q)
-    q='<?xml version="1.0"?>\n'+q
+    q = ToXMLloads(f)
+    q = str(q)
+    q = '<?xml version="1.0"?>\n' + q
     print q
     r.append(q)
-    file=''
-    F=xmlPickler(file)
-    p=xmllib.XMLParser()
-    p.start_handlers=F.start_handlers
-    p.end_handlers=F.end_handlers
-    p.handle_data=F.handle_data
-    p.unknown_starttag=F.unknown_starttag
-    p.unknown_endtag=F.unknown_endtag
-    p._stack=F._stack
-    p.push=F.push
-    p.append=F.append
-    p.file=F.file
-    p.tempfile=F.tempfile
-    p.binary=1
-    data=string.split(q,'\n')
+    F = xmlPickler()
+    F.binary = 1
+    p = xmllib.XMLParser()
+    p.start_handlers = F.start_handlers
+    p.end_handlers = F.end_handlers
+    p.handle_data = F.handle_data
+    p.unknown_starttag = F.unknown_starttag
+    p.unknown_endtag = F.unknown_endtag
+    p._stack = F._stack
+    p.push = F.push
+    p.append = F.append
+    data = q.split('\n')
     for l in data:
         p.feed(l)
     p.close()
-    z=p._stack
-    z=z[0][0]
-    print z, '\012'
+    z = p._stack
+    z = z[0][0]
+    print z, '\n'
     r.append(z)
-    l=pickle.loads(z)
-    print l, '\012'
+    l = pickle.loads(z)
+    print l, '\n'
     r.append(l)
 
 def test1():
-    import xmllib
-    q=open('Data.xml').read()
-    file=open('out','w'+'b')
-    F=xmlPickler(file,1)
-    p=xmllib.XMLParser()
-    p.start_handlers=F.start_handlers
-    p.end_handlers=F.end_handlers
-    p.handle_data=F.handle_data
-    p.unknown_starttag=F.unknown_starttag
-    p.unknown_endtag=F.unknown_endtag
-    p._stack=F._stack
-    p.push=F.push
-    p.append=F.append
-    p.file=F.file
-    p.tempfile=F.tempfile
-    data=string.split(q,'\n')
-    for l in data:
-        p.feed(l)
-    p.close()
-    z=p._stack
-    z=z[0][0]
-    print z, '\012'
-
-def test2():
     import xml.parsers.expat
-    c=C()
-    c.foo=1
-    c.bar=2
-    x=[0,1,2,3]
-    y=('abc','abc',c,c)
+    import pickle
+    c = C()
+    c.foo = 1
+    c.bar = 2
+    x = [0, 1, 2, 3]
+    y = ('abc', 'abc', c, c)
     x.append(y)
     x.append(y)
-    t=()
-    l=[]
-    s=''
+    t = ()
+    l = []
+    s = ''
     L = long('999999999999')
     x.append(t)
     x.append(l)
@@ -768,36 +679,21 @@
     x.append(L)
     x.append(5)
     x.append(13)
-    print x, '\012'
-    f=pickle.dumps(x)
-    print f, '\012'
-    q=ToXMLloads(f)
-    q=str(q)
-    q='<?xml version="1.0"?>\n'+q
-    print q, '\012'
-    file=''
-    F=xmlPickler()
-    F.binary=0
-    p=xml.parsers.expat.ParserCreate()
-    p.CharacterDataHandler=F.handle_data
-    p.StartElementHandler=F.unknown_starttag
-    p.EndElementHandler=F.unknown_endtag
-    r=p.Parse(q)
-    print r, '\012'
+    print x, '\n'
+    f = pickle.dumps(x)
+    print f, '\n'
+    q = ToXMLloads(f)
+    q = str(q)
+    q = '<?xml version="1.0"?>\n' + q
+    print q, '\n'
+    F = xmlPickler()
+    F.binary = 0
+    p = xml.parsers.expat.ParserCreate()
+    p.CharacterDataHandler = F.handle_data
+    p.StartElementHandler = F.unknown_starttag
+    p.EndElementHandler = F.unknown_endtag
+    r = p.Parse(q)
+    print r, '\n'
 
-def test3():
-    import xml.parsers.expat
-    data=open('Data.xml').read()
-    file=open('out','w'+'b')
-    F=xmlPickler()
-    F.file=file
-    F.binary=1
-    p=xml.parsers.expat.ParserCreate()
-    p.CharacterDataHandler=F.handle_data
-    p.StartElementHandler=F.unknown_starttag
-    p.EndElementHandler=F.unknown_endtag
-    r=p.Parse(data)
-    print r, '\012'
-
 if __name__ == '__main__':
     test()

Modified: Zope/branches/tseaver-fix_wsgi/src/Shared/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Shared/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Shared/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Signals/SignalHandler.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Signals/SignalHandler.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Signals/SignalHandler.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Signals/Signals.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Signals/Signals.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Signals/Signals.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Signals/WinSignalHandler.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Signals/WinSignalHandler.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Signals/WinSignalHandler.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/PortalTestCase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/PortalTestCase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/PortalTestCase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeLite.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeLite.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeTestCase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeTestCase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/ZopeTestCase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/base.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/base.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/base.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/connections.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/connections.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/connections.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/functional.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/functional.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/functional.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/layer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/layer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/layer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/placeless.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/placeless.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/placeless.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/sandbox.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/sandbox.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/sandbox.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testBaseTestCase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testBaseTestCase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testBaseTestCase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testFunctional.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testFunctional.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testFunctional.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testInterfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testInterfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testInterfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPlaceless.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPlaceless.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPlaceless.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPortalTestCase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPortalTestCase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPortalTestCase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPythonScript.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPythonScript.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testPythonScript.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testShoppingCart.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testShoppingCart.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testShoppingCart.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testSkeleton.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testSkeleton.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testSkeleton.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testWebserver.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testWebserver.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testWebserver.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZODBCompat.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZODBCompat.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZODBCompat.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZopeTestCase.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZopeTestCase.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/testZopeTestCase.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/tests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/tests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/tests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/threadutils.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/threadutils.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/threadutils.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/utils.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/utils.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/utils.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/warnhook.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/warnhook.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/warnhook.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2004 Zope Corporation and Contributors.
+# Copyright (c) 2004 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.
@@ -15,7 +15,5 @@
 $Id$
 """
 
-from zope.testing.doctest import *
-from zope.testing.doctest import _normalize_module
+from doctest import *
 from functional import *
-

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/functional.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/functional.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/functional.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.
@@ -15,12 +15,14 @@
 $Id$
 """
 
-import sys, re, base64
+import base64
+import doctest
+import re
+import sys
 import warnings
+
 import transaction
 
-from zope.testing import doctest
-
 from Testing.ZopeTestCase import ZopeTestCase
 from Testing.ZopeTestCase import FunctionalTestCase
 from Testing.ZopeTestCase import Functional
@@ -93,7 +95,6 @@
 def auth_header(header):
     match = basicre.match(header)
     if match:
-        import base64
         u, p = match.group(1, 2)
         if u is None:
             u = ''

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testAuthHeaderTest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testPackageAsProduct.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testWarningsTest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testWarningsTest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testWarningsTest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/testZopeDocTest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/tests.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/tests.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/ZopeTestCase/zopedoctest/tests.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/dispatcher.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/dispatcher.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/dispatcher.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/makerequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/makerequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/makerequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Testing/tests/test_makerequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Testing/tests/test_makerequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Testing/tests/test_makerequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/TreeTag.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/TreeTag.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/TreeTag.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/TreeDisplay/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseRequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseRequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -26,6 +26,7 @@
 from zope.app.publication.interfaces import EndRequestEvent
 from zope.publisher.defaultview import queryDefaultViewName
 from zope.publisher.interfaces import IPublishTraverse
+from zope.publisher.interfaces import NotFound as ztkNotFound
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.traversing.interfaces import TraversalError
 from zope.traversing.namespace import nsParse, namespaceLookup
@@ -312,7 +313,7 @@
 
     __repr__=__str__
 
-
+    # Original version: see zope.traversing.publicationtraverse
     def traverseName(self, ob, name):
         if name and name[:1] in '@+':
             # Process URI segment parameters.
@@ -321,7 +322,7 @@
                 try:
                     ob2 = namespaceLookup(ns, nm, ob, self)
                 except TraversalError:
-                    raise KeyError(ob, name)
+                    raise ztkNotFound(ob, name)
 
                 if IAcquirer.providedBy(ob2):
                     ob2 = ob2.__of__(ob)
@@ -343,7 +344,6 @@
 
         return ob2
 
-
     def traverse(self, path, response=None, validated_hook=None):
         """Traverse the object space
 
@@ -506,7 +506,8 @@
                         object, check_name, subobject,
                         self.roles)
                     object = subobject
-                except (KeyError, AttributeError):
+                # traverseName() might raise ZTK's NotFound
+                except (KeyError, AttributeError, ztkNotFound):
                     if response.debug_mode:
                         return response.debugError(
                             "Cannot locate object at: %s" % URL)
@@ -517,7 +518,6 @@
                         return response.debugError(e.args)
                     else: 
                         return response.forbiddenError(entry_name)
-                    
 
                 parents.append(object)
 
@@ -711,8 +711,7 @@
 # types during publishing, we ensure the same publishing rules in
 # both versions. The downside is that this needs to be extended as
 # new built-in types are added and future Python versions are
-# supported. That happens rarely enough that hopefully we'll be on
-# Zope 3 by then :)
+# supported.
 
 import types
 

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseResponse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BaseResponse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BeforeTraverse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BeforeTraverse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/BeforeTraverse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Client.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Client.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Client.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -5,7 +5,7 @@
 #"
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Converters.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Converters.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Converters.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRangeSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRangeSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRangeSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPRequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002-2009 Zope Corporation and Contributors.
+# Copyright (c) 2002-2009 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -478,6 +478,12 @@
         other = self.other
         taintedform = self.taintedform
 
+        # If 'QUERY_STRING' is not present in environ
+        # FieldStorage will try to get it from sys.argv[1]
+        # which is not what we need.
+        if not environ.has_key('QUERY_STRING'):
+            environ['QUERY_STRING'] = ''
+
         meth = None
         fs = ZopeFieldStorage(fp=fp,environ=environ,keep_blank_values=1)
         if not hasattr(fs,'list') or fs.list is None:
@@ -1636,7 +1642,7 @@
 QPARMRE= re.compile(
         '([\x00- ]*([^\x00- ;,="]+)="([^"]*)"([\x00- ]*[;,])?[\x00- ]*)')
 PARMRE = re.compile(
-        '([\x00- ]*([^\x00- ;,="]+)=([^;,"]*)([\x00- ]*[;,])?[\x00- ]*)')
+        '([\x00- ]*([^\x00- ;,="]+)=([^;]*)([\x00- ]*[;,])?[\x00- ]*)')
 PARAMLESSRE = re.compile(
         '([\x00- ]*([^\x00- ;,="]+)[\x00- ]*[;,][\x00- ]*)')
 def parse_cookie(text,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 #############################################################################
 #
-# Copyright (c) 2001-2009 Zope Foundation and Contributors. All Rights Reserved.
+# Copyright (c) 2001 Zope Foundation and Contributors.
 #
 # 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.
@@ -30,6 +30,8 @@
 from ZPublisher import InternalError
 from ZPublisher import NotFound
 from ZPublisher.BaseResponse import BaseResponse
+from ZPublisher.pubevents import PubBeforeStreaming
+from zope.event import notify
 
 nl2sp = maketrans('\n', ' ')
 
@@ -236,7 +238,7 @@
         if lock:
              self._locked_status = 1
 
-    def setCookie(self, name, value, **kw):
+    def setCookie(self, name, value, quoted=True, **kw):
         """ Set an HTTP cookie.
 
         The response will include an HTTP header that sets a cookie on
@@ -257,6 +259,7 @@
         for k, v in kw.items():
             cookie[k] = v
         cookie['value'] = value
+        cookie['quoted'] = quoted
 
     def appendCookie(self, name, value):
         """ Set an HTTP cookie.
@@ -834,7 +837,10 @@
         b = v
         if isinstance(b, Exception):
             try:
-                b = str(b)
+                try:
+                    b = str(b)
+                except UnicodeEncodeError:
+                    b = self._encode_unicode(unicode(b))
             except:
                 b = '<unprintable %s object>' % type(b).__name__
 
@@ -880,7 +886,10 @@
             # quoted cookie attr values, so only the value part
             # of name=value pairs may be quoted.
 
-            cookie = 'Set-Cookie: %s="%s"' % (name, quote(attrs['value']))
+            if attrs.get('quoted', True):
+                cookie = 'Set-Cookie: %s="%s"' % (name, quote(attrs['value']))
+            else:
+                cookie = 'Set-Cookie: %s=%s' % (name, quote(attrs['value']))
             for name, v in attrs.items():
                 name = name.lower()
                 if name == 'expires':
@@ -958,6 +967,9 @@
 
         """
         if not self._wrote:
+            
+            notify(PubBeforeStreaming(self))
+            
             self.outputBody()
             self._wrote = 1
             self.stdout.flush()

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Publish.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Publish.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Publish.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -153,7 +153,8 @@
                 getattr(cl,'__name__',cl), val,
                 debug_mode and compact_traceback()[-1] or ''))
 
-        if err_hook is not None:
+        # debug is just used by tests (has nothing to do with debug_mode!)
+        if not debug and err_hook is not None:
             retry = False
             if parents:
                 parents=parents[0]
@@ -208,7 +209,7 @@
                         transactions_manager.abort()
             finally:
                 endInteraction()
-                notify(PubFailure(request, exc_info, retry))
+                notify(PubFailure(request, exc_info, False))
             raise
 
 def publish_module_standard(module_name,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Request.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Request.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Request.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Response.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Response.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Response.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/TaintedString.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/TaintedString.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/TaintedString.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Test.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Test.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/Test.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -6,7 +6,7 @@
 #" Waaaa
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/WSGIPublisher.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -50,3 +50,11 @@
     """
     exc_info = Attribute('''The exception info as returned by 'sys.exc_info()'.''')
     retry = Attribute('Whether the request will be retried')
+
+class IPubBeforeStreaming(Interface):
+    """Event fired just before a streaming response is initiated, i.e. when
+    something calls response.write() for the first time. Note that this is
+    carries a reference to the *response*, not the request.
+    """
+    
+    response = Attribute(u"The current HTTP response")

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/mapply.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/mapply.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/mapply.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/maybe_lock.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/maybe_lock.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/maybe_lock.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/pubevents.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/pubevents.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/pubevents.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -10,7 +10,8 @@
 from zope.interface import implements
 
 from interfaces import IPubStart, IPubSuccess, IPubFailure, \
-     IPubAfterTraversal, IPubBeforeCommit, IPubBeforeAbort
+     IPubAfterTraversal, IPubBeforeCommit, IPubBeforeAbort, \
+     IPubBeforeStreaming
 
 class _Base(object):
     """PubEvent base class."""
@@ -49,3 +50,11 @@
     
     def __init__(self, request, exc_info, retry):
         self.request, self.exc_info, self.retry = request, exc_info, retry
+
+class PubBeforeStreaming(object):
+    """Notified immediately before streaming via response.write() commences
+    """
+    implements(IPubBeforeStreaming)
+    
+    def __init__(self, response):
+        self.response = response

Copied: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/exception_handling.txt (from rev 112805, Zope/branches/2.12/src/ZPublisher/tests/exception_handling.txt)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/exception_handling.txt	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/exception_handling.txt	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,205 @@
+Exception handling
+------------------
+
+These tests capture the current behavior. Maybe some of that behavior should
+be changed. The behavior caused by handleErrors=False shows only up in tests.
+
+
+Create the browser object we'll be using.
+
+    >>> from Products.Five.testbrowser import Browser
+    >>> browser = Browser()
+    >>> # XXX: browser has no API for disabling redirects
+    >>> browser.mech_browser.set_handle_redirect(False)
+
+Create the objects that are raising exceptions.
+ 
+    >>> dummy = app.test_folder_1_._setObject('foo', ExceptionRaiser1())
+    >>> dummy = app.test_folder_1_._setObject('bar', ExceptionRaiser2())
+    >>> dummy = app.test_folder_1_._setObject('baz', ExceptionRaiser3())
+
+Handle AttributeError.
+
+    >>> app.test_folder_1_.foo.exception = AttributeError('ERROR VALUE')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 500: Internal Server Error
+    >>> 'Error Type: AttributeError' in browser.contents
+    True
+    >>> 'Error Value: ERROR VALUE' in browser.contents
+    True
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    AttributeError: ERROR VALUE
+
+Handle ImportError.
+
+    >>> app.test_folder_1_.foo.exception = ImportError('ERROR VALUE')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 500: Internal Server Error
+    >>> 'Error Type: ImportError' in browser.contents
+    True
+    >>> 'Error Value: ERROR VALUE' in browser.contents
+    True
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    ImportError: ERROR VALUE
+
+Handle zope.publisher.interfaces.NotFound.
+
+    >>> from zope.publisher.interfaces import NotFound
+    >>> app.test_folder_1_.foo.exception = NotFound('OBJECT','NAME')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 404: Not Found
+    >>> 'Error Type: NotFound' in browser.contents
+    True
+    >>> "Error Value: Object: 'OBJECT', name: 'NAME'" in browser.contents
+    True
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    NotFound: Object: 'OBJECT', name: 'NAME'
+
+Don't handle SystemExit, even if handleErrors is True.
+
+    >>> app.test_folder_1_.foo.exception = SystemExit('ERROR VALUE')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    SystemExit: ERROR VALUE
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    SystemExit: ERROR VALUE
+
+Handle zExceptions.Redirect.
+
+    >>> from zExceptions import Redirect
+    >>> app.test_folder_1_.foo.exception = Redirect('LOCATION')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 302: Moved Temporarily
+    >>> browser.contents
+    ''
+    >>> browser.headers['Location']
+    'LOCATION'
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    Redirect: LOCATION
+
+Handle zExceptions.Unauthorized raised by the object. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
+
+    >>> from zExceptions import Unauthorized
+    >>> app.test_folder_1_.foo.exception = Unauthorized('ERROR VALUE')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 401: Unauthorized
+    >>> 'Error Type: Unauthorized' in browser.contents
+    True
+    >>> 'Error Value: ERROR VALUE' in browser.contents
+    True
+    >>> browser.headers['WWW-Authenticate']
+    'basic realm="Zope2"'
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    Unauthorized: ERROR VALUE
+
+And the same with unicode error value.
+
+    >>> app.test_folder_1_.foo.exception = Unauthorized(u'ERROR VALUE \u03A9')
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 401: Unauthorized
+    >>> 'Error Type: Unauthorized' in browser.contents
+    True
+    >>> 'Error Value: ERROR VALUE ?' in browser.contents
+    True
+    >>> browser.headers['WWW-Authenticate']
+    'basic realm="Zope2"'
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/foo')
+    Traceback (most recent call last):
+    ...
+    Unauthorized: <unprintable ... object>
+
+Handle zExceptions.Unauthorized raised by BaseRequest.traverse. We take the
+'WWW-Authenticate' header as a sign that HTTPResponse._unauthorized was called.
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/bar')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 401: Unauthorized
+    >>> 'Site Error' in browser.contents
+    True
+    >>> 'You are not authorized to access this resource.' in browser.contents
+    True
+    >>> browser.headers['WWW-Authenticate']
+    'basic realm="Zope2"'
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/bar')
+    Traceback (most recent call last):
+    ...
+    Unauthorized: <strong>You are not authorized to access this resource...
+
+Handle zExceptions.Forbidden raised by BaseRequest.traverse. 'traverse'
+converts it into zExceptions.NotFound if we are not in debug mode.
+
+    >>> browser.handleErrors = True
+    >>> browser.open('http://localhost/test_folder_1_/baz')
+    Traceback (most recent call last):
+    ...
+    HTTPError: HTTP Error 404: Not Found
+    >>> '<p><strong>Resource not found</strong></p>' in browser.contents
+    True
+    >>> '<p><b>Resource:</b> index_html</p>' in browser.contents
+    True
+
+    >>> browser.handleErrors = False
+    >>> browser.open('http://localhost/test_folder_1_/baz')
+    Traceback (most recent call last):
+    ...
+    NotFound:   <h2>Site Error</h2>
+    ...<p><strong>Resource not found</strong></p>...
+    ...<p><b>Resource:</b> index_html</p>...

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBaseRequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBaseRequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBaseRequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,5 +1,20 @@
 import unittest
 
+from zope.interface import implements
+from zope.publisher.interfaces import IPublishTraverse
+from zope.publisher.interfaces import NotFound as ztkNotFound
+
+
+class DummyTraverser(object):
+
+    implements(IPublishTraverse)
+
+    def publishTraverse(self, request, name):
+        if name == 'dummy':
+            return 'dummy object'
+        raise ztkNotFound(self, name)
+
+
 class BaseRequest_factory:
 
     def _makeOne(self, root):
@@ -138,6 +153,7 @@
                 return 'unpublishable'
         return DummyObjectWithEmptyDocstring()
 
+
 class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
 
     def _getTargetClass(self):
@@ -372,13 +388,19 @@
     def test_traverse_unsubscriptable(self):
         # See https://bugs.launchpad.net/bugs/213311
         from ZPublisher import NotFound
-        class _Object(object):
-            pass
-        root = _Object()
         r = self._makeOne(None)
         self.assertRaises(NotFound, r.traverse, 'not_found')
 
+    def test_traverse_publishTraverse(self):
+        r = self._makeOne(DummyTraverser())
+        self.assertEqual(r.traverse('dummy'), 'dummy object')
 
+    def test_traverse_publishTraverse_error(self):
+        from ZPublisher import NotFound
+        r = self._makeOne(DummyTraverser())
+        self.assertRaises(NotFound, r.traverse, 'not_found')
+
+
 class TestBaseRequestZope3Views(unittest.TestCase, BaseRequest_factory):
 
     _dummy_interface = None

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBeforeTraverse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBeforeTraverse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testBeforeTraverse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -133,7 +133,8 @@
     """
     pass
 
-from zope.testing import doctest
 
+import doctest
+
 def test_suite():
     return doctest.DocTestSuite(optionflags=doctest.ELLIPSIS)

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRangeSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRangeSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRangeSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPRequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -128,6 +128,13 @@
                 "Key %s not correctly reproduced in tainted; expected %r, "
                 "got %r" % (key, req.form[key], req.taintedform[key]))
 
+    def test_processInputs_wo_query_string(self):
+        env = {'SERVER_NAME': 'testingharnas', 'SERVER_PORT': '80'}
+        req = self._makeOne(environ=env)
+        req.processInputs()
+        self._noFormValuesInOther(req)
+        self.assertEquals(req.form, {})
+
     def test_processInputs_wo_marshalling(self):
         inputs = (
             ('foo', 'bar'), ('spam', 'eggs'),
@@ -989,6 +996,20 @@
             "HTTPRequest.resolve_url should not emit events")
 
 
+    def test_parses_json_cookies(self):
+        # https://bugs.launchpad.net/zope2/+bug/563229
+        # reports cookies in the wild with embedded double quotes (e.g,
+        # JSON-encoded data structures.
+        env = {'SERVER_NAME': 'testingharnas',
+               'SERVER_PORT': '80',
+               'HTTP_COOKIE': 'json={"intkey":123,"stringkey":"blah"}; '
+                              'anothercookie=boring; baz'
+              }
+        req = self._makeOne(environ=env)
+        self.assertEquals(req.cookies['json'],
+                          '{"intkey":123,"stringkey":"blah"}')
+        self.assertEquals(req.cookies['anothercookie'], 'boring')
+
 TEST_ENVIRON = {
     'CONTENT_TYPE': 'multipart/form-data; boundary=12345',
     'REQUEST_METHOD': 'POST',

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -186,7 +186,7 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 1)
+        self.assertEqual(len(cookie), 2)
         self.assertEqual(cookie.get('value'), 'bar')
 
     def test_setCookie_w_existing(self):
@@ -194,12 +194,16 @@
         response.setCookie('foo', 'bar')
         response.setCookie('foo', 'baz')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 1)
+        self.assertEqual(len(cookie), 2)
         self.assertEqual(cookie.get('value'), 'baz')
 
     def test_setCookie_no_attrs(self):
         response = self._makeOne()
         response.setCookie('foo', 'bar')
+        cookie = response.cookies.get('foo', None)
+        self.assertEqual(len(cookie), 2)
+        self.assertEqual(cookie.get('value'), 'bar')
+        self.assertEqual(cookie.get('quoted'), True)
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
         self.assertEqual(cookies[0], 'Set-Cookie: foo="bar"')
@@ -212,6 +216,7 @@
         self.failUnless(cookie)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('expires'), EXPIRES)
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -222,9 +227,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', domain='example.com')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('domain'), 'example.com')
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -235,9 +241,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', path='/')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('path'), '/')
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -247,9 +254,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', comment='COMMENT')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('comment'), 'COMMENT')
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -259,9 +267,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', secure='SECURE')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('secure'), 'SECURE')
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -271,9 +280,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', secure='')
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('secure'), '')
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookies = response._cookie_list()
         self.assertEqual(len(cookies), 1)
@@ -283,9 +293,10 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', http_only=True)
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('http_only'), True)
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookie_list = response._cookie_list()
         self.assertEqual(len(cookie_list), 1)
@@ -295,14 +306,27 @@
         response = self._makeOne()
         response.setCookie('foo', 'bar', http_only=False)
         cookie = response.cookies.get('foo', None)
-        self.assertEqual(len(cookie), 2)
+        self.assertEqual(len(cookie), 3)
         self.assertEqual(cookie.get('value'), 'bar')
         self.assertEqual(cookie.get('http_only'), False)
+        self.assertEqual(cookie.get('quoted'), True)
 
         cookie_list = response._cookie_list()
         self.assertEqual(len(cookie_list), 1)
         self.assertEqual(cookie_list[0], 'Set-Cookie: foo="bar"')
 
+    def test_setCookie_unquoted(self):
+        response = self._makeOne()
+        response.setCookie('foo', 'bar', quoted=False)
+        cookie = response.cookies.get('foo', None)
+        self.assertEqual(len(cookie), 2)
+        self.assertEqual(cookie.get('value'), 'bar')
+        self.assertEqual(cookie.get('quoted'), False)
+
+        cookie_list = response._cookie_list()
+        self.assertEqual(len(cookie_list), 1)
+        self.assertEqual(cookie_list[0], 'Set-Cookie: foo=bar')
+
     def test_appendCookie_w_existing(self):
         response = self._makeOne()
         response.setCookie('foo', 'bar', path='/')

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testPublish.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testPublish.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testPublish.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -391,7 +391,7 @@
     pass
 
 
-from zope.testing import doctest
+import doctest
 
 def test_suite():
     return doctest.DocTestSuite()

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testTaintedString.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testTaintedString.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testTaintedString.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_Converters.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_Converters.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_Converters.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ################################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 #
 # 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.

Copied: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_exception_handling.py (from rev 112805, Zope/branches/2.12/src/ZPublisher/tests/test_exception_handling.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_exception_handling.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_exception_handling.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Functional tests for exception handling.
+
+$Id$
+"""
+
+import unittest
+from Testing.ZopeTestCase import FunctionalDocFileSuite
+
+from OFS.SimpleItem import SimpleItem
+
+
+class ExceptionRaiser1(SimpleItem):
+
+    def index_html(self):
+        """DOCSTRING
+        """
+        raise self.exception
+
+
+class ExceptionRaiser2(ExceptionRaiser1):
+
+    __roles__ = ()
+
+
+class ExceptionRaiser3(SimpleItem):
+
+    def index_html(self):
+        return 'NO DOCSTRING'
+
+
+def test_suite():
+    return unittest.TestSuite([
+        FunctionalDocFileSuite('exception_handling.txt',
+            globs={'ExceptionRaiser1': ExceptionRaiser1,
+                   'ExceptionRaiser2': ExceptionRaiser2,
+                   'ExceptionRaiser3': ExceptionRaiser3,}),
+        ])
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_mapply.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_mapply.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/test_mapply.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testpubevents.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testpubevents.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testpubevents.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,3 +1,4 @@
+from StringIO import StringIO
 from sys import modules, exc_info
 from unittest import TestCase, TestSuite, makeSuite, main
 
@@ -7,11 +8,14 @@
 
 from ZPublisher.Publish import publish, Retry
 from ZPublisher.BaseRequest import BaseRequest
+from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.pubevents import PubStart, PubSuccess, PubFailure, \
-     PubAfterTraversal, PubBeforeCommit, PubBeforeAbort
+     PubAfterTraversal, PubBeforeCommit, PubBeforeAbort, \
+     PubBeforeStreaming
 from ZPublisher.interfaces import \
      IPubStart, IPubEnd, IPubSuccess, IPubFailure, \
-     IPubAfterTraversal, IPubBeforeCommit
+     IPubAfterTraversal, IPubBeforeCommit, \
+     IPubBeforeStreaming
 
 PUBMODULE = 'TEST_testpubevents'
 
@@ -41,7 +45,10 @@
     def testBeforeCommit(self):
         e = PubBeforeCommit(_Request())
         verifyObject(IPubBeforeCommit, e)
-
+    
+    def testBeforeStreaming(self):
+        e = PubBeforeStreaming(_Response())
+        verifyObject(IPubBeforeStreaming, e)
         
 class TestPubEvents(TestCase):
     def setUp(self):
@@ -127,6 +134,21 @@
         self.assert_(isinstance(events[5], PubBeforeCommit))
         self.assert_(isinstance(events[6], PubSuccess))
 
+    def testStreaming(self):
+        
+        out = StringIO()
+        response = HTTPResponse(stdout=out)
+        response.write('datachunk1')
+        response.write('datachunk2')
+        
+        events = self.reporter.events
+        self.assertEqual(len(events), 1)
+        self.assert_(isinstance(events[0], PubBeforeStreaming))
+        self.assertEqual(events[0].response, response)
+        
+        self.failUnless('datachunk1datachunk2' in out.getvalue())
+
+
 # Auxiliaries
 def _succeed():
     ''' '''

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/xmlrpc.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/xmlrpc.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/xmlrpc.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/AccessLogger.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/AccessLogger.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/AccessLogger.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/BaseLogger.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/BaseLogger.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/BaseLogger.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/ClockServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/ClockServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/ClockServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Chris McDonough. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/DebugLogger.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/DebugLogger.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/DebugLogger.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/FCGIServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/FCGIServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/FCGIServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPRequest.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPRequest.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPRequest.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPResponse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPResponse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/FTPServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPResponse.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPResponse.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -26,18 +26,19 @@
 
 from ZPublisher.HTTPResponse import HTTPResponse # WTF?
 from ZPublisher.Iterators import IStreamIterator # WTF?
+from ZPublisher.pubevents import PubBeforeStreaming # WTF?
+from zope.event import notify
 
+from ZServer.DebugLogger import log
+from ZServer.medusa import http_server
 from ZServer.medusa.http_date import build_http_date
-from ZServer.PubCore.ZEvent import Wakeup
-from ZServer.medusa import http_server
-
-from ZServer.Producers import ShutdownProducer
-from ZServer.Producers import LoggingProducer
 from ZServer.Producers import CallbackProducer
+from ZServer.Producers import file_close_producer
 from ZServer.Producers import file_part_producer
-from ZServer.Producers import file_close_producer
 from ZServer.Producers import iterator_producer
-from ZServer.DebugLogger import log
+from ZServer.Producers import LoggingProducer
+from ZServer.Producers import ShutdownProducer
+from ZServer.PubCore.ZEvent import Wakeup
 
 
 class ZServerHTTPResponse(HTTPResponse):
@@ -170,6 +171,7 @@
         stdout = self.stdout
 
         if not self._wrote:
+            notify(PubBeforeStreaming(self))
             l = self.headers.get('content-length', None)
             if l is not None:
                 try:

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/HTTPServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/ICPServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/ICPServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/ICPServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/PCGIServer.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/PCGIServer.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/PCGIServer.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/Producers.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/Producers.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/Producers.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZEvent.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZEvent.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZEvent.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZRendezvous.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZRendezvous.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZRendezvous.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZServerPublisher.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZServerPublisher.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/ZServerPublisher.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/PubCore/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/WebDAVSrcHandler.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/WebDAVSrcHandler.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/WebDAVSrcHandler.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/datatypes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/datatypes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/datatypes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_config.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_config.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_config.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_responses.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_responses.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/tests/test_responses.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -19,17 +19,21 @@
 from ZServer.PCGIServer import PCGIResponse
 from ZServer.FCGIServer import FCGIResponse
 from ZPublisher.Iterators import IStreamIterator
+from ZPublisher.pubevents import PubBeforeStreaming
 from zope.interface import implements
 import unittest
 from cStringIO import StringIO
 
+from zope.event import subscribers
+
+
 class ZServerResponseTestCase(unittest.TestCase):
     """Test ZServer response objects."""
 
     def test_http_response_write_unicode(self):
         response = ZServerHTTPResponse()
         self.assertRaises(TypeError, response.write, u'bad')
-
+    
     def test_ftp_response_write_unicode(self):
         response = FTPResponse()
         self.assertRaises(TypeError, response.write, u'bad')
@@ -57,7 +61,7 @@
         one = ZServerHTTPResponse(stdout=DummyChannel())
         self.assertRaises(AssertionError,
                           one.setBody, test_streamiterator())
-        
+    
 class DummyChannel:
     def __init__(self):
         self.out = StringIO()
@@ -269,12 +273,39 @@
                                        '',
                                        ''))
 
+class _Reporter(object):
+    def __init__(self): self.events = []
+    def __call__(self, event): self.events.append(event)
 
+class ZServerHTTPResponseEventsTestCase(unittest.TestCase):
+
+    def setUp(self):
+        self._saved_subscribers = subscribers[:]
+        self.reporter = r = _Reporter()
+        subscribers[:] = [r]
+
+    def tearDown(self):
+        subscribers[:] = self._saved_subscribers
+    
+    def testStreaming(self):
+        out = StringIO()
+        response = ZServerHTTPResponse(stdout=out)
+        response.write('datachunk1')
+        response.write('datachunk2')
+        
+        events = self.reporter.events
+        self.assertEqual(len(events), 1)
+        self.assert_(isinstance(events[0], PubBeforeStreaming))
+        self.assertEqual(events[0].response, response)
+        
+        self.failUnless('datachunk1datachunk2' in out.getvalue())
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTests((
         unittest.makeSuite(ZServerResponseTestCase),
-        unittest.makeSuite(ZServerHTTPResponseTestCase)
+        unittest.makeSuite(ZServerHTTPResponseTestCase),
+        unittest.makeSuite(ZServerHTTPResponseEventsTestCase)
     ))
     return suite
 

Modified: Zope/branches/tseaver-fix_wsgi/src/ZServer/utils.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZServer/utils.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZServer/utils.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Batch.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Batch.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Batch.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZTUtils/SimpleTree.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZTUtils/SimpleTree.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZTUtils/SimpleTree.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Tree.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Tree.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Tree.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Zope.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Zope.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZTUtils/Zope.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/ZTUtils/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZTUtils/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/ZTUtils/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/ClassFactory.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/ClassFactory.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/ClassFactory.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # 
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 # 
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/startup.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/startup.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/startup.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,13 +1,13 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """Initialize the Zope2 Package and provide a published module
@@ -20,16 +20,15 @@
 from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
+from Acquisition.interfaces import IAcquirer
 from App.config import getConfiguration
 from time import asctime
-from types import StringType, ListType
 from zExceptions import upgradeException
 from zExceptions import Redirect
 from zExceptions import Unauthorized
 from ZODB.POSException import ConflictError
 import transaction
 import AccessControl.User
-import App.FindHomes
 import ExtensionClass
 import imp
 import logging
@@ -205,17 +204,27 @@
             # raise the rendered value as the exception value
             # (basically the same that 'raise_standardErrorMessage'
             # does. The view is named 'index.html' because that's what
-            # Zope 3 uses as well.
+            # zope.publisher uses as well.
             view = queryMultiAdapter((v, REQUEST), name=u'index.html')
             if view is not None:
+                if IAcquirer.providedBy(view) and IAcquirer.providedBy(published):
+                    view = view.__of__(published)
+                else:
+                    view.__parent__ = published
                 v = view()
+                if issubclass(t, Unauthorized):
+                    # Re-raise Unauthorized to make sure it is handled
+                    # correctly. We can't do that with all exceptions
+                    # because some don't work with the rendered v as
+                    # argument.
+                    raise t, v, traceback
                 response = REQUEST.RESPONSE
                 response.setStatus(t)
                 response.setBody(v)
                 return response
 
             if (published is None or published is app or
-                type(published) is ListType):
+                isinstance(published, list)):
                 # At least get the top-level object
                 published=app.__bobo_traverse__(REQUEST).__of__(
                     RequestContainer(REQUEST))
@@ -249,12 +258,18 @@
                            error_log_url=error_log_url)
                 if result is not None:
                     t, v, traceback = result
+                    if issubclass(t, Unauthorized):
+                        # Re-raise Unauthorized to make sure it is handled
+                        # correctly. We can't do that with all exceptions
+                        # because some don't work with the rendered v as
+                        # argument.
+                        raise t, v, traceback
                     response = REQUEST.RESPONSE
                     response.setStatus(t)
                     response.setBody(v)
                     return response
             except TypeError:
-                # Pre 2.6 call signature
+                # BBB: Pre Zope 2.6 call signature
                 f(client, REQUEST, t, v, traceback)
 
         finally:

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testDoomedTransaction.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testDoomedTransaction.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testDoomedTransaction.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testExceptionHook.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testExceptionHook.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/App/tests/testExceptionHook.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -16,6 +16,7 @@
 import unittest
 import logging
 
+import Acquisition
 from zope.component.testing import PlacelessSetup
 from zope.interface.common.interfaces import IException
 from zope.publisher.skinnable import setDefaultSkin
@@ -215,7 +216,7 @@
         self.call_no_exc(hook, None, None, f)
         self.assertEquals(hook.unresolved_conflict_errors, 2)
 
-class Client:
+class Client(Acquisition.Explicit):
 
     def __init__(self):
         self.standard_error_message = True
@@ -320,14 +321,16 @@
         tb = client.messages[0]
         self.failUnless("ConflictError: database conflict error" in tb, tb)
 
-class CustomExceptionView:
+class CustomExceptionView(Acquisition.Explicit):
 
     def __init__(self, context, request):
         self.context = context
         self.request = request
 
     def __call__(self):
-        return "Exception View: %s" % self.context.__class__.__name__
+        return "Exception View: %s\nContext: %s" % (
+                self.context.__class__.__name__,
+                Acquisition.aq_parent(self).__class__.__name__)
 
 def registerExceptionView(for_):
     from zope.interface import Interface
@@ -344,7 +347,6 @@
 class ExceptionViewsTest(PlacelessSetup, ExceptionHookTestCase):
 
     def testCustomExceptionViewUnauthorized(self):
-        from ZPublisher.HTTPResponse import HTTPResponse
         from AccessControl import Unauthorized
         registerExceptionView(IUnauthorized)
         def f():
@@ -352,9 +354,9 @@
         request = self._makeRequest()
         client = StandardClient()
         v = self.call_exc_value(client, request, f)
-        self.failUnless(isinstance(v, HTTPResponse), v)
-        self.failUnless(v.status == 401, (v.status, 401))
+        self.failUnless(isinstance(v, Unauthorized), v)
         self.failUnless("Exception View: Unauthorized" in str(v))
+        self.failUnless("Context: StandardClient" in str(v))
 
     def testCustomExceptionViewForbidden(self):
         from ZPublisher.HTTPResponse import HTTPResponse

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/ClassFactory.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/ClassFactory.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/ClassFactory.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/datatypes.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/datatypes.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/datatypes.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/handlers.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/handlers.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/handlers.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -207,12 +207,17 @@
 
     # set up trusted proxies
     if config.trusted_proxies:
-        import ZPublisher.HTTPRequest
+        from ZPublisher import HTTPRequest
         # DM 2004-11-24: added host name mapping (such that examples in
         # conf file really have a chance to work
         mapped = []
         for name in config.trusted_proxies: mapped.extend(_name2Ips(name))
-        ZPublisher.HTTPRequest.trusted_proxies = tuple(mapped)
+        HTTPRequest.trusted_proxies = tuple(mapped)
+    
+    # set the maximum number of ConflictError retries
+    if config.max_conflict_retries:
+        from ZPublisher import HTTPRequest
+        HTTPRequest.retry_max_count = config.max_conflict_retries
 
 
 def handleConfig(config, multihandler):

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/TextBlockFormatter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/TextBlockFormatter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/TextBlockFormatter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 # 
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/lock_file.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/lock_file.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/lock_file.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/zpasswd.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/zpasswd.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/misc/zpasswd.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/options.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/options.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/options.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/run.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/run.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/run.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/testStarter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/testStarter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/testStarter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_schema.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_schema.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_schema.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -208,6 +208,19 @@
         self.assertEqual(conf.databases[0].config.connection_class.__name__,
                          'LowConflictConnection')
 
+    def test_max_conflict_retries_default(self):
+        conf, handler = self.load_config_text("""\
+            instancehome <<INSTANCE_HOME>>
+            """)
+        self.assertEqual(conf.max_conflict_retries, 3)
+
+    def test_max_conflict_retries_explicit(self):
+        conf, handler = self.load_config_text("""\
+            instancehome <<INSTANCE_HOME>>
+            max-conflict-retries 15
+            """)
+        self.assertEqual(conf.max_conflict_retries, 15)
+
 def test_suite():
     return unittest.makeSuite(StartupTestCase)
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_warnfilter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_warnfilter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/tests/test_warnfilter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/warnfilter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/warnfilter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/warnfilter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003 Zope Corporation and Contributors.
+# Copyright (c) 2003 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopectl.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopectl.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopectl.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,7 +1,7 @@
 #!python
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopeschema.xml	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/Startup/zopeschema.xml	2010-05-28 20:11:49 UTC (rev 112816)
@@ -212,10 +212,23 @@
     <multikey name="mount-point" required="yes" attribute="mount_points"
               datatype=".mount_point">
       <description>
-       The mount point is the slash-separated path to which this database
-       will be mounted within the Zope application server. If the path 
-       on the ZEO server is different from the path of the mount point then
-       you can use a notation "path_on_client:path_on_zeo_server".
+       The mount point is a slash-separated path to a
+       'Products.ZODBMountPoint.Mount.MountPoint' instance in Zope. If
+       such an instance exists, it can mount an object (the mounted
+       object) into Zope.
+       By default, the object will be mounted at the same path in Zope (i.e.
+       '/foo/bar' in the database will be mounted at '/foo/bar' in Zope).
+
+       The object can be mounted at a different point using the
+       'virtual_path:real_path' syntax (e.g.  'mount-point /foo/bar:/bar'
+       will mount the object at '/bar' in the database to '/foo/bar' in
+       Zope). The name of the mount point ('bar') must be the same as
+       the mounted object.
+
+       It is also possible to specify the root that should be used in the
+       mounted database by using the syntax
+       'virtual_path:~real_root:real_path'. The root defaults to 'Application'
+       and should not normally be changed.
       </description>
     </multikey>
 
@@ -653,6 +666,12 @@
      <metadefault>unset</metadefault>
   </multikey>
 
+  <key name="max-conflict-retries" datatype="integer" default="3" attribute="max_conflict_retries">
+    <description>
+      The maximum number of retries on a conflict error
+    </description>
+  </key>
+
   <key name="security-policy-implementation"
        datatype=".security_policy_implementation"
        default="C">

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -55,7 +55,7 @@
     """Utility to try a Zope request using the interactive interpreter"""
     startup()
     import ZPublisher
-    return ZPublisher.test('Zope', *args, **kw)
+    return ZPublisher.test('Zope2', *args, **kw)
 
 from Zope2.Startup.run import configure
 

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/check_catalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/check_catalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/check_catalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/compilezpy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/compilezpy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/compilezpy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/copyzopeskel.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/copyzopeskel.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/copyzopeskel.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/decompilezpy.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/decompilezpy.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/decompilezpy.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/load_site.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/load_site.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/load_site.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.
@@ -245,8 +245,8 @@
             body = ("<!--#var standard_html_header-->\n\n" +
                     body + "\n\n<!--#var standard_html_footer-->")
         else:
-            body = ("<html><head><title><dtml-var title_or_id></title>
-                     </head><body bgcolor="#FFFFFF">\n\n" +
+            body = ("<html><head><title><dtml-var title_or_id></title>"
+                    "</head><body bgcolor=\"#FFFFFF\">\n\n" +
                      body + "\n\n</body></html>")
 
     else:

Deleted: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzeoinstance.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzeoinstance.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzeoinstance.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,30 +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.
-#
-##############################################################################
-
-import os
-import sys
-
-mydir = os.path.dirname(os.path.abspath(sys.argv[0]))
-zopehome = os.path.dirname(mydir)
-softwarehome = os.path.join(zopehome, "lib", "python")
-
-if softwarehome not in sys.path:
-    sys.path.insert(0, softwarehome)
-
-from ZEO.mkzeoinst import ZEOInstanceBuilder
-
-def main():
-    ZEOInstanceBuilder().run()
-
-if __name__ == "__main__":
-    main()

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzopeinstance.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzopeinstance.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/mkzopeinstance.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/reindex_catalog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/reindex_catalog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/reindex_catalog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/requestprofiler.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/requestprofiler.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/requestprofiler.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/skel/etc/zope.conf.in
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/skel/etc/zope.conf.in	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/skel/etc/zope.conf.in	2010-05-28 20:11:49 UTC (rev 112816)
@@ -826,6 +826,18 @@
 #
 #    conflict-error-log-level blather
 
+# Directive: max-conflict-retries
+#
+# Description:
+#     Specifies how many times a transaction will be re-tried when
+#     it generates ConflictErrors.  This can be a problem when using
+#     a ZEO server and you have large numbers of simultaneous writes.
+#
+# Default: 3
+#
+# Example:
+#
+#    max-conflict-retries 10
 
 # Directive: warnfilter
 #

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/tracelog.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/tracelog.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/tracelog.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/zpasswd.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/zpasswd.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/Zope2/utilities/zpasswd.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001,2002 Zope Corporation and Contributors.
+# Copyright (c) 2001,2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/nt_svcutils/service.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/nt_svcutils/service.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/nt_svcutils/service.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003-2009 Zope Corporation and Contributors.
+# Copyright (c) 2003-2009 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/reStructuredText/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/reStructuredText/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/reStructuredText/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/Collection.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/Collection.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/Collection.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/EtagSupport.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/EtagSupport.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/EtagSupport.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/LockItem.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/LockItem.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/LockItem.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/Lockable.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/Lockable.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/Lockable.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/NullResource.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/NullResource.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/NullResource.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/Resource.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/Resource.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/Resource.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/common.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/common.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/common.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/davcmds.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/davcmds.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/davcmds.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/interfaces.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/interfaces.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/interfaces.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/webdav/xmltools.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/webdav/xmltools.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/webdav/xmltools.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/zExceptions/ExceptionFormatter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/ExceptionFormatter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/ExceptionFormatter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -208,7 +208,7 @@
         return cgi.escape(s)
 
     def getPrefix(self):
-        return '<p>Traceback (innermost last):\r\n<ul>'
+        return '<p>Traceback (innermost last):</p>\r\n<ul>'
 
     def formatSupplementLine(self, line):
         return '<b>%s</b>' % self.escape(str(line))
@@ -223,7 +223,7 @@
         return '<li>%s</li>' % line
 
     def formatLastLine(self, exc_line):
-        return '</ul>%s</p>' % self.escape(exc_line)
+        return '</ul><p>%s</p>' % self.escape(exc_line)
 
     def formatExtraInfo(self, supplement):
         getInfo = getattr(supplement, 'getInfo', None)

Modified: Zope/branches/tseaver-fix_wsgi/src/zExceptions/ITracebackSupplement.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/ITracebackSupplement.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/ITracebackSupplement.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: Zope/branches/tseaver-fix_wsgi/src/zExceptions/__init__.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/__init__.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/__init__.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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.

Modified: Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/testExceptionFormatter.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/testExceptionFormatter.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/testExceptionFormatter.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Copied: Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/test_unauthorized.py (from rev 112805, Zope/branches/2.12/src/zExceptions/tests/test_unauthorized.py)
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/test_unauthorized.py	                        (rev 0)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/tests/test_unauthorized.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -0,0 +1,130 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation 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 tests for unauthorized module.
+
+$Id$
+"""
+
+import unittest
+from zope.interface.verify import verifyClass
+
+_MESSAGE = "You are not allowed to access '%s' in this context"
+
+
+class UnauthorizedTests(unittest.TestCase):
+
+    def _getTargetClass(self):
+        from zExceptions.unauthorized import Unauthorized
+
+        return Unauthorized
+
+    def _makeOne(self, *args, **kw):
+        return self._getTargetClass()(*args, **kw)
+
+    def test_interfaces(self):
+        from zope.security.interfaces import IUnauthorized
+
+        verifyClass(IUnauthorized, self._getTargetClass())
+
+    def test_empty(self):
+        exc = self._makeOne()
+
+        self.assertEqual(exc.name, None)
+        self.assertEqual(exc.message, None)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertEqual(str(exc), str(repr(exc)))
+        self.assertEqual(unicode(exc), unicode(repr(exc)))
+
+    def test_ascii_message(self):
+        arg = 'ERROR MESSAGE'
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, None)
+        self.assertEqual(exc.message, arg)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertEqual(str(exc), arg)
+        self.assertEqual(unicode(exc), arg.decode('ascii'))
+
+    def test_encoded_message(self):
+        arg = u'ERROR MESSAGE \u03A9'.encode('utf-8')
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, None)
+        self.assertEqual(exc.message, arg)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertEqual(str(exc), arg)
+        self.assertRaises(UnicodeDecodeError, unicode, exc)
+
+    def test_unicode_message(self):
+        arg = u'ERROR MESSAGE \u03A9'
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, None)
+        self.assertEqual(exc.message, arg)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertRaises(UnicodeEncodeError, str, exc)
+        self.assertEqual(unicode(exc), arg)
+
+    def test_ascii_name(self):
+        arg = 'ERROR_NAME'
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, arg)
+        self.assertEqual(exc.message, None)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertEqual(str(exc), _MESSAGE % arg)
+        self.assertEqual(unicode(exc), _MESSAGE % arg.decode('ascii'))
+
+    def test_encoded_name(self):
+        arg = u'ERROR_NAME_\u03A9'.encode('utf-8')
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, arg)
+        self.assertEqual(exc.message, None)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertEqual(str(exc), _MESSAGE % arg)
+        self.assertRaises(UnicodeDecodeError, unicode, exc)
+
+    def test_unicode_name(self):
+        arg = u'ERROR_NAME_\u03A9'
+        exc = self._makeOne(arg)
+
+        self.assertEqual(exc.name, arg)
+        self.assertEqual(exc.message, None)
+        self.assertEqual(exc.value, None)
+        self.assertEqual(exc.needed, None)
+
+        self.assertRaises(UnicodeEncodeError, str, exc)
+        self.assertEqual(unicode(exc), _MESSAGE % arg)
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(UnauthorizedTests))
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Modified: Zope/branches/tseaver-fix_wsgi/src/zExceptions/unauthorized.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/zExceptions/unauthorized.py	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/src/zExceptions/unauthorized.py	2010-05-28 20:11:49 UTC (rev 112816)
@@ -1,23 +1,23 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002 Zope Foundation and Contributors.
 #
 # 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
+# FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
 """
 $Id$
 """
 
-from types import StringType
 from zope.interface import implements
 from zope.security.interfaces import IUnauthorized
 
+
 class Unauthorized(Exception):
     """Some user wasn't allowed to access a resource
     """
@@ -38,12 +38,12 @@
         Unauthorized(name, value, needed)
         Unauthorized(message, value, needed, name)
 
-        Where needed is a mapping objects with items represnting requirements
+        Where needed is a mapping objects with items representing requirements
         (e.g. {'permission': 'add spam'}). Any extra keyword arguments
         provides are added to needed.
         """
         if name is None and (
-            not isinstance(message, StringType) or len(message.split()) <= 1):
+            not isinstance(message, basestring) or len(message.split()) <= 1):
             # First arg is a name, not a message
             name=message
             message=None
@@ -59,7 +59,8 @@
         self.needed=needed
 
     def __str__(self):
-        if self.message is not None: return self.message
+        if self.message is not None:
+            return self.message
         if self.name is not None:
             return ("You are not allowed to access '%s' in this context"
                     % self.name)
@@ -68,6 +69,11 @@
                     % self.getValueName())
         return repr(self)
 
+    def __unicode__(self):
+        result = self.__str__()
+        if isinstance(result, unicode):
+            return result
+        return unicode(result, 'ascii') # override sys.getdefaultencoding()
 
     def getValueName(self):
         v=self.value

Modified: Zope/branches/tseaver-fix_wsgi/versions.cfg
===================================================================
--- Zope/branches/tseaver-fix_wsgi/versions.cfg	2010-05-28 19:17:23 UTC (rev 112815)
+++ Zope/branches/tseaver-fix_wsgi/versions.cfg	2010-05-28 20:11:49 UTC (rev 112816)
@@ -2,44 +2,55 @@
 versions = versions
 
 [versions]
-Acquisition = 2.12.4
-DateTime = 2.12.0
-ExtensionClass = 2.11.3
-Persistence = 2.11.1
-tempstorage = 2.11.2
-zLOG = 2.11.1
-
-# Zope Toolkit KGS
+Zope2 =
+Acquisition = 2.13.3
 ClientForm = 0.2.10
-RestrictedPython = 3.5.1
-ZConfig = 2.7.1
-ZODB3 = 3.9.4
+DateTime = 2.12.2
+distribute = 0.6.12
 docutils = 0.6
+ExtensionClass = 2.13.1
+five.formlib = 1.0.2
+initgroups = 2.13.0
+Jinja2 = 2.4.1
 lxml = 2.2
 mechanize = 0.1.11
+Missing = 2.13.0
+MultiMapping = 2.13.0
+Persistence = 2.13.1
+Pygments = 1.3.1
 python-gettext = 1.0
-pytz = 2009r
+pytz = 2010h
+Record = 2.13.0
+RestrictedPython = 3.5.2
+roman = 1.4.0
 setuptools = 0.6c11
+Sphinx = 0.6.5
+tempstorage = 2.11.2
+ThreadLock = 2.13.0
 transaction = 1.0.0
 zc.buildout = 1.4.3
 zc.lockfile = 1.0.0
 zc.recipe.egg = 1.2.2
 zc.recipe.testrunner = 1.2.0
+ZConfig = 2.7.1
 zdaemon = 2.0.4
+zLOG = 2.11.1
+ZODB3 = 3.9.5
 zodbcode = 3.4.0
-zope.annotation = 3.4.2
+ZopeUndo = 2.12.0
+zope.annotation = 3.5.0
 zope.app.apidoc = 3.6.2
 zope.app.applicationcontrol = 3.5.0
 zope.app.appsetup = 3.11
 zope.app.authentication = 3.6.0
 zope.app.basicskin = 3.4.1
 zope.app.broken = 3.5.0
-zope.app.cache = 3.5.0
+zope.app.cache = 3.6.0
 zope.app.catalog = 3.8.0
 zope.app.component = 3.8.3
 zope.app.container = 3.8.0
 zope.app.content = 3.4.0
-zope.app.dav = 3.5.0
+zope.app.dav = 3.5.1
 zope.app.debug = 3.4.1
 zope.app.dependable = 3.4.0
 zope.app.dtmlpage = 3.5.0
@@ -50,35 +61,35 @@
 zope.app.form = 3.8.1
 zope.app.generations = 3.5.0
 zope.app.http = 3.6.0
-zope.app.i18n = 3.6.0
+zope.app.i18n = 3.6.1
 zope.app.interface = 3.5.0
 zope.app.intid = 3.7.0
-zope.app.locales = 3.5.1
-zope.app.localpermission = 3.7.0
+zope.app.locales = 3.6.1
+zope.app.localpermission = 3.7.2
 zope.app.pagetemplate = 3.7.1
-zope.app.principalannotation = 3.6.1
-zope.app.publication = 3.7.0
-zope.app.publisher = 3.8.3
-zope.app.renderer = 3.5.0
+zope.app.principalannotation = 3.7.0
+zope.app.publication = 3.8.1
+zope.app.publisher = 3.8.4
+zope.app.renderer = 3.5.1
 zope.app.rotterdam = 3.5.0
 zope.app.schema = 3.5.0
-zope.app.security = 3.7.0
+zope.app.security = 3.7.3
 zope.app.securitypolicy = 3.5.1
 zope.app.server = 3.4.2
-zope.app.session = 3.6.0
-zope.app.testing = 3.6.2
+zope.app.session = 3.6.1
+zope.app.testing = 3.7.3
 zope.app.traversing = 3.4.0
 zope.app.undo = 3.5.0
-zope.app.wsgi = 3.5.2
-zope.app.zapi = 3.4.0
+zope.app.wsgi = 3.6.0
+zope.app.zapi = 3.4.1
 zope.app.zcmlfiles = 3.5.5
 zope.app.zopeappgenerations = 3.5.0
 zope.app.zptpage = 3.5.0
-zope.authentication = 3.7.0
-zope.broken = 3.5.0
-zope.browser = 1.2
-zope.cachedescriptors = 3.5.0
-zope.catalog = 3.8.0
+zope.authentication = 3.7.1
+zope.broken = 3.6.0
+zope.browser = 1.3
+zope.cachedescriptors = 3.5.1
+zope.catalog = 3.8.1
 zope.component = 3.7.1
 zope.componentvocabulary = 1.0
 zope.configuration = 3.6.0
@@ -89,7 +100,7 @@
 zope.copypastemove = 3.5.2
 zope.datetime = 3.4.0
 zope.decorator = 3.4.0
-zope.deferredimport = 3.5.0
+zope.deferredimport = 3.5.1
 zope.deprecation = 3.4.0
 zope.documenttemplate = 3.4.2
 zope.dottedname = 3.4.6
@@ -98,28 +109,29 @@
 zope.event = 3.4.1
 zope.exceptions = 3.5.2
 zope.filerepresentation = 3.5.0
-zope.formlib = 3.6.0
+zope.formlib = 3.7.0
 zope.hookable = 3.4.1
-zope.i18n = 3.7.2
-zope.i18nmessageid = 3.4.3
-zope.index = 3.5.1
+zope.i18n = 3.7.3
+zope.i18nmessageid = 3.5.2
+zope.index = 3.6.0
 zope.interface = 3.5.3
 zope.intid = 3.7.0
-zope.keyreference = 3.6.1
-zope.lifecycleevent = 3.5.2
-zope.location = 3.5.4
-zope.minmax = 1.1.1
+zope.keyreference = 3.6.2
+zope.lifecycleevent = 3.6.1
+zope.location = 3.6.0
+zope.minmax = 1.1.2
+zope.mkzeoinstance = 3.9.4
 zope.modulealias = 3.4.0
+zope.pagetemplate = 3.5.1
 zope.password = 3.5.1
-zope.pagetemplate = 3.5.0
 zope.principalannotation = 3.6.0
 zope.principalregistry = 3.7.0
 zope.processlifetime = 1.0
-zope.proxy = 3.5.0
+zope.proxy = 3.6.0
 zope.publisher = 3.8.0
 zope.schema = 3.5.4
-zope.security = 3.7.2
-zope.securitypolicy = 3.6.0
+zope.security = 3.7.3
+zope.securitypolicy = 3.6.1
 zope.sendmail = 3.5.1
 zope.sequencesort = 3.4.0
 zope.server = 3.5.0
@@ -130,7 +142,7 @@
 zope.tal = 3.5.2
 zope.tales = 3.4.0
 zope.testbrowser = 3.6.0a2
-zope.testing = 3.7.7
+zope.testing = 3.9.4
 zope.thread = 3.4
 zope.traversing = 3.7.1
-zope.viewlet = 3.5.0
+zope.viewlet = 3.6.1



More information about the checkins mailing list