[Zope-Checkins] SVN: Zope/trunk/ Merge philikon-zope32-integration
branch. Basically, this branch entails:
Philipp von Weitershausen
philikon at philikon.de
Wed Nov 2 13:34:39 EST 2005
Log message for revision 39848:
Merge philikon-zope32-integration branch. Basically, this branch entails:
* Updated svn externals to include Zope 3.2 (currently the Zope3 trunk);
that includes two new top-level packages, pytz and zodbcode, as well as
the following new zope.* packages:
- zope.deprecation
- zope.dottedname
- zope.formlib
- zope.index
- zope.testbrowser
* Moved to a zpkgutils-based build system, as the Zope 3.2 extension modules
require to be built with it. If everything goes ahead as planned, the release
tarball will also be built with zpkgutils (some work has also been done in
that direction).
* Upgraded Five to the 1.3b release (released today) which is a Zope 3.2-compatible
version of Five 1.2b (also released today). Biggest implication of this on the
Zope 2 trunk is that the event work by Florent Guillaume has been folded back
into the Zope 2 core, i.e. the OFS package.
* A few fixes to the Zope 2 PageTemplate/TAL/TALES implementation to work with the
new immutable i18n Messages available since Zope 3.1+ (and standard in Zope 3.2).
Changed:
D Zope/trunk/PUBLICATION.cfg
A Zope/trunk/ZopePublicLicense.txt
A Zope/trunk/buildsupport/
U Zope/trunk/configure
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/inst/Makefile.in
U Zope/trunk/inst/configure.py
_U Zope/trunk/lib/python/
U Zope/trunk/lib/python/AccessControl/cAccessControl.c
U Zope/trunk/lib/python/Acquisition/_Acquisition.c
U Zope/trunk/lib/python/ComputedAttribute/_ComputedAttribute.c
U Zope/trunk/lib/python/DocumentTemplate/cDocumentTemplate.c
U Zope/trunk/lib/python/ExtensionClass/_ExtensionClass.c
U Zope/trunk/lib/python/MethodObject/_MethodObject.c
U Zope/trunk/lib/python/Missing/_Missing.c
U Zope/trunk/lib/python/MultiMapping/_MultiMapping.c
U Zope/trunk/lib/python/OFS/Application.py
U Zope/trunk/lib/python/OFS/CopySupport.py
U Zope/trunk/lib/python/OFS/ObjectManager.py
U Zope/trunk/lib/python/OFS/OrderSupport.py
U Zope/trunk/lib/python/OFS/SimpleItem.py
A Zope/trunk/lib/python/OFS/event.py
U Zope/trunk/lib/python/OFS/interfaces.py
A Zope/trunk/lib/python/OFS/subscribers.py
U Zope/trunk/lib/python/OFS/tests/testObjectManager.py
U Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
U Zope/trunk/lib/python/Persistence/_Persistence.c
U Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
U Zope/trunk/lib/python/Products/Five/CHANGES.txt
U Zope/trunk/lib/python/Products/Five/CREDITS.txt
D Zope/trunk/lib/python/Products/Five/adding.py
U Zope/trunk/lib/python/Products/Five/browser/TrustedExpression.py
U Zope/trunk/lib/python/Products/Five/browser/__init__.py
U Zope/trunk/lib/python/Products/Five/browser/absoluteurl.py
U Zope/trunk/lib/python/Products/Five/browser/adding.py
U Zope/trunk/lib/python/Products/Five/browser/configure.zcml
U Zope/trunk/lib/python/Products/Five/browser/menu.py
U Zope/trunk/lib/python/Products/Five/browser/meta.zcml
U Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py
U Zope/trunk/lib/python/Products/Five/browser/resource.py
U Zope/trunk/lib/python/Products/Five/browser/tests/adding.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/defaultview.zcml
U Zope/trunk/lib/python/Products/Five/browser/tests/overrides.zcml
U Zope/trunk/lib/python/Products/Five/browser/tests/pages.py
U Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml
U Zope/trunk/lib/python/Products/Five/browser/tests/pages_ftest.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/pts_test_languages.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/resource.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/resource_ftest.txt
U Zope/trunk/lib/python/Products/Five/browser/tests/test_absoluteurl.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_defaultview.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_i18n.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_menu.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_pages.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_recurse.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_resource.py
U Zope/trunk/lib/python/Products/Five/browser/tests/test_traversable.py
U Zope/trunk/lib/python/Products/Five/configure.zcml
A Zope/trunk/lib/python/Products/Five/deprecated.zcml
U Zope/trunk/lib/python/Products/Five/doc/directives.txt
U Zope/trunk/lib/python/Products/Five/doc/features.txt
A Zope/trunk/lib/python/Products/Five/doc/five14goals.txt
A Zope/trunk/lib/python/Products/Five/doc/localsite.txt
U Zope/trunk/lib/python/Products/Five/doc/main.txt
U Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/__init__.py
A Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/addDemoContent.pt
U Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/browser.py
U Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/configure.zcml
U Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/democontent.py
A Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/green5.png
A Zope/trunk/lib/python/Products/Five/event.zcml
U Zope/trunk/lib/python/Products/Five/eventconfigure.py
U Zope/trunk/lib/python/Products/Five/fiveconfigure.py
U Zope/trunk/lib/python/Products/Five/fivedirectives.py
U Zope/trunk/lib/python/Products/Five/form/__init__.py
U Zope/trunk/lib/python/Products/Five/form/metaconfigure.py
A Zope/trunk/lib/python/Products/Five/form/objectwidget.pt
A Zope/trunk/lib/python/Products/Five/form/objectwidget.py
U Zope/trunk/lib/python/Products/Five/form/tests/configure.zcml
U Zope/trunk/lib/python/Products/Five/form/tests/forms.txt
U Zope/trunk/lib/python/Products/Five/form/tests/schemacontent.py
U Zope/trunk/lib/python/Products/Five/form/tests/test_forms.py
U Zope/trunk/lib/python/Products/Five/i18n.py
U Zope/trunk/lib/python/Products/Five/interfaces.py
D Zope/trunk/lib/python/Products/Five/interfaces.zcml
U Zope/trunk/lib/python/Products/Five/meta.zcml
U Zope/trunk/lib/python/Products/Five/metaconfigure.py
U Zope/trunk/lib/python/Products/Five/permissions.zcml
U Zope/trunk/lib/python/Products/Five/security.py
D Zope/trunk/lib/python/Products/Five/services.zcml
A Zope/trunk/lib/python/Products/Five/site/
U Zope/trunk/lib/python/Products/Five/skin/standardmacros.py
U Zope/trunk/lib/python/Products/Five/skin/tests/test_standardmacros.py
D Zope/trunk/lib/python/Products/Five/testing/
U Zope/trunk/lib/python/Products/Five/tests/README.txt
U Zope/trunk/lib/python/Products/Five/tests/boilerplate.py
U Zope/trunk/lib/python/Products/Five/tests/directives.zcml
U Zope/trunk/lib/python/Products/Five/tests/event.txt
U Zope/trunk/lib/python/Products/Five/tests/test_directives.py
U Zope/trunk/lib/python/Products/Five/tests/test_event.py
U Zope/trunk/lib/python/Products/Five/tests/test_i18n.py
D Zope/trunk/lib/python/Products/Five/tests/test_import_conflicts.py
A Zope/trunk/lib/python/Products/Five/tests/test_registerclass.py
U Zope/trunk/lib/python/Products/Five/tests/test_security.py
U Zope/trunk/lib/python/Products/Five/tests/test_size.py
U Zope/trunk/lib/python/Products/Five/tests/test_viewable.py
A Zope/trunk/lib/python/Products/Five/tests/testing/
U Zope/trunk/lib/python/Products/Five/traversable.py
A Zope/trunk/lib/python/Products/Five/utilities/
U Zope/trunk/lib/python/Products/Five/version.txt
U Zope/trunk/lib/python/Products/Five/viewable.py
U Zope/trunk/lib/python/Products/PageTemplates/tests/testHTMLTests.py
U Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py
U Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
U Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
U Zope/trunk/lib/python/Record/_Record.c
U Zope/trunk/lib/python/TAL/DummyEngine.py
U Zope/trunk/lib/python/TAL/TALInterpreter.py
U Zope/trunk/lib/python/TAL/tests/test_talinterpreter.py
U Zope/trunk/lib/python/ZPublisher/BaseRequest.py
U Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
_U Zope/trunk/lib/python/zope/
A Zope/trunk/releases/
U Zope/trunk/setup.py
U Zope/trunk/test.py
U Zope/trunk/utilities/check_catalog.py
U Zope/trunk/utilities/compilezpy.py
U Zope/trunk/utilities/copyzopeskel.py
U Zope/trunk/utilities/decompilezpy.py
U Zope/trunk/utilities/load_site.py
U Zope/trunk/utilities/mkzeoinstance.py
U Zope/trunk/utilities/mkzopeinstance.py
U Zope/trunk/utilities/requestprofiler.py
U Zope/trunk/utilities/zpasswd.py
-=-
Deleted: Zope/trunk/PUBLICATION.cfg
===================================================================
--- Zope/trunk/PUBLICATION.cfg 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/PUBLICATION.cfg 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,20 +0,0 @@
-Metadata-Version: 1.1
-Name: Zope
-Summary: Zope 2 Application Server
-Home-page: http://dev.zope.org/
-Author: Zope Corporation and Contributors
-Author-email: zope-dev at zope.org
-License: ZPL 2.1
-Description:
- Zope is a web application server.
-Platform: Unix
-Platform: Windows
-Classifier: Environment :: Web Environment
-Classifier: License :: OSI Approved :: Zope Public License
-Classifier: Operating System :: Microsoft :: Windows
-Classifier: Operating System :: Unix
-Classifier: Programming Language :: C
-Classifier: Programming Language :: Python
-Classifier: Topic :: Internet :: WWW/HTTP
-Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
Copied: Zope/trunk/ZopePublicLicense.txt (from rev 39847, Zope/branches/philikon-zope32-integration/ZopePublicLicense.txt)
Copied: Zope/trunk/buildsupport (from rev 39847, Zope/branches/philikon-zope32-integration/buildsupport)
Property changes on: Zope/trunk/buildsupport
___________________________________________________________________
Name: svn:externals
+ zpkgsetup svn://svn.zope.org/repos/main/zpkgtools/trunk/zpkgsetup
Modified: Zope/trunk/configure
===================================================================
--- Zope/trunk/configure 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/configure 2005-11-02 18:34:38 UTC (rev 39848)
@@ -8,11 +8,11 @@
#####################################################################
# Place the Zope major version number below.
-ZOPE_VERS=2.8
+ZOPE_VERS=2.9
# Place the optimal target version number for Zope (as returned by sys.version)
# below
-TARGET="2.3.5"
+TARGET="2.4.1"
# Order a list of "acceptable" python version numbers (as returned by
# sys.version) below in "best" to "worst" order, not including the
@@ -22,7 +22,7 @@
# provide the executable names for all the acceptable versions
# (and the target version) below
-EXENAMES="python python2 python2.3"
+EXENAMES="python python2 python2.4"
#####################################################################
# END EDITABLE PARAMETERS #
@@ -38,8 +38,7 @@
{
echo
echo "configure [--help] [--quiet] [--with-python=path] [--prefix=path] "
- echo " [--build-base=path] [--ignore-largefile] [--ignore-zlib]"
- echo " [--optimize]"
+ echo " [--ignore-largefile] [--ignore-zlib] [--optimize]"
echo
echo " Creates a Makefile suitable for building and installing Zope"
echo
@@ -48,7 +47,6 @@
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"
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/doc/CHANGES.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -26,6 +26,11 @@
Features added
+ - Zope now sends Zope 3 events when objects are added or removed
+ from standard containers. manage_afterAdd, manage_beforeDelete
+ and manage_afterClone are now deprecated. See
+ lib/python/Products/Five/tests/event.txt for details.
+
- Zope now utilizes ZODB 3.6. It had previously used
ZODB 3.4. As a result, the DBTab package was removed, as
ZODB 3.6 has multidatabase support that makes DBTab
Modified: Zope/trunk/inst/Makefile.in
===================================================================
--- Zope/trunk/inst/Makefile.in 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/inst/Makefile.in 2005-11-02 18:34:38 UTC (rev 39848)
@@ -10,17 +10,14 @@
PACKAGE_NAME=${NAME}-${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}
PYTHON="<<PYTHON>>"
+ZPKG=zpkg
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"
+BUILD_FLAGS=-i
RM=rm -f
RMRF=rm -rf
@@ -32,7 +29,7 @@
TAR=tar
MKDIR=mkdir -p
-.PHONY : clean install instance untestinst testinst build unbuild
+.PHONY : clean install instance untestinst testinst build
.PHONY : default
# default: The default step (invoked when make is called without a target)
@@ -42,36 +39,22 @@
@echo to run a Zope instance directly from the build directory\).
@echo
-# build: Do whatever 'setup.py build' implies
+# build:
build:
${PYTHON} "${BASE_DIR}/setup.py" \
- ${DISTUTILS_OPTS} build ${BUILD_FLAGS}
+ ${DISTUTILS_OPTS} build_ext ${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}
+install: version_txt
+ ${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} \
+ build_ext ${BUILD_FLAGS} \
+ install --skip-build --home="${PREFIX}" ${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
@@ -101,7 +84,7 @@
# clean: Delete the build files and any binaries/bytecode files in
# the source directory for good measure.
-clean: unbuild
+clean:
${FIND} "${BASE_DIR}" \
-name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM}
@@ -110,24 +93,10 @@
printf "Zope ${MAJOR_VERSION}.${MINOR_VERSION}-${RELEASE_TAG}" >\
"${BASE_DIR}/lib/python/version.txt"
-# sdist: Create a source distribution file (implies clobber).
-#
-sdist: clobber sdist_tgz
+# Building a source distribution requires that zpkg be available:
+sdist:
+ ${ZPKG} -C ${BASE_DIR}/releases/Zope2.cfg
-# sdist_tgz: Create a tgz archive file as a source distribution.
-#
-sdist_tgz: version_txt
- ${MKDIR} ${TMPDIR}
- ${CD} ${TMPDIR} && ${LN} ${BASE_DIR} ${PACKAGE_NAME} && \
- ${TAR} czfh ${BASE_DIR}/${PACKAGE_NAME}.tgz \
- --exclude=${PACKAGE_NAME}.tgz\
- --exclude=.svn\
- --exclude=makefile \
- --exclude=build-base \
- --exclude=*~ \
- --exclude=.#* ${PACKAGE_NAME}
- ${RMRF} ${TMPDIR}/${PACKAGE_NAME}
-
# clobber: Make the source tree 'pristine' again.
clobber: clean uninstance
Modified: Zope/trunk/inst/configure.py
===================================================================
--- Zope/trunk/inst/configure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/inst/configure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,7 +33,6 @@
# 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
MAKEFILE=open(os.path.join(BASE_DIR, 'inst', IN_MAKEFILE)).read()
REQUIRE_LF_ENABLED = 1
@@ -66,8 +65,6 @@
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
@@ -85,7 +82,6 @@
'<<PYTHON>>':PYTHON,
'<<PREFIX>>':PREFIX,
'<<BASE_DIR>>':BASE_DIR,
- '<<BUILD_BASE>>':BUILD_BASE,
'<<INSTALL_FLAGS>>':INSTALL_FLAGS,
'<<ZOPE_MAJOR_VERSION>>':versions.ZOPE_MAJOR_VERSION,
'<<ZOPE_MINOR_VERSION>>':versions.ZOPE_MINOR_VERSION,
Property changes on: Zope/trunk/lib/python
___________________________________________________________________
Name: svn:externals
- ZConfig svn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3
BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/BTrees
persistent svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/persistent
ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ThreadedAsync
transaction svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/transaction
ZEO svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZEO
ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZODB
ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZopeUndo
zdaemon -r 39732 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
+ ZConfig svn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1
BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/BTrees
persistent svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/persistent
ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ThreadedAsync
transaction svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/transaction
ZEO svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZEO
ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZODB
ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b2/src/ZopeUndo
zdaemon -r 39732 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
pytz svn://svn.zope.org/repos/main/Zope3/trunk/src/pytz
zodbcode svn://svn.zope.org/repos/main/Zope3/trunk/src/zodbcode
Modified: Zope/trunk/lib/python/AccessControl/cAccessControl.c
===================================================================
--- Zope/trunk/lib/python/AccessControl/cAccessControl.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/AccessControl/cAccessControl.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -48,8 +48,8 @@
*/
-#include "ExtensionClass.h"
-#include "Acquisition.h"
+#include "ExtensionClass/ExtensionClass.h"
+#include "Acquisition/Acquisition.h"
#include <stdio.h>
#include <stdlib.h>
Modified: Zope/trunk/lib/python/Acquisition/_Acquisition.c
===================================================================
--- Zope/trunk/lib/python/Acquisition/_Acquisition.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Acquisition/_Acquisition.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -12,10 +12,10 @@
****************************************************************************/
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
#define _IN_ACQUISITION_C
-#include "Acquisition.h"
+#include "Acquisition/Acquisition.h"
static ACQUISITIONCAPI AcquisitionCAPI;
Modified: Zope/trunk/lib/python/ComputedAttribute/_ComputedAttribute.c
===================================================================
--- Zope/trunk/lib/python/ComputedAttribute/_ComputedAttribute.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/ComputedAttribute/_ComputedAttribute.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -11,7 +11,7 @@
FOR A PARTICULAR PURPOSE
****************************************************************************/
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
#define UNLESS(E) if(!(E))
#define OBJECT(O) ((PyObject*)(O))
Modified: Zope/trunk/lib/python/DocumentTemplate/cDocumentTemplate.c
===================================================================
--- Zope/trunk/lib/python/DocumentTemplate/cDocumentTemplate.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/DocumentTemplate/cDocumentTemplate.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -15,7 +15,7 @@
"\n$Id$"
;
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
static PyObject *py_isDocTemp=0, *py_blocks=0, *py_=0, *join=0, *py_acquire;
static PyObject *py___call__, *py___roles__, *py_AUTHENTICATED_USER;
Modified: Zope/trunk/lib/python/ExtensionClass/_ExtensionClass.c
===================================================================
--- Zope/trunk/lib/python/ExtensionClass/_ExtensionClass.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/ExtensionClass/_ExtensionClass.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,7 +17,7 @@
"$Id$\n"
;
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
#define EC PyTypeObject
Modified: Zope/trunk/lib/python/MethodObject/_MethodObject.c
===================================================================
--- Zope/trunk/lib/python/MethodObject/_MethodObject.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/MethodObject/_MethodObject.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -12,7 +12,7 @@
****************************************************************************/
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
static PyObject *
of(PyObject *self, PyObject *args)
Modified: Zope/trunk/lib/python/Missing/_Missing.c
===================================================================
--- Zope/trunk/lib/python/Missing/_Missing.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Missing/_Missing.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,7 +17,7 @@
"\n$Id$"
;
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
/* Declarations for objects of type Missing */
Modified: Zope/trunk/lib/python/MultiMapping/_MultiMapping.c
===================================================================
--- Zope/trunk/lib/python/MultiMapping/_MultiMapping.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/MultiMapping/_MultiMapping.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -12,7 +12,7 @@
****************************************************************************/
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
#define UNLESS(E) if(!(E))
Modified: Zope/trunk/lib/python/OFS/Application.py
===================================================================
--- Zope/trunk/lib/python/OFS/Application.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/Application.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -459,6 +459,10 @@
from Products.Sessions.BrowserIdManager import BrowserIdManager
bid = BrowserIdManager('browser_id_manager', 'Browser Id Manager')
app._setObject('browser_id_manager', bid)
+ # FIXME explicitely call manage_afterAdd, as sometimes
+ # events are initialized too late
+ browser_id_manager = app.browser_id_manager
+ browser_id_manager.manage_afterAdd(browser_id_manager, app)
app._setInitializerFlag('browser_id_manager')
self.commit('Added browser_id_manager')
@@ -475,6 +479,10 @@
path='/temp_folder/session_data',
requestName='SESSION')
app._setObject('session_data_manager', sdm)
+ # FIXME explicitely call manage_afterAdd, as sometimes
+ # events are initialized too late
+ session_data_manager = app.session_data_manager
+ session_data_manager.manage_afterAdd(session_data_manager, app)
app._setInitializerFlag('session_data_manager')
self.commit('Added session_data_manager')
@@ -523,6 +531,10 @@
from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog
error_log = SiteErrorLog()
app._setObject('error_log', error_log)
+ # FIXME explicitely call manage_afterAdd, as sometimes
+ # events are initialized too late
+ error_log = app.error_log
+ error_log.manage_afterAdd(error_log, app)
app._setInitializerFlag('error_log')
self.commit('Added site error_log at /error_log')
Modified: Zope/trunk/lib/python/OFS/CopySupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/CopySupport.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/CopySupport.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -30,6 +30,12 @@
from webdav.Lockable import ResourceLockedError
from zExceptions import Unauthorized, BadRequest
from zope.interface import implements
+from zope.event import notify
+from zope.app.event.objectevent import ObjectCopiedEvent
+from zope.app.container.contained import ObjectMovedEvent
+from OFS.event import ObjectWillBeMovedEvent
+from OFS.event import ObjectClonedEvent
+import OFS.subscribers
from OFS.interfaces import ICopyContainer
from OFS.interfaces import ICopySource
@@ -154,85 +160,120 @@
If calling manage_pasteObjects from python code, pass the result of a
previous call to manage_cutObjects or manage_copyObjects as the first
argument.
+
+ Also sends IObjectCopiedEvent and IObjectClonedEvent
+ or IObjectWillBeMovedEvent and IObjectMovedEvent.
"""
- cp=None
if cb_copy_data is not None:
- cp=cb_copy_data
+ cp = cb_copy_data
+ elif REQUEST is not None and REQUEST.has_key('__cp'):
+ cp = REQUEST['__cp']
else:
- if REQUEST and REQUEST.has_key('__cp'):
- cp=REQUEST['__cp']
+ cp = None
if cp is None:
raise CopyError, eNoData
- try: cp=_cb_decode(cp)
- except: raise CopyError, eInvalid
+ try:
+ op, mdatas = _cb_decode(cp)
+ except:
+ raise CopyError, eInvalid
- oblist=[]
- op=cp[0]
+ oblist = []
app = self.getPhysicalRoot()
- result = []
-
- for mdata in cp[1]:
+ for mdata in mdatas:
m = Moniker.loadMoniker(mdata)
- try: ob = m.bind(app)
- except: raise CopyError, eNotFound
+ try:
+ ob = m.bind(app)
+ except ConflictError:
+ raise
+ except:
+ raise CopyError, eNotFound
self._verifyObjectPaste(ob, validate_src=op+1)
oblist.append(ob)
- if op==0:
+ result = []
+ if op == 0:
# Copy operation
for ob in oblist:
+ orig_id = ob.getId()
if not ob.cb_isCopyable():
- raise CopyError, eNotSupported % escape(ob.getId())
- try: ob._notifyOfCopyTo(self, op=0)
- except: raise CopyError, MessageDialog(
- title='Copy Error',
- message=sys.exc_info()[1],
- action ='manage_main')
- ob=ob._getCopy(self)
- orig_id=ob.getId()
- id=self._get_id(ob.getId())
- result.append({'id':orig_id, 'new_id':id})
+ raise CopyError, eNotSupported % escape(orig_id)
+
+ try:
+ ob._notifyOfCopyTo(self, op=0)
+ except ConflictError:
+ raise
+ except:
+ raise CopyError, MessageDialog(
+ title="Copy Error",
+ message=sys.exc_info()[1],
+ action='manage_main')
+
+ id = self._get_id(orig_id)
+ result.append({'id': orig_id, 'new_id': id})
+
+ ob = ob._getCopy(self)
ob._setId(id)
+ notify(ObjectCopiedEvent(ob))
+
self._setObject(id, ob)
ob = self._getOb(id)
- ob._postCopy(self, op=0)
- ob.manage_afterClone(ob)
ob.wl_clearLocks()
+ ob._postCopy(self, op=0)
+
+ OFS.subscribers.maybeCallDeprecated('manage_afterClone', ob)
+
+ notify(ObjectClonedEvent(ob))
+
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1,
cb_dataValid=1)
- if op==1:
+ elif op == 1:
# Move operation
for ob in oblist:
- id=ob.getId()
+ orig_id = ob.getId()
if not ob.cb_isMoveable():
- raise CopyError, eNotSupported % escape(id)
- try: ob._notifyOfCopyTo(self, op=1)
- except: raise CopyError, MessageDialog(
- title='Move Error',
- message=sys.exc_info()[1],
- action ='manage_main')
+ raise CopyError, eNotSupported % escape(orig_id)
+
+ try:
+ ob._notifyOfCopyTo(self, op=1)
+ except ConflictError:
+ raise
+ except:
+ raise CopyError, MessageDialog(
+ title="Move Error",
+ message=sys.exc_info()[1],
+ 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):
+ id = orig_id
+ else:
+ id = self._get_id(orig_id)
+ result.append({'id': orig_id, 'new_id': id})
+
+ notify(ObjectWillBeMovedEvent(ob, orig_container, orig_id,
+ self, id))
+
# try to make ownership explicit so that it gets carried
# along to the new location if needed.
ob.manage_changeOwnershipType(explicit=1)
- aq_parent(aq_inner(ob))._delObject(id)
+ orig_container._delObject(orig_id, suppress_events=True)
ob = aq_base(ob)
- orig_id=id
- id=self._get_id(id)
- result.append({'id':orig_id, 'new_id':id })
+ ob._setId(id)
- ob._setId(id)
- self._setObject(id, ob, set_owner=0)
- ob=self._getOb(id)
+ self._setObject(id, ob, set_owner=0, suppress_events=True)
+ ob = self._getOb(id)
+
+ notify(ObjectMovedEvent(ob, orig_container, orig_id, self, id))
+
ob._postCopy(self, op=1)
-
# try to make ownership implicit if possible
ob.manage_changeOwnershipType(explicit=0)
@@ -243,6 +284,7 @@
REQUEST['__cp'] = None
return self.manage_main(self, REQUEST, update_menu=1,
cb_dataValid=0)
+
return result
manage_renameForm=Globals.DTMLFile('dtml/renameForm', globals())
@@ -259,31 +301,48 @@
return None
def manage_renameObject(self, id, new_id, REQUEST=None):
- """Rename a particular sub-object"""
- try: self._checkId(new_id)
- except: raise CopyError, MessageDialog(
- title='Invalid Id',
- message=sys.exc_info()[1],
- action ='manage_main')
- ob=self._getOb(id)
+ """Rename a particular sub-object.
+ """
+ try:
+ self._checkId(new_id)
+ except:
+ raise CopyError, MessageDialog(
+ title='Invalid Id',
+ message=sys.exc_info()[1],
+ action ='manage_main')
+
+ 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)
self._verifyObjectPaste(ob)
- try: ob._notifyOfCopyTo(self, op=1)
- except: raise CopyError, MessageDialog(
- title='Rename Error',
- message=sys.exc_info()[1],
- action ='manage_main')
- self._delObject(id)
+
+ try:
+ ob._notifyOfCopyTo(self, op=1)
+ except ConflictError:
+ raise
+ except:
+ raise CopyError, MessageDialog(
+ title="Rename Error",
+ message=sys.exc_info()[1],
+ action ='manage_main')
+
+ notify(ObjectWillBeMovedEvent(ob, self, id, self, new_id))
+
+ self._delObject(id, suppress_events=True)
ob = aq_base(ob)
ob._setId(new_id)
# Note - because a rename always keeps the same context, we
# can just leave the ownership info unchanged.
- self._setObject(new_id, ob, set_owner=0)
+ self._setObject(new_id, ob, set_owner=0, suppress_events=True)
ob = self._getOb(new_id)
+
+ notify(ObjectMovedEvent(ob, self, id, self, new_id))
+
ob._postCopy(self, op=1)
if REQUEST is not None:
@@ -296,26 +355,43 @@
# Because it's still a "management" function.
manage_clone__roles__=None
def manage_clone(self, ob, id, REQUEST=None):
- # Clone an object, creating a new object with the given id.
+ """Clone an object, creating a new object with the given id.
+ """
if not ob.cb_isCopyable():
raise CopyError, eNotSupported % escape(ob.getId())
- try: self._checkId(id)
- except: raise CopyError, MessageDialog(
- title='Invalid Id',
- message=sys.exc_info()[1],
- action ='manage_main')
+ try:
+ self._checkId(id)
+ except:
+ raise CopyError, MessageDialog(
+ title='Invalid Id',
+ message=sys.exc_info()[1],
+ action ='manage_main')
+
self._verifyObjectPaste(ob)
- try: ob._notifyOfCopyTo(self, op=0)
- except: raise CopyError, MessageDialog(
- title='Clone Error',
- message=sys.exc_info()[1],
- action ='manage_main')
- ob=ob._getCopy(self)
+
+ try:
+ ob._notifyOfCopyTo(self, op=0)
+ except ConflictError:
+ raise
+ except:
+ raise CopyError, MessageDialog(
+ title="Clone Error",
+ message=sys.exc_info()[1],
+ action='manage_main')
+
+ ob = ob._getCopy(self)
ob._setId(id)
+ notify(ObjectCopiedEvent(ob))
+
self._setObject(id, ob)
- ob=self._getOb(id)
+ ob = self._getOb(id)
+
ob._postCopy(self, op=0)
- ob.manage_afterClone(ob)
+
+ OFS.subscribers.maybeCallDeprecated('manage_afterClone', ob)
+
+ notify(ObjectClonedEvent(ob))
+
return ob
def cb_dataValid(self):
Modified: Zope/trunk/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/ObjectManager.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/ObjectManager.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -15,6 +15,7 @@
$Id$
"""
+import warnings
import marshal
import sys, fnmatch, copy, os, re
from cgi import escape
@@ -42,6 +43,12 @@
import CopySupport
from interfaces import IObjectManager
from Traversable import Traversable
+from zope.event import notify
+from zope.app.container.contained import ObjectAddedEvent
+from zope.app.container.contained import ObjectRemovedEvent
+from OFS.event import ObjectWillBeAddedEvent
+from OFS.event import ObjectWillBeRemovedEvent
+import OFS.subscribers
# the name BadRequestException is relied upon by 3rd-party code
@@ -266,90 +273,93 @@
raise AttributeError, id
return default
- def _setObject(self, id, object, roles=None, user=None, set_owner=1):
- v=self._checkId(id)
- if v is not None: id=v
- try: t=object.meta_type
- except: t=None
+ def _setObject(self, id, object, roles=None, user=None, set_owner=1,
+ suppress_events=False):
+ """Set an object into this container.
+ Also sends IObjectWillBeAddedEvent and IObjectAddedEvent.
+ """
+ ob = object # better name, keep original function signature
+ v = self._checkId(id)
+ if v is not None:
+ id = v
+ t = getattr(ob, 'meta_type', None)
+
# If an object by the given id already exists, remove it.
for object_info in self._objects:
if object_info['id'] == id:
self._delObject(id)
break
- self._objects=self._objects+({'id':id,'meta_type':t},)
- self._setOb(id,object)
- object=self._getOb(id)
+ if not suppress_events:
+ notify(ObjectWillBeAddedEvent(ob, self, id))
+ self._objects = self._objects + ({'id': id, 'meta_type': t},)
+ self._setOb(id, ob)
+ ob = self._getOb(id)
+
if set_owner:
- object.manage_fixupOwnershipAfterAdd()
+ # TODO: eventify manage_fixupOwnershipAfterAdd
+ # This will be called for a copy/clone, or a normal _setObject.
+ ob.manage_fixupOwnershipAfterAdd()
# Try to give user the local role "Owner", but only if
# no local roles have been set on the object yet.
- if hasattr(object, '__ac_local_roles__'):
- if object.__ac_local_roles__ is None:
- user=getSecurityManager().getUser()
- if user is not None:
- userid=user.getId()
- if userid is not None:
- object.manage_setLocalRoles(userid, ['Owner'])
+ if getattr(ob, '__ac_local_roles__', _marker) is None:
+ user = getSecurityManager().getUser()
+ if user is not None:
+ userid = user.getId()
+ if userid is not None:
+ ob.manage_setLocalRoles(userid, ['Owner'])
- object.manage_afterAdd(object, self)
+ if not suppress_events:
+ notify(ObjectAddedEvent(ob, self, id))
+
+ OFS.subscribers.maybeCallDeprecated('manage_afterAdd', ob, self)
+
return id
def manage_afterAdd(self, item, container):
- for object in self.objectValues():
- try: s=object._p_changed
- except: s=0
- if hasattr(aq_base(object), 'manage_afterAdd'):
- object.manage_afterAdd(item, container)
- if s is None: object._p_deactivate()
+ # Don't do recursion anymore, a subscriber does that.
+ warnings.warn(
+ "%s.manage_afterAdd is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectAddedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_afterAdd.__five_method__ = True
def manage_afterClone(self, item):
- for object in self.objectValues():
- try: s=object._p_changed
- except: s=0
- if hasattr(aq_base(object), 'manage_afterClone'):
- object.manage_afterClone(item)
- if s is None: object._p_deactivate()
+ # Don't do recursion anymore, a subscriber does that.
+ warnings.warn(
+ "%s.manage_afterClone is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectClonedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_afterClone.__five_method__ = True
def manage_beforeDelete(self, item, container):
- for object in self.objectValues():
- try: s=object._p_changed
- except: s=0
- try:
- if hasattr(aq_base(object), 'manage_beforeDelete'):
- object.manage_beforeDelete(item, container)
- except BeforeDeleteException, ob:
- raise
- except ConflictError:
- raise
- except:
- LOG('Zope',ERROR,'manage_beforeDelete() threw',
- error=sys.exc_info())
- # In debug mode when non-Manager, let exceptions propagate.
- if getConfiguration().debug_mode:
- if not getSecurityManager().getUser().has_role('Manager'):
- raise
- if s is None: object._p_deactivate()
+ # Don't do recursion anymore, a subscriber does that.
+ warnings.warn(
+ "%s.manage_beforeDelete is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectWillBeRemovedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_beforeDelete.__five_method__ = True
- def _delObject(self, id, dp=1):
- object=self._getOb(id)
- try:
- object.manage_beforeDelete(object, self)
- except BeforeDeleteException, ob:
- raise
- except ConflictError:
- raise
- except:
- LOG('Zope', ERROR, '_delObject() threw',
- error=sys.exc_info())
- # In debug mode when non-Manager, let exceptions propagate.
- if getConfiguration().debug_mode:
- if not getSecurityManager().getUser().has_role('Manager'):
- raise
- self._objects=tuple(filter(lambda i,n=id: i['id']!=n, self._objects))
+ def _delObject(self, id, dp=1, suppress_events=False):
+ """Delete an object from this container.
+
+ Also sends IObjectWillBeRemovedEvent and IObjectRemovedEvent.
+ """
+ ob = self._getOb(id)
+
+ OFS.subscribers.maybeCallDeprecated('manage_beforeDelete', ob, self)
+
+ if not suppress_events:
+ notify(ObjectWillBeRemovedEvent(ob, self, id))
+
+ self._objects = tuple([i for i in self._objects
+ if i['id'] != id])
self._delOb(id)
# Indicate to the object that it has been deleted. This is
@@ -357,9 +367,14 @@
# tolerate failure here because the object being deleted could
# be a Broken object, and it is not possible to set attributes
# on Broken objects.
- try: object._v__object_deleted__ = 1
- except: pass
+ try:
+ ob._v__object_deleted__ = 1
+ except:
+ pass
+ if not suppress_events:
+ notify(ObjectRemovedEvent(ob, self, id))
+
def objectIds(self, spec=None):
# Returns a list of subobject ids of the current object.
# If 'spec' is specified, returns objects whose meta_type
Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderSupport.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -30,7 +30,7 @@
from ObjectManager import ObjectManager
-class OrderSupport:
+class OrderSupport(object):
""" Ordered container mixin class.
@@ -251,13 +251,12 @@
# Override Inherited Method of ObjectManager Subclass
#
- _old_manage_renameObject = ObjectManager.inheritedAttribute(
- 'manage_renameObject')
def manage_renameObject(self, id, new_id, REQUEST=None):
""" Rename a particular sub-object without changing its position.
"""
old_position = self.getObjectPosition(id)
- result = self._old_manage_renameObject(id, new_id, REQUEST)
+ result = super(OrderSupport, self).manage_renameObject(id, new_id,
+ REQUEST)
self.moveObjectToPosition(new_id, old_position)
return result
Modified: Zope/trunk/lib/python/OFS/SimpleItem.py
===================================================================
--- Zope/trunk/lib/python/OFS/SimpleItem.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/SimpleItem.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -20,6 +20,7 @@
$Id$
"""
+import warnings
import marshal, re, sys, time
import AccessControl.Role, AccessControl.Owned, App.Common
@@ -60,13 +61,28 @@
isTopLevelPrincipiaApplicationObject=0
def manage_afterAdd(self, item, container):
- pass
+ warnings.warn(
+ "%s.manage_afterAdd is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectAddedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_afterAdd.__five_method__ = True
def manage_beforeDelete(self, item, container):
- pass
+ warnings.warn(
+ "%s.manage_beforeDelete is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectWillBeRemovedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_beforeDelete.__five_method__ = True
def manage_afterClone(self, item):
- pass
+ warnings.warn(
+ "%s.manage_afterClone is deprecated and will be removed in "
+ "Zope 2.11, you should use an IObjectClonedEvent "
+ "subscriber instead." % self.__class__.__name__,
+ DeprecationWarning, stacklevel=2)
+ manage_afterClone.__five_method__ = True
# Direct use of the 'id' attribute is deprecated - use getId()
id=''
Copied: Zope/trunk/lib/python/OFS/event.py (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/OFS/event.py)
Modified: Zope/trunk/lib/python/OFS/interfaces.py
===================================================================
--- Zope/trunk/lib/python/OFS/interfaces.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/interfaces.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -894,3 +894,33 @@
"""Check the global (zclass) registry for problems, which can
be caused by things like disk-based products being deleted.
Return true if a problem is found"""
+
+
+##################################################
+# Event interfaces
+
+from zope.app.event.interfaces import IObjectEvent
+
+class IObjectWillBeMovedEvent(IObjectEvent):
+ """An object will be moved."""
+ oldParent = Attribute("The old location parent for the object.")
+ oldName = Attribute("The old location name for the object.")
+ newParent = Attribute("The new location parent for the object.")
+ newName = Attribute("The new location name for the object.")
+
+class IObjectWillBeAddedEvent(IObjectWillBeMovedEvent):
+ """An object will be added to a container."""
+
+class IObjectWillBeRemovedEvent(IObjectWillBeMovedEvent):
+ """An object will be removed from a container"""
+
+class IObjectClonedEvent(IObjectEvent):
+ """An object has been cloned (a la Zope 2).
+
+ This is for Zope 2 compatibility, subscribers should really use
+ IObjectCopiedEvent or IObjectAddedEvent, depending on their use
+ cases.
+
+ event.object is the copied object, already added to its container.
+ Note that this event is dispatched to all sublocations.
+ """
Copied: Zope/trunk/lib/python/OFS/subscribers.py (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/OFS/subscribers.py)
Modified: Zope/trunk/lib/python/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testObjectManager.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/tests/testObjectManager.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -3,12 +3,16 @@
from AccessControl.Owned import EmergencyUserCannotOwn
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
+from AccessControl.User import User # before SpecialUsers
from AccessControl.SpecialUsers import emergency_user, nobody, system
-from AccessControl.User import User
from Acquisition import Implicit
from App.config import getConfiguration
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
+from zope.app.testing.placelesssetup import PlacelessSetup
+import Products.Five
+from Products.Five import zcml
+from Products.Five.eventconfigure import setDeprecatedManageAddDelete
class FauxRoot( Implicit ):
@@ -46,27 +50,40 @@
self.before_delete_called = True
if self.fail_on_delete:
raise DeleteFailed
- return SimpleItem.manage_beforeDelete(self, item, container)
+ def manage_afterAdd(self, item, container):
+ pass
-class ObjectManagerTests( unittest.TestCase ):
+ def manage_afterClone(self, item):
+ pass
+from zope.interface import implements
+from OFS.interfaces import IItem
+class ObjectManagerWithIItem(ObjectManager):
+ """The event subscribers work on IItem."""
+ implements(IItem)
+
+class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
+
def setUp(self):
+ super(ObjectManagerTests, self).setUp()
self.saved_cfg_debug_mode = getConfiguration().debug_mode
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('event.zcml', Products.Five)
+ zcml.load_config('deprecated.zcml', Products.Five)
+ setDeprecatedManageAddDelete(ItemForDeletion)
def tearDown( self ):
noSecurityManager()
getConfiguration().debug_mode = self.saved_cfg_debug_mode
+ super(ObjectManagerTests, self).tearDown()
def setDebugMode(self, mode):
getConfiguration().debug_mode = mode
def _getTargetClass( self ):
+ return ObjectManagerWithIItem
- from OFS.ObjectManager import ObjectManager
-
- return ObjectManager
-
def _makeOne( self, *args, **kw ):
return self._getTargetClass()( *args, **kw ).__of__( FauxRoot() )
Modified: Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testOrderSupport.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/OFS/tests/testOrderSupport.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -14,6 +14,8 @@
return
def manage_beforeDelete(self, item, container):
return
+ manage_afterAdd.__five_method__ = True
+ manage_beforeDelete.__five_method__ = True
def wl_isLocked(self):
return 0
Modified: Zope/trunk/lib/python/Persistence/_Persistence.c
===================================================================
--- Zope/trunk/lib/python/Persistence/_Persistence.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Persistence/_Persistence.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,8 +17,8 @@
"$Id$\n"
;
-#include "ExtensionClass.h"
-#include "cPersistence.h"
+#include "ExtensionClass/ExtensionClass.h"
+#include "persistent/cPersistence.h"
/* convert_name() returns a new reference to a string name
Modified: Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -37,6 +37,12 @@
view_management_screens
from zLOG import LOG, INFO, ERROR, WARNING
from Products.ZCatalog.Lazy import LazyMap
+from zope.event import notify
+from zope.app.container.contained import ObjectAddedEvent
+from zope.app.container.contained import ObjectRemovedEvent
+from OFS.event import ObjectWillBeAddedEvent
+from OFS.event import ObjectWillBeRemovedEvent
+import OFS.subscribers
manage_addBTreeFolderForm = DTMLFile('folderAdd', globals())
@@ -404,48 +410,59 @@
'it is already in use.' % id)
- def _setObject(self, id, object, roles=None, user=None, set_owner=1):
- v=self._checkId(id)
- if v is not None: id=v
+ def _setObject(self, id, object, roles=None, user=None, set_owner=1,
+ suppress_events=False):
+ ob = object # better name, keep original function signature
+ v = self._checkId(id)
+ if v is not None:
+ id = v
# If an object by the given id already exists, remove it.
if self.has_key(id):
self._delObject(id)
- self._setOb(id, object)
- object = self._getOb(id)
+ if not suppress_events:
+ notify(ObjectWillBeAddedEvent(ob, self, id))
+ self._setOb(id, ob)
+ ob = self._getOb(id)
+
if set_owner:
- object.manage_fixupOwnershipAfterAdd()
+ # TODO: eventify manage_fixupOwnershipAfterAdd
+ # This will be called for a copy/clone, or a normal _setObject.
+ ob.manage_fixupOwnershipAfterAdd()
# Try to give user the local role "Owner", but only if
# no local roles have been set on the object yet.
- if hasattr(object, '__ac_local_roles__'):
- if object.__ac_local_roles__ is None:
- user=getSecurityManager().getUser()
- if user is not None:
- userid=user.getId()
- if userid is not None:
- object.manage_setLocalRoles(userid, ['Owner'])
+ if getattr(ob, '__ac_local_roles__', _marker) is None:
+ user = getSecurityManager().getUser()
+ if user is not None:
+ userid = user.getId()
+ if userid is not None:
+ ob.manage_setLocalRoles(userid, ['Owner'])
- object.manage_afterAdd(object, self)
+ if not suppress_events:
+ notify(ObjectAddedEvent(ob, self, id))
+
+ OFS.subscribers.maybeCallDeprecated('manage_afterAdd', ob, self)
+
return id
- def _delObject(self, id, dp=1):
- object = self._getOb(id)
- try:
- object.manage_beforeDelete(object, self)
- except BeforeDeleteException, ob:
- raise
- except ConflictError:
- raise
- except:
- LOG('Zope', ERROR, 'manage_beforeDelete() threw',
- error=sys.exc_info())
+ def _delObject(self, id, dp=1, suppress_events=False):
+ ob = self._getOb(id)
+
+ OFS.subscribers.maybeCallDeprecated('manage_beforeDelete', ob, self)
+
+ if not suppress_events:
+ notify(ObjectWillBeRemovedEvent(ob, self, id))
+
self._delOb(id)
+ if not suppress_events:
+ notify(ObjectRemovedEvent(ob, self, id))
+
# Aliases for mapping-like access.
__len__ = objectCount
keys = objectIds
Modified: Zope/trunk/lib/python/Products/Five/CHANGES.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/CHANGES.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/CHANGES.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -2,6 +2,95 @@
Five Changes
============
+Five 1.3b (2005-11-02)
+======================
+
+This version is also included in Zope 2.9b1.
+
+Restructuring
+-------------
+
+* Support for Zope 3.2 was added. Five now requires Zope 2.9 (which
+ ships with Zope 3.2).
+
+* As scheduled, the temporary fork of the new test runner
+ (``zope.testing``) at ``Five.testing`` was removed. So was the
+ ``runtests.py`` script. Use the regular Zope test runner
+ (``test.py`` or ``bin/zopectl test``) to run tests.
+
+* To reflect the Component Architecture simplification in Zope 3 since
+ the X3 3.0 release, ``IFiveUtilityService`` was renamed to
+ ``IFiveUtilityRegistry`` and ``SimpleLocalUtilityService`` was
+ renamed to ``SimpleLocalUtilityRegistry``. The old names are still
+ available for a short period of time.
+
+* Event support: ``<five:containerEvents/>`` is the default.
+
+* Due to an incompatability with Zope 3.2's ObjectWidget and Zope 2's
+ Page Templates, Five now ships with its own ObjectWidget
+ implementation (which is just a thin wrapper around Zope's one to
+ make it work in Zope 2). If you use the ObjectWidget, please change
+ your imports to ``Products.Five.form.objectwidget.ObjectWidget``.
+
+* Backwards compatability for Zope 3-style interfaces of Zope 2
+ components has been removed as that functionality is now in the Zope
+ 2 core as of Zope 2.9.
+
+Five 1.2b (2005-11-02)
+======================
+
+Features
+--------
+
+* Added IMarkerInterfaces adapter: This adapter provides methods for
+ inspecting and assigning marker interfaces. 'edit-markers.html' (or
+ 'manage_interfaces' in the ZMI) allows to change the behavior of specific
+ objects by adding or removing marker interfaces TTW.
+
+* Added the five:registerClass directive: This does the necessary Zope 2
+ registration for Five-based content. It is no longer necessary to add an
+ ``initialize()`` function to the product's __init__ in order to register
+ a meta type to be addable through the ZMI. See doc/products/ViewsTutorial
+ for an example how to use the directive.
+
+* Local site support: Five has now support for creating local sites
+ and thereby local utilities. This is mostly needed for allowing CMF
+ to convert it's portal tools into local utilities. See
+ doc/localsite.txt for more information
+
+* Event support: When ``<five:containerEvents/>`` is specified, Five
+ makes the standard Zope 2 containers send events instead of using
+ manage_afterAdd, manage_beforeDelete and manage_afterClone. These
+ methods are still called for a class declared
+ ``<five:deprecatedManageAddDelete class=.../>``, and are called in
+ compatibility mode with a deprecation warning for classes that don't
+ use this directive.
+
+Restructuring
+-------------
+
+* Removed backwards compatibility for Five 1.0 Zope core interfaces.
+
+* Removed backwards compatibility for Zope 2.7 and 2.8.0.
+
+* Added a (temporarily) forked copy of the "new-and-improved" test
+ runner and supporting 'zope.testing' package, lifted from
+ http://svn.zope.org/zope.testing. This code should be removed for
+ Five 1.3, which will use the updated version of 'zope.testing' in
+ the Zope 2.9 / Zope 3.2 tree.
+
+ There is a test runner invoking script in the ``Five`` package. For
+ example, to run the Five tests with the new test runner, simply
+ execute the following command line from your instance home::
+
+ $ bin/zopectl run Products/Five/runtests.py -v -s Products.Five
+
+* Moved the 'Five.testing' package down to 'Five.tests.testing', in
+ order to make room for the 'zope.testing' code.
+
+* Removed backwards compatibility for some moved classes (AddForm,
+ EditForm, ContentAdding)
+
Five 1.1 (2005-10-04)
=====================
@@ -100,7 +189,7 @@
* The former test product, ``FiveTest``, was converted into separate
modules that provide the mock objects for the corresponding tests
and are located right next to them. Common test helpers have been
- moved to the Five.testing package. Overall, the testing framework
+ moved to the Five.tests.testing package. Overall, the testing framework
was much simplified and the individual tests clean up after
themselves much like they do in Zope 3.
Modified: Zope/trunk/lib/python/Products/Five/CREDITS.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/CREDITS.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/CREDITS.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -9,7 +9,7 @@
- Lennart Regebro (regebro at nuxeo.com)
-- Tres Seaver (tres at zope.com)
+- Tres Seaver (tseaver at palladion.com)
- Jan-Wijbrand Kolman (jw at infrae.com)
@@ -33,6 +33,9 @@
- Tarek Ziadé (tziade at nuxeo.com)
+- Whit Morriss (whit at longnow.org)
+
+
Thank you
---------
Deleted: Zope/trunk/lib/python/Products/Five/adding.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/adding.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/adding.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,26 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" Z2 -> Z3 bridge utilities.
-
-$Id: adding.py 15515 2005-08-02 17:42:08Z yuppie $
-"""
-
-# BBB: This file will be removed in future versions of Five.
-from browser.adding import ContentAdding
-
-import warnings
-warnings.warn("\nThe Products.Five.adding module has been renamed to "
- "Products.Five.browser.adding \n"
- "and will be disabled starting in Five 1.2.\n",
- DeprecationWarning, stacklevel=2)
Modified: Zope/trunk/lib/python/Products/Five/browser/TrustedExpression.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/TrustedExpression.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/TrustedExpression.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -70,7 +70,7 @@
o = get(object, name, M)
if o is M:
try: o = object[name]
- except AttributeError: # better exception
+ except (AttributeError, TypeError): # better exception
raise AttributeError(name)
object = o
Modified: Zope/trunk/lib/python/Products/Five/browser/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/__init__.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/__init__.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,20 +13,13 @@
##############################################################################
"""Provide basic browser functionality
-$Id: __init__.py 18841 2005-10-23 09:57:38Z philikon $
+$Id: __init__.py 19283 2005-10-31 17:43:51Z philikon $
"""
import Acquisition
-from AccessControl import ClassSecurityInfo
-from Globals import InitializeClass
+import zope.app.publisher.browser
-class BrowserView(Acquisition.Explicit):
- security = ClassSecurityInfo()
+class BrowserView(Acquisition.Explicit, zope.app.publisher.browser.BrowserView):
+ """Five browser view
- def __init__(self, context, request):
- self.context = context
- self.request = request
-
- # XXX do not create any methods on the subclass called index_html,
- # as this makes Zope 2 traverse into that first!
-
-InitializeClass(BrowserView)
+ Mixes in explicit acquisition so that security can be acquired for
+ views"""
Modified: Zope/trunk/lib/python/Products/Five/browser/absoluteurl.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/absoluteurl.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/absoluteurl.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -52,7 +52,7 @@
return (
{'name': name, 'url': context.absolute_url()},)
- view = zapi.getViewProviding(container, IAbsoluteURL, request)
+ view = zapi.getMultiAdapter((container, request), IAbsoluteURL)
base = tuple(view.breadcrumbs())
base += (
{'name': name, 'url': ("%s/%s" % (base[-1]['url'], name))},)
Modified: Zope/trunk/lib/python/Products/Five/browser/adding.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/adding.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/adding.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -28,6 +28,8 @@
from zope.app.container.interfaces import IContainerNamesContainer
from zope.app.container.constraints import checkFactory, checkObject
+from zope.app.publisher.browser.menu import getMenu
+
from zope.app import zapi
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.event import notify
@@ -84,8 +86,8 @@
# XXX this is definitely not right for all or even most uses
# of Five, but can be overridden by an AddView subclass, using
# the class attribute of a zcml:addform directive
- return (str(zapi.getView(self.context, "absolute_url", self.request))
- + '/manage_main')
+ return str(zapi.getMultiAdapter((self.context, self.request),
+ name=u"absolute_url")) + '/manage_main'
# set in BrowserView.__init__
request = None
@@ -104,7 +106,7 @@
if view_name.startswith('@@'):
view_name = view_name[2:]
- return zapi.getView(self, view_name, request)
+ return zapi.getMultiAdapter((self, request), name=view_name)
if name.startswith('@@'):
view_name = name[2:]
@@ -135,7 +137,7 @@
if zapi.queryView(self, view_name, self.request) is not None:
url = "%s/%s=%s" % (
- zapi.getView(self, "absolute_url", self.request),
+ zapi.getMultiAdapter((self, self.request), name=u"absolute_url"),
type_name, id)
self.request.response.redirect(url)
return
@@ -169,12 +171,11 @@
This is sorted by title.
"""
container = self.context
- menu_service = zapi.getService("BrowserMenu")
result = []
for menu_id in (self.menu_id, 'zope.app.container.add'):
if not menu_id:
continue
- for item in menu_service.getMenu(menu_id, self, self.request):
+ for item in getMenu(menu_id, self, self.request):
extra = item.get('extra')
if extra:
factory = extra.get('factory')
Modified: Zope/trunk/lib/python/Products/Five/browser/configure.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/configure.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/configure.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,17 +1,6 @@
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
- <serviceType
- id="BrowserMenu"
- interface="zope.app.publisher.interfaces.browser.IBrowserMenuService"
- />
-
- <service
- serviceType="BrowserMenu"
- permission="zope.Public"
- component="zope.app.publisher.browser.globalbrowsermenuservice.globalBrowserMenuService"
- />
-
<browser:defaultView name="index.html" />
<browser:page
Modified: Zope/trunk/lib/python/Products/Five/browser/menu.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/menu.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/menu.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,17 +13,15 @@
##############################################################################
"""Some menu code
-$Id: menu.py 14512 2005-07-11 18:40:51Z philikon $
+$Id: menu.py 19283 2005-10-31 17:43:51Z philikon $
"""
from zope.interface import implements
-from zope.app import zapi
from zope.app.publisher.interfaces.browser import IMenuAccessView
-from zope.app.servicenames import BrowserMenu
+from zope.app.publisher.browser.menu import getMenu
from Products.Five import BrowserView
class MenuAccessView(BrowserView):
implements(IMenuAccessView)
def __getitem__(self, menu_id):
- browser_menu_service = zapi.getService(BrowserMenu)
- return browser_menu_service.getMenu(menu_id, self.context, self.request)
+ return getMenu(menu_id, self.context, self.request)
Modified: Zope/trunk/lib/python/Products/Five/browser/meta.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/meta.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/meta.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -25,7 +25,7 @@
<meta:directive
name="defaultView"
schema="zope.app.publisher.browser.metadirectives.IDefaultViewDirective"
- handler=".metaconfigure.defaultView"
+ handler="zope.app.publisher.browser.metaconfigure.defaultView"
/>
<meta:directive
@@ -62,19 +62,19 @@
<meta:directive
name="menu"
schema="zope.app.publisher.browser.metadirectives.IMenuDirective"
- handler="zope.app.publisher.browser.globalbrowsermenuservice.menuDirective"
+ handler="zope.app.publisher.browser.menumeta.menuDirective"
/>
<meta:directive
name="menuItem"
schema="zope.app.publisher.browser.metadirectives.IMenuItemDirective"
- handler="zope.app.publisher.browser.globalbrowsermenuservice.menuItemDirective"
+ handler="zope.app.publisher.browser.menumeta.menuItemDirective"
/>
<meta:complexDirective
name="menuItems"
schema="zope.app.publisher.browser.metadirectives.IMenuItemsDirective"
- handler="zope.app.publisher.browser.globalbrowsermenuservice.menuItemsDirective"
+ handler="zope.app.publisher.browser.menumeta.menuItemsDirective"
>
<meta:subdirective
Modified: Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/metaconfigure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -21,18 +21,16 @@
import os
from zope.interface import Interface
-from zope.component import getGlobalService, ComponentLookupError
from zope.configuration.exceptions import ConfigurationError
-from zope.component.servicenames import Presentation
-from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.publisher.interfaces.browser import IBrowserRequest, \
+ IDefaultBrowserLayer
+
from zope.app.publisher.browser.viewmeta import pages as zope_app_pages
from zope.app.publisher.browser.viewmeta import view as zope_app_view
-from zope.app.publisher.browser.viewmeta import providesCallable
-from zope.app.publisher.browser.globalbrowsermenuservice import\
- menuItemDirective
+from zope.app.publisher.browser.viewmeta import providesCallable, \
+ _handle_menu, _handle_for
from zope.app.component.metaconfigure import handler
from zope.app.component.interface import provideInterface
-from zope.app.container.interfaces import IAdding
from Products.Five.browser import BrowserView
from Products.Five.browser.resource import FileResourceFactory, ImageResourceFactory
@@ -40,22 +38,16 @@
from Products.Five.browser.resource import DirectoryResourceFactory
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
from Products.Five.metaclass import makeClass
-from Products.Five.security import getSecurityInfo, protectClass, \
- protectName, initializeClass
+from Products.Five.security import getSecurityInfo, protectClass, protectName
-import ExtensionClass
+from Globals import InitializeClass as initializeClass
def page(_context, name, permission, for_,
- layer='default', template=None, class_=None,
+ layer=IDefaultBrowserLayer, template=None, class_=None,
allowed_interface=None, allowed_attributes=None,
attribute='__call__', menu=None, title=None,
):
- try:
- s = getGlobalService(Presentation)
- except ComponentLookupError, err:
- pass
-
_handle_menu(_context, menu, title, [for_], name, permission)
if not (class_ or template):
@@ -64,8 +56,7 @@
allowed_attributes = []
if allowed_interface is not None:
for interface in allowed_interface:
- attrs = [n for n, d in interface.namesAndDescriptions(1)]
- allowed_attributes.extend(attrs)
+ allowed_attributes.extend(interface.names())
if attribute != '__call__':
if template:
@@ -92,9 +83,10 @@
"The provided class doesn't have the specified attribute "
)
cdict = getSecurityInfo(class_)
+ cdict['__name__'] = name
if template:
new_class = makeClassForTemplate(template, bases=(class_, ),
- cdict=cdict)
+ cdict=cdict, name=name)
elif attribute != "__call__":
# we're supposed to make a page for an attribute (read:
# method) and it's not __call__. We thus need to create a
@@ -125,16 +117,15 @@
else:
# template
- new_class = makeClassForTemplate(template)
+ new_class = makeClassForTemplate(template, name=name)
_handle_for(_context, for_)
_context.action(
discriminator = ('view', for_, name, IBrowserRequest, layer),
callable = handler,
- args = (Presentation, 'provideAdapter',
- IBrowserRequest, new_class, name, [for_], Interface, layer,
- _context.info),
+ args = ('provideAdapter',
+ (for_, layer), Interface, name, new_class, _context.info),
)
_context.action(
discriminator = ('five:protectClass', new_class),
@@ -165,19 +156,6 @@
menu=menu, title=title,
**(self.opts))
-def defaultView(_context, name, for_=None):
-
- type = IBrowserRequest
-
- _context.action(
- discriminator = ('defaultViewName', for_, type, name),
- callable = handler,
- args = (Presentation,
- 'setDefaultViewName', for_, type, name),
- )
-
- _handle_for(_context, for_)
-
# view (named view with pages)
class view(zope_app_view):
@@ -192,11 +170,6 @@
pages = {}
for pname, attribute, template in self.pages:
- try:
- s = getGlobalService(Presentation)
- except ComponentLookupError, err:
- pass
-
if template:
cdict[pname] = ZopeTwoPageTemplateFile(template)
if attribute and attribute != name:
@@ -255,7 +228,7 @@
if class_ is not None:
bases = (class_, ViewMixinForTemplates)
else:
- bases = (ViewMixinForTemplates)
+ bases = (ViewMixinForTemplates,)
try:
cname = str(name)
@@ -277,37 +250,11 @@
discriminator = ('view', for_, name, IBrowserRequest, layer,
self.provides),
callable = handler,
- args = (Presentation, 'provideAdapter',
- IBrowserRequest, newclass, name, [for_], self.provides,
- layer, _context.info),
+ args = ('provideAdapter',
+ (for_, layer), self.provides, name, newclass,
+ _context.info),
)
-def _handle_for(_context, for_):
- if for_ is not None:
- _context.action(
- discriminator = None,
- callable = provideInterface,
- args = ('', for_)
- )
-
-def _handle_menu(_context, menu, title, for_, name, permission):
- if menu or title:
- if not (menu and title):
- raise ConfigurationError(
- "If either menu or title are specified, they must "
- "both be specified.")
-
- if len(for_) != 1:
- raise ConfigurationError(
- "Menus can be specified only for single-view, not for "
- "multi-views.")
-
- return menuItemDirective(
- _context, menu, for_[0], '@@' + str(name), title,
- permission=permission)
-
- return []
-
_factory_map = {'image':{'prefix':'ImageResource',
'count':0,
'factory':ImageResourceFactory},
@@ -319,7 +266,7 @@
'factory':PageTemplateResourceFactory}
}
-def resource(_context, name, layer='default', permission='zope.Public',
+def resource(_context, name, layer=IDefaultBrowserLayer, permission='zope.Public',
file=None, image=None, template=None):
if ((file and image) or (file and template) or
@@ -343,8 +290,8 @@
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
- args = (Presentation, 'provideResource',
- name, IBrowserRequest, factory, layer),
+ args = ('provideAdapter',
+ (layer,), Interface, name, factory, _context.info),
)
_context.action(
discriminator = ('five:protectClass', new_class),
@@ -367,7 +314,7 @@
'count':0}
}
-def resourceDirectory(_context, name, directory, layer='default',
+def resourceDirectory(_context, name, directory, layer=IDefaultBrowserLayer,
permission='zope.Public'):
if not os.path.isdir(directory):
@@ -410,8 +357,8 @@
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
- args = (Presentation, 'provideResource',
- name, IBrowserRequest, factory, layer),
+ args = ('provideAdapter',
+ (layer,), Interface, name, factory, _context.info),
)
for new_class in new_classes:
_context.action(
@@ -456,11 +403,12 @@
return self.index(self, *args, **kw)
def makeClassForTemplate(filename, globals=None, used_for=None,
- bases=(), cdict=None):
+ bases=(), cdict=None, name=u''):
# XXX needs to deal with security from the bases?
if cdict is None:
cdict = {}
- cdict.update({'index': ZopeTwoPageTemplateFile(filename, globals)})
+ cdict.update({'index': ZopeTwoPageTemplateFile(filename, globals),
+ '__name__': name})
bases += (ViewMixinForTemplates,)
class_ = makeClass("SimpleViewClass from %s" % filename, bases, cdict)
Modified: Zope/trunk/lib/python/Products/Five/browser/resource.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/resource.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/resource.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -18,15 +18,15 @@
import os
import urllib
-from Acquisition import Explicit
+import Acquisition
from ComputedAttribute import ComputedAttribute
from OFS.Traversable import Traversable as OFSTraversable
-from zope.exceptions import NotFoundError
from zope.interface import implements
from zope.component.interfaces import IResource
-from zope.component import getViewProviding
from zope.publisher.interfaces.browser import IBrowserPublisher
+
+from zope.app import zapi
from zope.app.traversing.browser.interfaces import IAbsoluteURL
from zope.app.datetimeutils import time as timeFromDateTimeString
from zope.app.publisher.fileresource import File, Image
@@ -37,7 +37,7 @@
_marker = []
-class Resource(Explicit):
+class Resource(Acquisition.Explicit):
"""A publishable resource
"""
implements(IResource)
@@ -49,7 +49,9 @@
name = self.__name__
container = self.__parent__
- url = str(getViewProviding(container, IAbsoluteURL, self.request))
+ # TODO Zope 3 uses site = getSite() instead of container here
+ # and the @@ resource access view
+ url = str(zapi.getMultiAdapter((container, self.request), IAbsoluteURL))
url = urllib.unquote(url)
if not isinstance(container, DirectoryResource):
name = '++resource++%s' % name
@@ -213,7 +215,7 @@
filename = os.path.join(path, name)
if not os.path.isfile(filename):
if default is _marker:
- raise NotFoundError(name)
+ raise KeyError(name)
return default
ext = name.split('.')[-1]
factory = self.resource_factories.get(ext, self.default_factory)
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/adding.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/adding.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/adding.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -7,7 +7,7 @@
First we need to import and setup some prerequisites:
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> from Products.Five.browser.adding import ObjectManagerNameChooser
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/defaultview.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/defaultview.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/defaultview.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -3,15 +3,15 @@
xmlns:five="http://namespaces.zope.org/five">
<five:defaultViewable
- class="Products.Five.testing.simplecontent.SimpleContent" />
+ class="Products.Five.tests.testing.simplecontent.SimpleContent" />
<browser:defaultView
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
name="eagledefaultview.txt"
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
name="eagledefaultview.txt"
class=".pages.SimpleView"
attribute="eagle"
@@ -22,16 +22,16 @@
already provides __call__, such as our CallableSimpleContent -->
<five:defaultViewable
- class="Products.Five.testing.simplecontent.CallableSimpleContent" />
+ class="Products.Five.tests.testing.simplecontent.CallableSimpleContent" />
<!-- this tests whether five:defaultViewable can be called on a class that
already provides index_html, such as our IndexSimpleContent -->
<five:defaultViewable
- class="Products.Five.testing.simplecontent.IndexSimpleContent" />
+ class="Products.Five.tests.testing.simplecontent.IndexSimpleContent" />
<browser:defaultView
- for="Products.Five.testing.simplecontent.IIndexSimpleContent"
+ for="Products.Five.tests.testing.simplecontent.IIndexSimpleContent"
name="index_html"
/>
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/overrides.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/overrides.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/overrides.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -3,11 +3,11 @@
<!-- mouse instead of eagle -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
attribute="mouse"
name="overridden_view"
permission="zope2.Public"
/>
-</configure>
\ No newline at end of file
+</configure>
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -34,6 +34,11 @@
def view(self):
return "Fancy, fancy"
+class CallView(BrowserView):
+
+ def __call__(self):
+ return "I was __call__()'ed"
+
class CallableNoDocstring:
def __call__(self):
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -10,7 +10,7 @@
Let's add a test object that we view most of the pages off of:
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
>>> manage_addSimpleContent(self.folder, 'testoid', 'Testoid')
We also need to create a stub user account and login; otherwise we
@@ -29,7 +29,7 @@
A browser page that is a view class's attribute (method):
>>> view = self.folder.unrestrictedTraverse('testoid/eagle.txt')
- >>> view != None
+ >>> view is not None
True
>>> from Products.Five.browser.tests.pages import SimpleView
>>> isinstance(view, SimpleView)
@@ -196,8 +196,10 @@
>>> from Products.Five.traversable import FakeRequest
>>> from zope.app import zapi
+ >>> from zope.app.publication.browser import setDefaultSkin
>>> request = FakeRequest()
- >>> view = zapi.getView(self.folder.testoid, 'eagle.txt', request)
+ >>> setDefaultSkin(request)
+ >>> view = zapi.getMultiAdapter((self.folder.testoid, request), name=u'eagle.txt')
It's protecting the object with the permission, and not the attribute,
so we get ('',) instead of ('eagle',):
@@ -213,7 +215,7 @@
>>> view_roles
('Manager',)
-Check to see if view's context properly acquires it's true
+Check to see if view's context properly acquires its true
parent
>>> from Acquisition import aq_parent, aq_base, aq_inner
@@ -255,8 +257,8 @@
... 'nodoc-method', 'nodoc-function', 'nodoc-object',
... 'dirpage1', 'dirpage2']
- >>> from Products.Five.testing.restricted import checkRestricted
- >>> from Products.Five.testing.restricted import checkUnauthorized
+ >>> from Products.Five.tests.testing.restricted import checkRestricted
+ >>> from Products.Five.tests.testing.restricted import checkUnauthorized
As long as we're not authenticated, we should get Unauthorized for
protected views, but we should be able to view the public ones:
@@ -312,5 +314,5 @@
Clean up
--------
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -8,7 +8,7 @@
<!-- attribute page -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
attribute="eagle"
name="eagle.txt"
@@ -16,7 +16,7 @@
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
name="eagle.method"
permission="zope2.ViewManagementScreens"
@@ -25,7 +25,7 @@
<!-- attribute page -->
<browser:pages
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
permission="zope2.ViewManagementScreens"
>
@@ -41,7 +41,7 @@
<!-- template/class page -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
template="falcon.pt"
name="falcon.html"
@@ -50,7 +50,7 @@
<!-- template page (with simple python expression) -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="owl.pt"
name="owl.html"
permission="zope2.ViewManagementScreens"
@@ -59,7 +59,7 @@
<!-- template page which calls on context using python and path
expressions -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="flamingo.pt"
name="flamingo.html"
permission="zope2.ViewManagementScreens"
@@ -67,7 +67,7 @@
<!-- template/class page which calls on context, view, views -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
template="condor.pt"
name="condor.html"
@@ -76,7 +76,7 @@
<!-- template page that defines a macro page -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="birdmacro.pt"
name="bird.html"
permission="zope2.ViewManagementScreens"
@@ -84,7 +84,7 @@
<!-- template page that uses macro page -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="seagull.pt"
name="seagull.html"
permission="zope2.ViewManagementScreens"
@@ -92,21 +92,21 @@
<!-- test TALES -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="ostrich.pt"
name="ostrich.html"
permission="zope2.ViewManagementScreens"
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="tales_traversal.pt"
name="tales_traversal.html"
permission="zope2.ViewManagementScreens"
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="template_variables.pt"
name="template_variables.html"
permission="zope2.ViewManagementScreens"
@@ -115,7 +115,7 @@
<!-- template security -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="security.pt"
name="security.html"
permission="zope2.View"
@@ -124,7 +124,7 @@
<!-- a publicly accessible page, attribute, template, template/class -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
attribute="eagle"
name="public_attribute_page"
@@ -132,14 +132,14 @@
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
template="owl.pt"
name="public_template_page"
permission="zope2.Public"
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
template="falcon.pt"
name="public_template_class_page"
@@ -147,16 +147,23 @@
/>
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
template="parakeet.pt"
name="parakeet.html"
permission="zope2.ViewManagementScreens"
/>
+ <browser:page
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
+ class=".pages.CallView"
+ name="callview.html"
+ permission="zope2.Public"
+ />
+
<!-- pages from methods/functions/callables that don't have docstrings -->
<browser:pages
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class="Products.Five.browser.tests.pages.NoDocstringView"
permission="zope2.Public">
<browser:page
@@ -177,7 +184,7 @@
This is mainly used to load Zope2 skin templates so they can be used
in five skins and layers. -->
<five:pagesFromDirectory
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
module="Products.Five.browser.tests"
directory="pages"
permission="zope2.Public"
@@ -186,7 +193,7 @@
<!-- browser:page directives with new style classes are ignored -->
<browser:page
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.NewStyleClass"
name="new_style_class"
attribute="method"
@@ -198,7 +205,7 @@
<browser:view
name=""
- for="Products.Five.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
permission="zope2.Public"
/>
@@ -207,18 +214,18 @@
<!-- protected edit form for permission check -->
<browser:editform
- schema="Products.Five.testing.simplecontent.ISimpleContent"
+ 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.testing.simplecontent.ISimpleContent"
+ for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.SimpleView"
attribute="eagle"
name="overridden_view"
permission="zope2.Public"
/>
-</configure>
\ No newline at end of file
+</configure>
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pages_ftest.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pages_ftest.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pages_ftest.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -11,7 +11,7 @@
Let's also add one of our stub objects to play with:
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
>>> manage_addSimpleContent(self.folder, 'testoid', 'Testoid')
@@ -122,8 +122,23 @@
... self.failUnless(status == 200, (status, 200, view_name))
+Miscellaneous
+-------------
+
+Zope 2 always wants objects in the traversal graph to have a __name__.
+That is also true for views, e.g. a view constructed from a simple
+class bearing only a __call__ method:
+
+ >>> print http(r'''
+ ... GET /test_folder_1_/testoid/callview.html HTTP/1.1
+ ... ''')
+ HTTP/1.1 200 OK
+ ...
+ I was __call__()'ed
+
+
Clean up
--------
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/pts_test_languages.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/pts_test_languages.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/pts_test_languages.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -42,7 +42,7 @@
Finally, we need a traversable folder so that the test page we
registered is found:
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'ftf')
Now for some actual testing... Our test page is a simple ZPT
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/resource.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/resource.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/resource.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -8,7 +8,7 @@
>>> zcml.load_config("configure.zcml", Products.Five)
>>> zcml.load_config('resource.zcml', package=Products.Five.browser.tests)
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
>>> import os, glob
@@ -73,8 +73,8 @@
Security
--------
- >>> from Products.Five.testing.restricted import checkRestricted
- >>> from Products.Five.testing.restricted import checkUnauthorized
+ >>> from Products.Five.tests.testing.restricted import checkRestricted
+ >>> from Products.Five.tests.testing.restricted import checkUnauthorized
>>> resource_names = ['cockatiel.html', 'style.css', 'pattern.png']
@@ -112,5 +112,5 @@
Clean up
--------
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/resource_ftest.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/resource_ftest.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/resource_ftest.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -8,7 +8,7 @@
>>> zcml.load_config("configure.zcml", Products.Five)
>>> zcml.load_config('resource.zcml', package=Products.Five.browser.tests)
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
>>> import os, glob
@@ -69,5 +69,5 @@
Clean up
--------
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_absoluteurl.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_absoluteurl.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_absoluteurl.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -29,7 +29,7 @@
>>> from Products.Five import zcml
>>> zcml.load_config("configure.zcml", Products.Five)
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
A simple traversal will yield us the @@absolute_url view:
@@ -86,7 +86,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_defaultview.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_defaultview.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_defaultview.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,9 +33,9 @@
Now let's add a couple of stub objects:
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
- >>> from Products.Five.testing.simplecontent import manage_addCallableSimpleContent
- >>> from Products.Five.testing.simplecontent import manage_addIndexSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addCallableSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addIndexSimpleContent
>>> manage_addSimpleContent(self.folder, 'testoid', 'Testoid')
>>> manage_addCallableSimpleContent(self.folder, 'testcall', 'TestCall')
@@ -79,7 +79,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_i18n.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_i18n.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_i18n.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,7 +33,7 @@
... </configure>
... <configure package="Products.Five.browser.tests">
... <browser:page
- ... for="Products.Five.interfaces.IFolder"
+ ... for="OFS.interfaces.IFolder"
... template="i18n.pt"
... name="i18n.html"
... permission="zope2.View"
@@ -49,7 +49,7 @@
In order to be able to traverse to the PageTemplate view, we need
a traversable object:
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
We tell Zope to translate the messages by passing the
@@ -80,7 +80,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_menu.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_menu.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_menu.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -28,7 +28,8 @@
>>> import Products.Five.browser.tests
>>> from Products.Five import zcml
- >>> zcml.load_config("configure.zcml", Products.Five)
+ >>> zcml.load_config("meta.zcml", Products.Five)
+ >>> zcml.load_config("permissions.zcml", Products.Five)
>>> zcml.load_config('menu.zcml', package=Products.Five.browser.tests)
>>> from Products.Five.security import newInteraction
@@ -37,12 +38,12 @@
Now for some actual testing... Let's look up the menu we registered:
>>> from Products.Five.traversable import FakeRequest
- >>> from zope.app.publisher.browser.globalbrowsermenuservice import \\
- ... globalBrowserMenuService
+ >>> from zope.app.publication.browser import setDefaultSkin
+ >>> from zope.app.publisher.browser.menu import getMenu
>>> request = FakeRequest()
- >>> menu = globalBrowserMenuService.getMenu(
- ... 'testmenu', self.folder, request)
+ >>> setDefaultSkin(request)
+ >>> menu = getMenu('testmenu', self.folder, request)
It should have
@@ -53,28 +54,42 @@
>>> menu.sort(lambda x, y: cmp(x['title'], y['title']))
>>> from pprint import pprint
- >>> pprint(menu)
- [{'action': '@@cockatiel_menu_public.html',
- 'description': '',
- 'extra': None,
- 'selected': '',
- 'title': u'Page in a menu (public)'},
- {'action': u'seagull.html',
- 'description': u'This is a test menu item',
- 'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item'},
- {'action': u'parakeet.html',
- 'description': u'This is a test menu item',
- 'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item 2'},
- {'action': u'falcon.html',
- 'description': u'This is a test menu item',
- 'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item 3'}]
+ >>> pprint(menu[0])
+ {'action': u'@@cockatiel_menu_public.html',
+ 'description': u'',
+ 'extra': None,
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Page in a menu (public)'}
+ >>> pprint(menu[1])
+ {'action': u'seagull.html',
+ 'description': u'This is a test menu item',
+ 'extra': None,
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item'}
+
+ >>> pprint(menu[2])
+ {'action': u'parakeet.html',
+ 'description': u'This is a test menu item',
+ 'extra': None,
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item 2'}
+
+ >>> pprint(menu[3])
+ {'action': u'falcon.html',
+ 'description': u'This is a test menu item',
+ 'extra': None,
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item 3'}
+
Let's create a manager user account and log in.
>>> uf = self.folder.acl_users
@@ -82,8 +97,7 @@
>>> self.login('manager')
>>> newInteraction()
- >>> menu = globalBrowserMenuService.getMenu(
- ... 'testmenu', self.folder, request)
+ >>> menu = getMenu('testmenu', self.folder, request)
We should get the protected menu items now:
@@ -91,47 +105,73 @@
7
>>> menu.sort(lambda x, y: cmp(x['title'], y['title']))
- >>> pprint(menu)
- [{'action': '@@cockatiel_menu_protected.html',
- 'description': '',
- 'extra': None,
- 'selected': '',
- 'title': u'Page in a menu (protected)'},
- {'action': '@@cockatiel_menu_public.html',
- 'description': '',
+ >>> pprint(menu[0])
+ {'action': u'@@cockatiel_menu_protected.html',
+ 'description': u'',
'extra': None,
- 'selected': '',
- 'title': u'Page in a menu (public)'},
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Page in a menu (protected)'}
+
+ >>> pprint(menu[1])
+ {'action': u'@@cockatiel_menu_public.html',
+ 'description': u'',
+ 'extra': None,
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Page in a menu (public)'}
+
+ >>> pprint(menu[2])
{'action': u'seagull.html',
'description': u'This is a protected test menu item',
'extra': None,
- 'selected': '',
- 'title': u'Protected Test Menu Item'},
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Protected Test Menu Item'}
+
+ >>> pprint(menu[3])
{'action': u'falcon.html',
'description': u'This is a protected test menu item',
'extra': None,
- 'selected': '',
- 'title': u'Protected Test Menu Item 2'},
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Protected Test Menu Item 2'}
+
+ >>> pprint(menu[4])
{'action': u'seagull.html',
'description': u'This is a test menu item',
'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item'},
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item'}
+
+ >>> pprint(menu[5])
{'action': u'parakeet.html',
'description': u'This is a test menu item',
'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item 2'},
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item 2'}
+
+ >>> pprint(menu[6])
{'action': u'falcon.html',
'description': u'This is a test menu item',
'extra': None,
- 'selected': '',
- 'title': u'Test Menu Item 3'}]
+ 'icon': None,
+ 'selected': u'',
+ 'submenu': None,
+ 'title': u'Test Menu Item 3'}
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_pages.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_pages.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_pages.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -26,7 +26,7 @@
>>> zcml.load_config("configure.zcml", Products.Five)
>>> zcml.load_config('pages.zcml', package=Products.Five.browser.tests)
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
>>> manage_addSimpleContent(self.folder, 'testoid', 'Testoid')
>>> uf = self.folder.acl_users
>>> uf._doAddUser('manager', 'r00t', ['Manager'], [])
@@ -56,7 +56,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
@@ -65,11 +65,10 @@
from Testing.ZopeTestCase import installProduct, ZopeDocTestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
- installProduct('PythonScripts') # for Five.testing.restricted
+ installProduct('PythonScripts') # for Five.tests.testing.restricted
return unittest.TestSuite((
ZopeDocTestSuite(),
- ZopeDocFileSuite('pages.txt',
- package='Products.Five.browser.tests'),
+ ZopeDocFileSuite('pages.txt', package='Products.Five.browser.tests'),
FunctionalDocFileSuite('pages_ftest.txt',
package='Products.Five.browser.tests')
))
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_recurse.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_recurse.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_recurse.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -23,9 +23,6 @@
"""
Test recursion
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
- >>> setUp()
-
This test makes sure that recursion is avoided for view lookup.
First, we need to set up a stub interface...
@@ -51,10 +48,10 @@
>>> from Products.Five.fiveconfigure import classDefaultViewable
>>> classDefaultViewable(Recurse)
- >>> from zope.app import zapi
+ >>> from zope.component import provideAdapter
>>> from zope.publisher.interfaces.browser import IBrowserRequest
- >>> pres = zapi.getGlobalService('Presentation')
- >>> pres.setDefaultViewName(IRecurse, IBrowserRequest, 'view')
+ >>> from zope.component.interfaces import IDefaultViewName
+ >>> provideAdapter(u'view', (IRecurse, IBrowserRequest), IDefaultViewName)
Here comes the actual test:
@@ -65,9 +62,10 @@
'foo'
- Clean up:
+ Clean up adapter registry and monkey patches to classes:
- >>> tearDown()
+ >>> from zope.testing.cleanup import cleanUp
+ >>> cleanUp()
"""
def test_suite():
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_resource.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_resource.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_resource.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -23,7 +23,7 @@
import unittest
from Testing.ZopeTestCase import installProduct, ZopeDocFileSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
- installProduct('PythonScripts') # for Five.testing.restricted
+ installProduct('PythonScripts') # for Five.tests.testing.restricted
return unittest.TestSuite((
ZopeDocFileSuite('resource.txt',
package='Products.Five.browser.tests'),
Modified: Zope/trunk/lib/python/Products/Five/browser/tests/test_traversable.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/tests/test_traversable.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/browser/tests/test_traversable.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,7 +33,7 @@
the wrong reason: None doesn't have a docstring so BaseRequest
raises NotFoundError.)
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
>>> manage_addSimpleContent(self.folder, 'testoid', 'Testoid')
>>> print http(r'''
... GET /test_folder_1_/testoid/doesntexist HTTP/1.1
@@ -54,21 +54,21 @@
... <meta:redefinePermission from="zope2.Public" to="zope.Public" />
...
... <five:traversable
- ... class="Products.Five.testing.fancycontent.FancyContent"
+ ... class="Products.Five.tests.testing.fancycontent.FancyContent"
... />
...
... <browser:page
- ... for="Products.Five.testing.fancycontent.IFancyContent"
+ ... for="Products.Five.tests.testing.fancycontent.IFancyContent"
... class="Products.Five.browser.tests.pages.FancyView"
... attribute="view"
- ... name="fancy"
+ ... name="fancyview"
... permission="zope2.Public"
... />
...
... </configure>'''
>>> zcml.load_string(configure_zcml)
- >>> from Products.Five.testing.fancycontent import manage_addFancyContent
+ >>> from Products.Five.tests.testing.fancycontent import manage_addFancyContent
>>> info = manage_addFancyContent(self.folder, 'fancy', '')
In the following test we let the original __bobo_traverse__ method
@@ -85,7 +85,7 @@
actually works:
>>> print http(r'''
- ... GET /test_folder_1_/fancy/fancy HTTP/1.1
+ ... GET /test_folder_1_/fancy/fancyview HTTP/1.1
... ''')
HTTP/1.1 200 OK
...
@@ -94,7 +94,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/configure.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/configure.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/configure.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -2,13 +2,15 @@
xmlns:five="http://namespaces.zope.org/five">
<include file="meta.zcml" />
- <include file="services.zcml" />
- <include file="interfaces.zcml" />
<include file="permissions.zcml" />
<include file="i18n.zcml" />
+ <include file="event.zcml"/>
+ <include file="deprecated.zcml"/>
+ <include package=".site" />
<include package=".browser" />
<include package=".form" />
<include package=".skin" />
+ <include package=".utilities" />
<include package="zope.app.event" />
<include package="zope.app.traversing" />
Copied: Zope/trunk/lib/python/Products/Five/deprecated.zcml (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/deprecated.zcml)
Modified: Zope/trunk/lib/python/Products/Five/doc/directives.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/directives.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/directives.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,16 +33,6 @@
Redefine a permission in included ZCML as another one.
-service
--------
-
-Declare a global service
-
-serviceType
------------
-
-Declare a type of service.
-
skin
----
@@ -55,9 +45,25 @@
interface
---------
+
Register an interface in ZCML.
+factory
+-------
+Register an object factory.
+
+modulealias
+-----------
+
+Provide a module under an alias name, e.g. for persistent backward
+compatability.
+
+hook
+----
+
+Install a hook on a hookable object.
+
browser ``http://namespaces.zope.org/browser``
==============================================
@@ -148,16 +154,34 @@
Retrieve size information for a Zope 2 content class via a Zope 3
style ``ISized`` adapter.
-sendEvents
-----------
+containerEvents
+---------------
-Lets a Zope 2 content class send out Zope 3 object events that
-correspond to the Zope 2 methods ``manage_afterAdd`` and
-``manage_beforeDelete``.
+Make events be sent for Zope 2 container objects, instead of calling old
+methods like ``manage_afterAdd``. These old methods will still be called
+for classes specified in a ``deprecatedManageAddDelete`` directive.
+deprecatedManageAddDelete
+-------------------------
+
+Specify a class that needs its old deprecated methods like
+``manage_afterAdd``, ``manage_beforeDelete`` and ``manage_afterClone``
+to be called. Modern classes should use event subscribers instead.
+
pagesFromDirectory
------------------
-Load all *.pt files in a directory as pages. Useful when you want to
-share templates between Five and CMF, so you can declare pages like
-this is a similar way to setting up skin folders in portal_skins.
+Loads all files with .pt extension in a directory as pages.
+
+registerClass
+-------------
+
+Registers Five content with Zope 2.
+
+localsite
+---------
+
+Turns a class into an implementation of ``IPossibleSite`` so that its
+instances can be serve as local sites. Unless otherwise specified, a
+default implementation's methods will be used to make the class comply
+with the ``IPossibleSite`` interface.
Modified: Zope/trunk/lib/python/Products/Five/doc/features.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/features.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/features.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -8,7 +8,7 @@
Zope 3 interfaces
=================
-Everything in the ``zope.interface`` package should work. Zope 3
+Everything from the ``zope.interface`` package works. Zope 3
interfaces are the foundation of the component architecture, and also
the foundation of schemas.
@@ -84,3 +84,18 @@
ignored by views anyway, as they are trusted -- it only serves to
protect directly exposed methods on content classes (the python
scripts and the ZPublisher).
+
+Local Sites
+===========
+
+Five supports the concept of a local sites and local site managers.
+See localsite.txt_ for more information.
+
+.. _localsite.txt: localsite.html
+
+Object events
+=============
+
+Five supports sending Zope 3 object events when objects are added,
+moved, renamed, copied and deleted. The use of ``manage_afterAdd`` & co
+methods is deprecated.
Copied: Zope/trunk/lib/python/Products/Five/doc/five14goals.txt (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/doc/five14goals.txt)
Copied: Zope/trunk/lib/python/Products/Five/doc/localsite.txt (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/doc/localsite.txt)
Modified: Zope/trunk/lib/python/Products/Five/doc/main.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/main.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/main.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -5,33 +5,42 @@
-------------
Five is a Zope 2 product that allows you to integrate Zope 3
-technologies into Zope 2, today. Five right now allows you to use the
-following Zope 3 technologies in Zope 2:
+technologies into Zope 2, today. Among others, it allows you to use
+Zope 3 interfaces, ZCML-based configuration, adapters, browser pages
+(including skins, layers, and resources), automated add and edit forms
+based on schemas, object events, as well as Zope 3-style i18n message
+catalogs.
-* Zope 3 interfaces
+We've tried to keep the Five experience as close to Zope 3 as
+possible, so this means that what you learn while using Five should
+also be applicable to Zope 3, and viceversa.
-* adapters
+Five 1.0 and 1.1 work on a straight Zope 2.7 installation, as long as
+Zope 3 has been installed. Five 1.2 requires Zope 2.8 which already
+ships with Zope 3, Five 1.3 is included in Zope 2.9.
-* pages (views), including skins and layers, and edit and add forms
-
-* ZCML
-
-It is possible to add Zope 3 style views to your own Zope 2 objects,
-or to existing ones, even normal Folders!
-
-Five works with a straight Zope 2.7 installation, as long as Zope 3
-has been installed. See Five's INSTALL.txt for more information on how
-to set it up.
-
We're in the process of evaluating lots more Zope 3 technologies for
-integration into Zope 2. This is the right moment for interested Zope
-2 and Zope 3 developers to jump in. We're looking for cooperation
+integration into Zope 2. This is the right moment for interested Zope
+2 and Zope 3 developers to jump in. We're looking for cooperation
between different Zope 2 projects so that this can be a foundational
system for us all.
Download
--------
+2005-11-02 -- We have released Five 1.2b and 1.3b! Download Five 1.2b
+here:
+
+http://codespeak.net/z3/five/release/Five-1.2b.tgz
+
+2005-10-04 -- We have released Five 1.1! Download it here:
+
+http://codespeak.net/z3/five/release/Five-1.1.tgz
+
+2005-07-13 -- We have released Five 1.1b! Download it here:
+
+http://codespeak.net/z3/five/release/Five-1.1b.tgz
+
2005-07-12 -- We have released Five 1.0.2! This is also the version
that will be included in Zope 2.8.1. Download it here:
Modified: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/__init__.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/__init__.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,22 +1 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-
-import democontent
-
-def initialize(context):
-
- context.registerClass(
- democontent.DemoContent,
- constructors = (democontent.manage_addDemoContentForm,
- democontent.manage_addDemoContent),
- )
+# make this directory a package
Copied: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/addDemoContent.pt (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/doc/products/ViewsTutorial/addDemoContent.pt)
Modified: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/browser.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/browser.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/browser.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,20 +1,12 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-
-from Products.Five import BrowserView
import random
+from democontent import DemoContent
-class Overview(BrowserView):
+
+class Overview:
+
+ """View for overview.
+ """
+
def reversedIds(self):
result = []
for id in self.context.objectIds():
@@ -27,9 +19,28 @@
def directlyPublished(self):
return "This is directly published"
-class NewExample(BrowserView):
+
+class NewExample:
+
+ """View for new example.
+ """
+
def helpsWithOne(self):
return random.randrange(10)
-
+
def two(self):
return "Two got called"
+
+
+class DemoContentAddView:
+
+ """Add view for demo content.
+ """
+
+ def __call__(self, add_input_name='', title='', submit_add=''):
+ if submit_add:
+ obj = DemoContent(add_input_name, title)
+ self.context.add(obj)
+ self.request.response.redirect(self.context.nextURL())
+ return ''
+ return self.index()
Modified: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/configure.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/configure.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/configure.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,37 +1,39 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- xmlns:five="http://namespaces.zope.org/five">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:five="http://namespaces.zope.org/five">
- <five:traversable
- class="OFS.Folder.Folder"
- />
+ <five:traversable class="OFS.Application.Application"/>
+ <!-- OFS.Folder.Folder views -->
+
+ <five:traversable class="OFS.Folder.Folder"/>
+
<browser:page
- for="Products.Five.interfaces.IFolder"
- name="overview.html"
- template="overview.pt"
- permission="zope2.ViewManagementScreens"
- />
-
+ for="OFS.interfaces.IFolder"
+ name="overview.html"
+ template="overview.pt"
+ permission="zope2.ViewManagementScreens"
+ />
+
<browser:page
- for="Products.Five.interfaces.IFolder"
- name="overview2.html"
- template="overview2.pt"
- permission="zope2.ViewManagementScreens"
- class=".browser.Overview"
- />
+ for="OFS.interfaces.IFolder"
+ name="overview2.html"
+ template="overview2.pt"
+ class=".browser.Overview"
+ permission="zope2.ViewManagementScreens"
+ />
<browser:page
- for="Products.Five.interfaces.IFolder"
- name="test.html"
- class=".browser.Overview"
- attribute="directlyPublished"
- permission="zope2.ViewManagementScreens"
- />
+ for="OFS.interfaces.IFolder"
+ name="test.html"
+ class=".browser.Overview"
+ attribute="directlyPublished"
+ permission="zope2.ViewManagementScreens"
+ />
<browser:pages
- for="Products.Five.interfaces.IFolder"
+ for="OFS.interfaces.IFolder"
class=".browser.NewExample"
permission="zope2.ViewManagementScreens"
>
@@ -45,19 +47,43 @@
/>
</browser:pages>
- <five:traversable class=".democontent.DemoContent" />
+ <!-- .democontent.IDemoContent views -->
+ <five:traversable class=".democontent.DemoContent"/>
+
<browser:page
- for=".democontent.IDemoContent"
- name="someview.html"
- template="someview.pt"
- permission="zope2.ViewManagementScreens"
- />
+ for="zope.app.container.interfaces.IAdding"
+ name="addDemoContent.html"
+ template="addDemoContent.pt"
+ class=".browser.DemoContentAddView"
+ permission="zope2.ViewManagementScreens"
+ />
- <five:defaultViewable class=".democontent.DemoContent" />
-
+ <browser:resource
+ name="green5.png"
+ image="green5.png"
+ />
+
+ <five:registerClass
+ class=".democontent.DemoContent"
+ meta_type="Five Demo Content"
+ addview="addDemoContent.html"
+ icon="green5.png"
+ permission="zope2.ViewManagementScreens"
+ />
+
+ <browser:page
+ for=".democontent.IDemoContent"
+ name="someview.html"
+ template="someview.pt"
+ permission="zope2.ViewManagementScreens"
+ />
+
+ <five:defaultViewable class=".democontent.DemoContent"/>
+
<browser:defaultView
- for=".democontent.IDemoContent"
- name="someview.html" />
+ for=".democontent.IDemoContent"
+ name="someview.html"
+ />
</configure>
Modified: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/democontent.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/democontent.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/democontent.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,44 +1,21 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-
from zope.interface import Interface, implements
from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+
class IDemoContent(Interface):
+
def mymethod():
- "Return some text"
-
+ """Return some text.
+ """
+
+
class DemoContent(SimpleItem):
+
implements(IDemoContent)
- meta_type = 'Five Demo Content'
-
def __init__(self, id, title):
self.id = id
self.title = title
def mymethod(self):
return "Hello world"
-
-
-manage_addDemoContentForm = PageTemplateFile(
- "www/demoContentAdd", globals(),
- __name__ = 'manage_addDemoContentForm')
-
-def manage_addDemoContent(self, id, title, REQUEST=None):
- """Add the demo content."""
- id = self._setObject(id, DemoContent(id, title))
- if REQUEST is None:
- return
- REQUEST.RESPONSE.redirect(REQUEST['URL1'] + '/manage_main')
Copied: Zope/trunk/lib/python/Products/Five/doc/products/ViewsTutorial/green5.png (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/doc/products/ViewsTutorial/green5.png)
Copied: Zope/trunk/lib/python/Products/Five/event.zcml (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/event.zcml)
Modified: Zope/trunk/lib/python/Products/Five/eventconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/eventconfigure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/eventconfigure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# Copyright (c) 2005 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -15,109 +15,38 @@
Use 'structured monkey patching' to enable zope.app.container event sending for
Zope 2 objects.
-$Id: eventconfigure.py 17810 2005-09-24 09:12:59Z efge $
+$Id: eventconfigure.py 19413 2005-11-02 14:37:52Z efge $
"""
-from Products.Five.fiveconfigure import isFiveMethod
-from zope.event import notify
-from zope.interface import implements
-from zope.app.container.interfaces import IObjectAddedEvent,\
- IObjectRemovedEvent
-from zope.app.container.contained import ObjectMovedEvent
-from zope.app.event.objectevent import ObjectCopiedEvent
-# holds classes that were monkeyed with; for clean up
-_monkied = []
+import warnings
+from OFS.subscribers import deprecatedManageAddDeleteClasses
-# ObjectAddedEvent and ObjectRemovedEvent are different in Zope 2
-class ObjectAddedEvent(ObjectMovedEvent):
- implements(IObjectAddedEvent)
+def setContainerEvents():
+ warnings.warn("Using <five:containerEvents/> is deprecated (it is now "
+ "the default), it will be removed in Zope 2.11",
+ DeprecationWarning)
- def __init__(self, object, newParent=None, newName=None):
- if newParent is None:
- newParent = object.aq_inner.aq_parent
- if newName is None:
- newName = object.id
- ObjectMovedEvent.__init__(self, object, None, None, newParent, newName)
-
-class ObjectRemovedEvent(ObjectMovedEvent):
- implements(IObjectRemovedEvent)
+def setDeprecatedManageAddDelete(class_):
+ """Instances of the class will still see their old methods called."""
+ deprecatedManageAddDeleteClasses.append(class_)
- def __init__(self, object, oldParent=None, oldName=None):
- if oldParent is None:
- oldParent = object.aq_inner.aq_parent
- if oldName is None:
- oldName = object.id
- ObjectMovedEvent.__init__(self, object, oldParent, oldName, None, None)
-
-def manage_afterAdd(self, item, container):
- original_location_path = getattr(self, '__five_location_path__', None)
- self.__five_location_path__ = self.getPhysicalPath()
- # if there still is an object in the original location, we're copied
- # we cannot rely on manage_afterClone, as this gets triggered only
- # *after* a manage_afterAdd. This logic might fail in the case where
- # something *is* somehow left in the original location that can
- # be traversed to.
- is_copied = original_location_path and (self.unrestrictedTraverse(
- original_location_path, None) is not None)
- if is_copied:
- notify(ObjectCopiedEvent(self))
- if original_location_path is None or is_copied:
- notify(ObjectAddedEvent(self))
- else:
- original_location = self.unrestrictedTraverse(
- original_location_path[:-1])
- notify(ObjectMovedEvent(self,
- original_location, original_location_path[-1],
- container, self.id))
- # call original
- method = getattr(self, '__five_original_manage_afterAdd', None)
- if method is not None:
- self.__five_original_manage_afterAdd(item, container)
+def cleanUp():
+ deprecatedManageAddDeleteClasses[:] = []
-manage_afterAdd.__five_method__ = True
+def containerEvents(_context):
+ _context.action(
+ discriminator=None,
+ callable=setContainerEvents,
+ args=(),
+ )
-def manage_beforeDelete(self, item, container):
- notify(ObjectRemovedEvent(self))
- # call original
- method = getattr(self, '__five_original_manage_beforeDelete', None)
- if method is not None:
- self.__five_original_manage_beforeDelete(item, container)
-
-manage_beforeDelete.__five_method__ = True
-
-def classSendEvents(class_):
- """Make instances of the class send Object*Event."""
- # tuck away original methods if necessary
- for name in ['manage_afterAdd', 'manage_beforeDelete']:
- method = getattr(class_, name, None)
- if not isFiveMethod(method):
- # if we haven't alread overridden this, tuck away originals
- setattr(class_, '__five_original_' + name, method)
-
- class_.manage_afterAdd = manage_afterAdd
- class_.manage_beforeDelete = manage_beforeDelete
- # remember class for clean up
- _monkied.append(class_)
-
-def sendEvents(_context, class_):
+def deprecatedManageAddDelete(_context, class_):
_context.action(
- discriminator = ('five:sendEvents', class_),
- callable = classSendEvents,
- args=(class_,)
+ discriminator=('five:deprecatedManageAddDelete', class_),
+ callable=setDeprecatedManageAddDelete,
+ args=(class_,),
)
-# clean up code
-from Products.Five.fiveconfigure import killMonkey
from zope.testing.cleanup import addCleanUp
-
-def unsendEvents(class_):
- """Restore class's initial state with respect to sending events"""
- for name in ['manage_afterAdd', 'manage_beforeDelete']:
- killMonkey(class_, name, '__five_original_'+name)
-
-def cleanUp():
- for class_ in _monkied:
- unsendEvents(class_)
-
addCleanUp(cleanUp)
del addCleanUp
Modified: Zope/trunk/lib/python/Products/Five/fiveconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/fiveconfigure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/fiveconfigure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -22,12 +22,20 @@
import glob
import warnings
-import App
+import App.config
+import Products
from zLOG import LOG, ERROR
-from zope.interface import classImplements
+from zope.interface import classImplements, classImplementsOnly, implementedBy
+from zope.interface.interface import InterfaceClass
from zope.configuration import xmlconfig
+from zope.configuration.exceptions import ConfigurationError
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+
+from zope.app import zapi
from zope.app.component.interface import provideInterface
+from zope.app.component.metaconfigure import adapter
+from zope.app.security.interfaces import IPermission
from viewable import Viewable
from traversable import Traversable
@@ -55,7 +63,7 @@
# in the control panel. However, all attempts to do so has failed from my
# side. //regebro
exc = sys.exc_info()
- LOG('Five', ERROR, 'Could not import Product %s' % name, error=exc)
+ LOG('Five', ERROR, 'Could not import Product %s' % product.__name__, error=exc)
def loadProducts(_context):
products = findProducts()
@@ -177,20 +185,6 @@
args = (class_,)
)
-def viewable(_context, class_):
- # XXX do not need to mark where this is used, as simple search
- # should find all instances easily
- warnings.warn(
- 'The five:viewable directive has been deprecated. '
- 'Please use the five:traversable directive instead.',
- DeprecationWarning)
-
- _context.action(
- discriminator = None,
- callable = classTraversable,
- args=(class_,)
- )
-
def createZope2Bridge(zope2, package, name):
# Map a Zope 2 interface into a Zope3 interface, seated within 'package'
# as 'name'.
@@ -215,7 +209,7 @@
)
def pagesFromDirectory(_context, directory, module, for_=None,
- layer='default', permission='zope.Public'):
+ layer=IDefaultBrowserLayer, permission='zope.Public'):
if isinstance(module, basestring):
module = _context.resolve(module)
@@ -233,6 +227,41 @@
page(_context, name=name, permission=permission,
layer=layer, for_=for_, template=fname)
+
+_register_monkies = []
+_meta_type_regs = []
+def _registerClass(class_, meta_type, permission, addview, icon, global_):
+ setattr(class_, 'meta_type', meta_type)
+
+ permission_obj = zapi.getUtility(IPermission, permission)
+
+ if icon:
+ setattr(class_, 'icon', '++resource++%s' % icon)
+
+ interfaces = tuple(implementedBy(class_))
+
+ info = {'name': meta_type,
+ 'action': addview and ('+/%s' % addview) or '',
+ 'product': 'Five',
+ 'permission': str(permission_obj.title),
+ 'visibility': global_ and 'Global' or None,
+ 'interfaces': interfaces,
+ 'instance': class_,
+ 'container_filter': None}
+
+ Products.meta_types += (info,)
+
+ _register_monkies.append(class_)
+ _meta_type_regs.append(meta_type)
+
+def registerClass(_context, class_, meta_type, permission, addview=None,
+ icon=None, global_=True):
+ _context.action(
+ discriminator = ('registerClass', meta_type),
+ callable = _registerClass,
+ args = (class_, meta_type, permission, addview, icon, global_)
+ )
+
# clean up code
def killMonkey(class_, name, fallback, attr=None):
@@ -265,12 +294,34 @@
killMonkey(class_, '__browser_default__', '__fallback_default__',
'__five_viewable__')
+def unregisterClass(class_):
+ delattr(class_, 'meta_type')
+ try:
+ delattr(class_, 'icon')
+ except AttributeError:
+ pass
+
def cleanUp():
+ global _traversable_monkies
for class_ in _traversable_monkies:
untraversable(class_)
+ _traversable_monkies = []
+
+ global _defaultviewable_monkies
for class_ in _defaultviewable_monkies:
undefaultViewable(class_)
+ _defaultviewable_monkies = []
+ global _register_monkies
+ for class_ in _register_monkies:
+ unregisterClass(class_)
+ _register_monkies = []
+
+ global _meta_type_regs
+ Products.meta_types = tuple([ info for info in Products.meta_types
+ if info['name'] not in _meta_type_regs ])
+ _meta_type_regs = []
+
from zope.testing.cleanup import addCleanUp
addCleanUp(cleanUp)
del addCleanUp
Modified: Zope/trunk/lib/python/Products/Five/fivedirectives.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/fivedirectives.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/fivedirectives.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,7 +17,10 @@
"""
from zope.interface import Interface
from zope.app.publisher.browser.metadirectives import IBasicResourceInformation
+from zope.app.security.fields import Permission
from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
+from zope.configuration.fields import Bool
+from zope.schema import ASCII
from zope.schema import TextLine
class IImplementsDirective(Interface):
@@ -56,7 +59,7 @@
required=True
)
-class ISendEventsDirective(Interface):
+class ISizableDirective(Interface):
"""Make instances of class send events.
"""
@@ -65,6 +68,19 @@
required=True
)
+class IContainerEventsDirective(Interface):
+ """Global switch to enable container events
+ """
+
+class IDeprecatedManageAddDeleteDirective(Interface):
+ """Call manage_afterAdd & co for these contained content classes.
+ """
+ class_ = GlobalObject(
+ title=u"Class",
+ required=True,
+ )
+
+
class IBridgeDirective(Interface):
"""Bridge from a Zope 2 interface to an equivalent Zope3 interface.
"""
@@ -104,3 +120,51 @@
description=u"The directory containing the resource data.",
required=True
)
+
+class IRegisterClassDirective(Interface):
+
+ """registerClass directive schema.
+
+ Register Five content with Zope 2.
+ """
+
+ class_ = GlobalObject(
+ title=u'Instance Class',
+ description=u'Dotted name of the class that is registered.',
+ required=True
+ )
+
+ meta_type = ASCII(
+ title=u'Meta Type',
+ description=u'A human readable unique identifier for the class.',
+ required=True
+ )
+
+ permission = Permission(
+ title=u'Add Permission',
+ description=u'The permission for adding objects of this class.',
+ required=True
+ )
+
+ addview = ASCII(
+ title=u'Add View ID',
+ description=u'The ID of the add view used in the ZMI. Consider this '
+ u'required unless you know exactly what you do.',
+ default=None,
+ required=False
+ )
+
+ icon = ASCII(
+ title=u'Icon ID',
+ description=u'The ID of the icon used in the ZMI.',
+ default=None,
+ required=False
+ )
+
+ global_ = Bool(
+ title=u'Global scope?',
+ description=u'If "global" is False the class is only available in '
+ u'containers that explicitly allow one of its interfaces.',
+ default=True,
+ required=False
+ )
Modified: Zope/trunk/lib/python/Products/Five/form/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/__init__.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/__init__.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -33,7 +33,7 @@
from zope.app.form.utility import setUpWidgets, getWidgetsData
from zope.app.form.interfaces import IInputWidget, WidgetsError
from zope.app.event.objectevent import ObjectCreatedEvent, ObjectModifiedEvent
-from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.i18n import ZopeMessageFactory as _
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
@@ -144,12 +144,13 @@
if changed:
self.changed()
# XXX: Needs locale support:
- # formatter = self.request.locale.dates.getFormatter(
- # 'dateTime', 'medium')
- status = _("Updated on ${date_time}")
- # status.mapping = {'date_time': formatter.format(
- # datetime.utcnow())}
- status.mapping = {'date_time': str(datetime.utcnow())}
+ #formatter = self.request.locale.dates.getFormatter(
+ # 'dateTime', 'medium')
+ #status = _("Updated on ${date_time}",
+ # mapping={'date_time':
+ # formatter.format(datetime.utcnow())})
+ status = _("Updated on ${date_time}",
+ mapping={'date_time': str(datetime.utcnow())})
self.update_status = status
return status
@@ -249,9 +250,3 @@
def nextURL(self):
return self.context.nextURL()
-
-
-# BBB: Will be removed in future versions
-from Products.Five import browser
-browser.AddView = AddView
-browser.EditView = EditView
Modified: Zope/trunk/lib/python/Products/Five/form/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/metaconfigure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/metaconfigure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,28 +13,29 @@
##############################################################################
"""Edit form directives
-$Id: metaconfigure.py 12884 2005-05-30 13:10:41Z philikon $
+$Id: metaconfigure.py 19283 2005-10-31 17:43:51Z philikon $
"""
import ExtensionClass
+from Globals import InitializeClass as initializeClass
-from zope.component import getGlobalService
-from zope.component.servicenames import Presentation
+from zope.interface import Interface
from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.app.publisher.browser.globalbrowsermenuservice import \
- menuItemDirective
+
+from zope.app import zapi
+from zope.app.publisher.browser.menumeta import menuItemDirective
from zope.app.form.browser.metaconfigure import BaseFormDirective
from zope.app.container.interfaces import IAdding
+from zope.app.i18n import ZopeMessageFactory as _
from Products.Five.form import EditView, AddView
from Products.Five.metaclass import makeClass
-from Products.Five.security import protectClass, initializeClass
+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''):
- s = getGlobalService(Presentation)
class_ = makeClassForTemplate(template, globals(), used_for=schema,
bases=bases)
class_.schema = schema
@@ -49,8 +50,15 @@
class_.generated_form = ZopeTwoPageTemplateFile(default_template)
+ if layer is None:
+ layer = IDefaultBrowserLayer
- s.provideView(for_, name, IBrowserRequest, class_, layer)
+ s = zapi.getGlobalSiteManager()
+ s.provideAdapter((for_, layer), Interface, name, class_)
+
+ # 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_)
@@ -58,20 +66,22 @@
def _processWidgets(self):
if self._widgets:
- customWidgetsObject = makeClass('CustomWidgetsMixin', (ExtensionClass.Base,), self._widgets)
+ customWidgetsObject = makeClass(
+ 'CustomWidgetsMixin', (ExtensionClass.Base,), self._widgets)
self.bases = self.bases + (customWidgetsObject,)
class EditFormDirective(FiveFormDirective):
view = EditView
default_template = 'edit.pt'
- title = 'Edit'
+ 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)
+ '@@' + self.name, self.title, permission=self.permission,
+ layer=self.layer)
def __call__(self):
self._processWidgets()
@@ -89,8 +99,6 @@
fields, content_factory, arguments,
keyword_arguments, set_before_add, set_after_add,
menu=u''):
-
- s = getGlobalService(Presentation)
class_ = makeClassForTemplate(template, globals(), used_for=schema,
bases=bases)
@@ -105,7 +113,15 @@
class_.generated_form = ZopeTwoPageTemplateFile(default_template)
- s.provideView(for_, name, IBrowserRequest, class_, layer)
+ if layer is None:
+ layer = IDefaultBrowserLayer
+
+ s = zapi.getGlobalSiteManager()
+ s.provideAdapter((for_, layer), Interface, name, class_)
+
+ # 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_)
@@ -132,7 +148,7 @@
# for=self.schema.
menuItemDirective(
self._context, self.menu, self.for_, '@@' + self.name,
- self.title, permission=self.permission,
+ self.title, permission=self.permission, layer=self.layer,
description=self.description)
def _handle_arguments(self, leftover=None):
Copied: Zope/trunk/lib/python/Products/Five/form/objectwidget.pt (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/form/objectwidget.pt)
Copied: Zope/trunk/lib/python/Products/Five/form/objectwidget.py (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/form/objectwidget.py)
Modified: Zope/trunk/lib/python/Products/Five/form/tests/configure.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/tests/configure.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/tests/configure.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -34,7 +34,7 @@
type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.schema.interfaces.IObject"
provides="zope.app.form.interfaces.IInputWidget"
- factory="zope.app.form.browser.objectwidget.ObjectWidget"
+ factory="Products.Five.form.objectwidget.ObjectWidget"
permission="zope.Public"
/>
Modified: Zope/trunk/lib/python/Products/Five/form/tests/forms.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/tests/forms.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/tests/forms.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,7 +17,7 @@
Finally, we need to setup a traversable folder. Otherwise, Five won't
get to to do its view lookup:
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'ftf')
@@ -47,9 +47,10 @@
>>> print http(r"""
... GET /test_folder_1_/ftf/+/protectedaddform.html HTTP/1.1
- ... """, handle_errors=True)
- HTTP/1.1 401 Unauthorized
+ ... """, handle_errors=False)
+ Traceback (most recent call last):
...
+ Unauthorized: ...
Now let's add a piece of our sample content object to test more things
on it:
@@ -372,7 +373,11 @@
... -----------------------------968064918930967154199105236
... Content-Disposition: form-data; name="field.somelist.add"
...
- ... Add
+ ... Add Some item
+ ... -----------------------------968064918930967154199105236
+ ... Content-Disposition: form-data; name="field.somelist.count"
+ ...
+ ... 0
... -----------------------------968064918930967154199105236--
... """ % (wo_hen_hao, ni_hao), handle_errors=False)
HTTP/1.1 200 OK
@@ -408,6 +413,10 @@
...
... %s
... -----------------------------968064918930967154199105236
+ ... Content-Disposition: form-data; name="field.somelist.count"
+ ...
+ ... 1
+ ... -----------------------------968064918930967154199105236
... Content-Disposition: form-data; name="UPDATE_SUBMIT"
...
... Change
@@ -572,5 +581,5 @@
Finally, we need to clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/form/tests/schemacontent.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/tests/schemacontent.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/tests/schemacontent.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -18,13 +18,13 @@
from OFS.SimpleItem import SimpleItem
from Globals import InitializeClass
-from zope.i18nmessageid import MessageIDFactory
+from zope.i18nmessageid import MessageFactory
from zope.interface import implements, Interface
from zope.schema import TextLine, Text, Object, Int, List
from zope.app.form import CustomWidgetFactory
-from zope.app.form.browser import ObjectWidget
+from Products.Five.form.objectwidget import ObjectWidget
-_ = MessageIDFactory('formtest')
+_ = MessageFactory('formtest')
class IFieldContent(Interface):
Modified: Zope/trunk/lib/python/Products/Five/form/tests/test_forms.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/form/tests/test_forms.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/form/tests/test_forms.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -46,25 +46,26 @@
>>> from zope.app.form.browser.textwidgets import TextWidget
>>> from zope.app.form.browser.itemswidgets import DropdownWidget
- >>> view1 = zapi.getViewProviding(contactname, IInputWidget, request)
+ >>> view1 = zapi.getMultiAdapter((contactname, request), IInputWidget)
>>> view1.__class__ == TextWidget
True
- >>> view2 = zapi.getViewProviding(salutation, IInputWidget, request)
+ >>> view2 = zapi.getMultiAdapter((salutation, request), IInputWidget)
>>> view2.__class__ == DropdownWidget
True
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
def test_suite():
import unittest
- from Testing.ZopeTestCase import ZopeDocTestSuite, FunctionalDocFileSuite
+ from zope.testing.doctest import DocTestSuite
+ from Testing.ZopeTestCase import FunctionalDocFileSuite
return unittest.TestSuite((
- ZopeDocTestSuite(),
+ DocTestSuite(),
FunctionalDocFileSuite('forms.txt',
package="Products.Five.form.tests",),
))
Modified: Zope/trunk/lib/python/Products/Five/i18n.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/i18n.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/i18n.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,15 +13,21 @@
##############################################################################
"""Mimick Zope3 i18n machinery for Zope 2
-$Id: i18n.py 14400 2005-07-07 17:55:08Z philikon $
+$Id: i18n.py 19435 2005-11-02 16:34:58Z philikon $
"""
+from Acquisition import aq_acquire
from zope.interface import implements
from zope.i18n import interpolate
from zope.i18n.interfaces import ITranslationDomain, IUserPreferredLanguages
-from zope.i18nmessageid import MessageID
from zope.app import zapi
from zope.publisher.browser import BrowserLanguages
+# BBB 2005/10/10 -- MessageIDs are to be removed for Zope 3.3
+import zope.deprecation
+zope.deprecation.__show__.off()
+from zope.i18nmessageid import MessageID, Message
+zope.deprecation.__show__.on()
+
class FiveTranslationService:
"""Translation service that delegates to ``zope.i18n`` machinery.
"""
@@ -29,7 +35,7 @@
# regarding fallback and Zope 2 compatability
def translate(self, domain, msgid, mapping=None,
context=None, target_language=None, default=None):
- if isinstance(msgid, MessageID):
+ if isinstance(msgid, (Message, MessageID)):
domain = msgid.domain
default = msgid.default
mapping = msgid.mapping
@@ -46,7 +52,7 @@
# in Zope3, context is adapted to IUserPreferredLanguages,
# which means context should be the request in this case.
if context is not None:
- context = context.REQUEST
+ context = aq_acquire(context, 'REQUEST', None)
return util.translate(msgid, mapping=mapping, context=context,
target_language=target_language, default=default)
Modified: Zope/trunk/lib/python/Products/Five/interfaces.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/interfaces.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/interfaces.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,7 +13,7 @@
##############################################################################
"""Five interfaces
-$Id: interfaces.py 14613 2005-07-13 10:39:05Z philikon $
+$Id: interfaces.py 19283 2005-10-31 17:43:51Z philikon $
"""
from zope.interface import Interface
from zope.interface.interfaces import IInterface
@@ -33,23 +33,3 @@
Menu item types are interfaces that define classes of
menu items.
"""
-
-
-#
-# BBB: Zope core interfaces
-#
-# The interfaces here are only provided for backwards compatibility and will
-# be removed in Five 1.2. Please import interfaces from the corresponding Zope
-# package instead.
-#
-
-from persistent.interfaces import IPersistent
-from AccessControl.interfaces import *
-from Acquisition.interfaces import *
-from App.interfaces import *
-from OFS.interfaces import *
-from webdav.interfaces import *
-
-# BBB: for old names used in Five 1.0
-IAcquisition = IAcquirer
-IPermissionMapping = IPermissionMappingSupport
Deleted: Zope/trunk/lib/python/Products/Five/interfaces.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/interfaces.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/interfaces.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,140 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/five">
-
- <!-- IPersistent, IPersistentExtra -->
-
- <!-- Acquisition -->
-
- <implements
- class="Acquisition.ImplicitAcquisitionWrapper"
- interface="Acquisition.interfaces.IAcquisitionWrapper"
- />
-
- <implements
- class="Acquisition.ExplicitAcquisitionWrapper"
- interface="Acquisition.interfaces.IAcquisitionWrapper"
- />
-
- <implements
- class="Acquisition.Implicit"
- interface="Acquisition.interfaces.IAcquirer"
- />
-
- <implements
- class="Acquisition.Explicit"
- interface="Acquisition.interfaces.IAcquirer"
- />
-
- <!-- DAV -->
-
- <implements
- class="webdav.Lockable.LockableItem"
- interface="webdav.interfaces.IWriteLock"
- />
-
- <implements
- class="webdav.Resource.Resource"
- interface="webdav.interfaces.IDAVResource"
- />
-
- <implements
- class="webdav.Collection.Collection"
- interface="webdav.interfaces.IDAVCollection"
- />
-
- <!-- OFS -->
-
- <implements
- class="OFS.CopySupport.CopySource"
- interface="OFS.interfaces.ICopySource"
- />
-
- <implements
- class="OFS.CopySupport.CopyContainer"
- interface="OFS.interfaces.ICopyContainer"
- />
-
- <implements
- class="OFS.Traversable.Traversable"
- interface="OFS.interfaces.ITraversable"
- />
-
- <implements
- class="OFS.SimpleItem.Item"
- interface="OFS.interfaces.IItem"
- />
-
- <implements
- class="OFS.SimpleItem.Item_w__name__"
- interface="OFS.interfaces.IItemWithName"
- />
-
- <implements
- class="OFS.SimpleItem.SimpleItem"
- interface="OFS.interfaces.ISimpleItem"
- />
-
- <implements
- class="OFS.ObjectManager.ObjectManager"
- interface="OFS.interfaces.IObjectManager"
- />
-
- <implements
- class="OFS.PropertyManager.PropertyManager"
- interface="OFS.interfaces.IPropertyManager"
- />
-
- <implements
- class="OFS.FindSupport.FindSupport"
- interface="OFS.interfaces.IFindSupport"
- />
-
- <implements
- class="OFS.Folder.Folder"
- interface="OFS.interfaces.IFolder"
- />
-
- <implements
- class="OFS.OrderSupport.OrderSupport"
- interface="OFS.interfaces.IOrderedContainer"
- />
-
- <implements
- class="OFS.OrderedFolder.OrderedFolder"
- interface="OFS.interfaces.IOrderedFolder"
- />
-
- <implements
- class="OFS.Application.Application"
- interface="OFS.interfaces.IApplication"
- />
-
- <!-- App -->
-
- <implements
- class="App.Undo.UndoSupport"
- interface="App.interfaces.IUndoSupport"
- />
-
- <implements
- class="App.Management.Navigation"
- interface="App.interfaces.INavigation"
- />
-
- <!-- AccessControl -->
-
- <implements
- class="AccessControl.Owned.Owned"
- interface="AccessControl.interfaces.IOwned"
- />
-
- <implements
- class="AccessControl.PermissionMapping.RoleManager"
- interface="AccessControl.interfaces.IPermissionMappingSupport"
- />
-
- <implements
- class="AccessControl.Role.RoleManager"
- interface="AccessControl.interfaces.IRoleManager"
- />
-
-</configure>
Modified: Zope/trunk/lib/python/Products/Five/meta.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/meta.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/meta.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -2,13 +2,10 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
+ <include package=".site" file="meta.zcml" />
<include package=".browser" file="meta.zcml" />
<include package=".form" file="meta.zcml" />
- <!-- load the zope:modulealias and zope:hook directives -->
- <include package="zope.modulealias" file="meta.zcml" />
- <include package="zope.configuration" file="meta.zcml" />
-
<meta:directives namespace="http://namespaces.zope.org/zope">
<meta:directive
@@ -53,18 +50,6 @@
handler="zope.app.component.metaconfigure.factory"
/>
- <meta:directive
- name="serviceType"
- schema="zope.app.component.metadirectives.IServiceTypeDirective"
- handler="zope.app.component.metaconfigure.serviceType"
- />
-
- <meta:directive
- name="service"
- schema="zope.app.component.metadirectives.IServiceDirective"
- handler="zope.app.component.metaconfigure.service"
- />
-
<meta:complexDirective
name="content"
schema="zope.app.component.metadirectives.IClassDirective"
@@ -131,14 +116,20 @@
/>
<meta:directive
- name="sendEvents"
- schema=".fivedirectives.ISendEventsDirective"
- handler=".eventconfigure.sendEvents"
+ name="containerEvents"
+ schema=".fivedirectives.IContainerEventsDirective"
+ handler=".eventconfigure.containerEvents"
/>
<meta:directive
+ name="deprecatedManageAddDelete"
+ schema=".fivedirectives.IDeprecatedManageAddDeleteDirective"
+ handler=".eventconfigure.deprecatedManageAddDelete"
+ />
+
+ <meta:directive
name="sizable"
- schema=".fivedirectives.ISendEventsDirective"
+ schema=".fivedirectives.ISizableDirective"
handler=".sizeconfigure.sizable"
/>
@@ -148,20 +139,18 @@
handler=".fiveconfigure.pagesFromDirectory"
/>
- <!-- viewable is deprecated, use traversable instead -->
-
<meta:directive
- name="viewable"
- schema=".fivedirectives.ITraversableDirective"
- handler=".fiveconfigure.viewable"
- />
-
- <meta:directive
name="bridge"
schema=".fivedirectives.IBridgeDirective"
handler=".fiveconfigure.bridge"
/>
+ <meta:directive
+ name="registerClass"
+ schema=".fivedirectives.IRegisterClassDirective"
+ handler=".fiveconfigure.registerClass"
+ />
+
</meta:directives>
<meta:directive
@@ -171,6 +160,9 @@
handler="zope.app.security.metaconfigure.redefinePermission"
/>
+ <!-- load the zope:modulealias directive -->
+ <include package="zope.modulealias" file="meta.zcml" />
+
<!-- load the i18n:registerTranslations directive -->
<include package="zope.app.i18n" file="meta.zcml" />
Modified: Zope/trunk/lib/python/Products/Five/metaconfigure.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/metaconfigure.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/metaconfigure.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,73 +13,25 @@
##############################################################################
"""Generic Components ZCML Handlers
-$Id: metaconfigure.py 12884 2005-05-30 13:10:41Z philikon $
+$Id: metaconfigure.py 19283 2005-10-31 17:43:51Z philikon $
"""
-from types import ModuleType
+from Products.Five.security import CheckerPublic, protectName
+from Globals import InitializeClass as initializeClass
-from zope.interface import classImplements
-from zope.configuration.exceptions import ConfigurationError
+from zope.app.component.contentdirective import ContentDirective as \
+ zope_app_ContentDirective
-from security import CheckerPublic
-from security import protectName, initializeClass
-
-class ContentDirective:
-
- def __init__(self, _context, class_):
- self.__class = class_
- if isinstance(self.__class, ModuleType):
- raise ConfigurationError('Content class attribute must be a class')
- self.__context = _context
-
- def implements(self, _context, interface):
- for interface in interface:
- _context.action(
- discriminator = (
- 'five::directive:content', self.__class, object()),
- callable = classImplements,
- args = (self.__class, interface),
- )
- interface(_context, interface)
-
- def require(self, _context, permission=None,
- attributes=None, interface=None):
- """Require a the permission to access a specific aspect"""
-
- if not (interface or attributes):
- raise ConfigurationError("Nothing required")
-
- if interface:
- for i in interface:
- if i:
- self.__protectByInterface(i, permission)
- if attributes:
- self.__protectNames(attributes, permission)
-
- def allow(self, _context, attributes=None, interface=None):
- """Like require, but with permission_id zope.Public"""
- return self.require(_context, CheckerPublic, attributes, interface)
-
- def __protectByInterface(self, interface, permission_id):
- "Set a permission on names in an interface."
- for n, d in interface.namesAndDescriptions(1):
- self.__protectName(n, permission_id)
- interface(self.__context, interface)
-
+class ContentDirective(zope_app_ContentDirective):
+
def __protectName(self, name, permission_id):
- "Set a permission on a particular name."
self.__context.action(
discriminator = ('five:protectName', self.__class, name),
callable = protectName,
args = (self.__class, name, permission_id)
)
- def __protectNames(self, names, permission_id):
- "Set a permission on a bunch of names."
- for name in names:
- self.__protectName(name, permission_id)
-
def __call__(self):
- "Handle empty/simple declaration."
+ """Handle empty/simple declaration."""
return self.__context.action(
discriminator = ('five:initialize:class', self.__class),
callable = initializeClass,
Modified: Zope/trunk/lib/python/Products/Five/permissions.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/permissions.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/permissions.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,6 +1,11 @@
<configure xmlns="http://namespaces.zope.org/zope"
i18n_domain="Five">
+ <permission
+ id="five.ManageSite"
+ title="Manage Five local sites"
+ />
+
<!-- Give common Zope2 and CMF permissions a permission ID
The title of the permission is what Zope 2 knows it under -->
Modified: Zope/trunk/lib/python/Products/Five/security.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/security.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/security.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -24,7 +24,7 @@
from zope.app import zapi
from AccessControl import ClassSecurityInfo, getSecurityManager
-from Globals import InitializeClass
+from Globals import InitializeClass as initializeClass
from types import StringTypes
CheckerPublicId = 'zope.Public'
@@ -99,9 +99,6 @@
if getattr(thread_local, 'interaction', None) is None:
thread_local.interaction = FiveSecurityPolicy()
-def initializeClass(klass):
- InitializeClass(klass)
-
def _getSecurity(klass):
# a Zope 2 class can contain some attribute that is an instance
# of ClassSecurityInfo. Zope 2 scans through things looking for
@@ -121,15 +118,12 @@
"""Protect the attribute 'name' on 'klass' using the given
permission"""
security = _getSecurity(klass)
- # XXX: Sometimes, the object CheckerPublic is used instead of the
- # string zope.Public. I haven't ben able to figure out why, or if
- # it is correct, or a bug. So this is a workaround.
- if permission_id is CheckerPublic:
- security.declarePublic(name)
- return
# Zope 2 uses string, not unicode yet
name = str(name)
- if permission_id == CheckerPublicId:
+ if permission_id == CheckerPublicId or permission_id is CheckerPublic:
+ # Sometimes, we already get a processed permission id, which
+ # can mean that 'zope.Public' has been interchanged for the
+ # CheckerPublic object
security.declarePublic(name)
elif permission_id == CheckerPrivateId:
security.declarePrivate(name)
@@ -142,7 +136,10 @@
def protectClass(klass, permission_id):
"""Protect the whole class with the given permission"""
security = _getSecurity(klass)
- if permission_id == CheckerPublicId:
+ if permission_id == CheckerPublicId or permission_id is CheckerPublic:
+ # Sometimes, we already get a processed permission id, which
+ # can mean that 'zope.Public' has been interchanged for the
+ # CheckerPublic object
security.declareObjectPublic()
elif permission_id == CheckerPrivateId:
security.declareObjectPrivate()
Deleted: Zope/trunk/lib/python/Products/Five/services.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/services.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/services.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,27 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope">
-
- <serviceType
- id="Utilities"
- interface="zope.component.interfaces.IUtilityService" />
-
- <service
- serviceType="Utilities"
- factory="zope.component.utility.GlobalUtilityService" />
-
- <serviceType
- id="Adapters"
- interface="zope.component.interfaces.IAdapterService" />
-
- <service
- serviceType="Adapters"
- factory="zope.component.adapter.GlobalAdapterService" />
-
- <serviceType
- id="Presentation"
- interface="zope.component.interfaces.IPresentationService" />
-
- <service
- serviceType="Presentation"
- factory="zope.component.presentation.GlobalPresentationService" />
-
-</configure>
Copied: Zope/trunk/lib/python/Products/Five/site (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/site)
Modified: Zope/trunk/lib/python/Products/Five/skin/standardmacros.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/skin/standardmacros.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/skin/standardmacros.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,17 +13,17 @@
##############################################################################
"""Mimick the Zope 3 skinning system in Five.
-$Id: standardmacros.py 12884 2005-05-30 13:10:41Z philikon $
+$Id: standardmacros.py 19283 2005-10-31 17:43:51Z philikon $
"""
-from zope.interface.common.mapping import IItemMapping
-from zope.interface import implements
-from zope.component import getView
+import zope.interface
+
+from zope.app import zapi
from Products.Five.browser import BrowserView
# this is a verbatim copy of zope.app.basicskin except that it doesn't
# derive from ``object``
class Macros:
- implements(IItemMapping)
+ zope.interface.implements(zope.interface.common.mapping.IItemMapping)
macro_pages = ()
aliases = {
@@ -37,7 +37,7 @@
context = self.context
request = self.request
for name in self.macro_pages:
- page = getView(context, name, request)
+ page = zapi.getMultiAdapter((context, request), name=name)
try:
v = page[key]
except KeyError:
Modified: Zope/trunk/lib/python/Products/Five/skin/tests/test_standardmacros.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/skin/tests/test_standardmacros.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/skin/tests/test_standardmacros.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -26,7 +26,7 @@
>>> uf._doAddUser('manager', 'r00t', ['Manager'], [])
>>> self.login('manager')
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
>>> manage_addFiveTraversableFolder(self.folder, 'testoid', 'Testoid')
>>> import Products.Five.skin.tests
@@ -72,7 +72,7 @@
Clean up:
- >>> from zope.app.tests.placelesssetup import tearDown
+ >>> from zope.app.testing.placelesssetup import tearDown
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/tests/README.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/README.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/README.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,16 +1,8 @@
Five tests
==========
-The tests require ZopeTestCase to be installed. ZopeTestCase can be
-downloaded from here:
+All you have to do is type::
-http://zope.org/Members/shh/ZopeTestCase
+ $ bin/zopectl test -s Products.Five
-it needs to be installed in your Zope software's lib/python/Testing
-directory.
-
-Then, if you have Zope 2.7.3 or better all you have to do is type::
-
- ./bin/zopectl test --dir Products/Five
-
-to run the Five tests.
+to run the Five tests.
Modified: Zope/trunk/lib/python/Products/Five/tests/boilerplate.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/boilerplate.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/boilerplate.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -21,16 +21,16 @@
def test_boilerplate():
"""
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> import Products.Five.tests
>>> from Products.Five import zcml
>>> zcml.load_config('boilerplate.zcml', Products.Five.tests)
- >>> from Products.Five.testing import manage_addFiveTraversableFolder
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
- >>> from Products.Five.testing.fancycontent import manage_addFancyContent
+ >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.fancycontent import manage_addFancyContent
>>> tearDown()
"""
Modified: Zope/trunk/lib/python/Products/Five/tests/directives.zcml
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/directives.zcml 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/directives.zcml 2005-11-02 18:34:38 UTC (rev 39848)
@@ -11,17 +11,17 @@
once on a class; SimpleContent inherits from Traversable, so
one directive suffices here -->
- <five:traversable class="Products.Five.testing.simplecontent.SimpleContent" />
+ <five:traversable class="Products.Five.tests.testing.simplecontent.SimpleContent" />
<!-- this is a test whether the *directive* can be called more than
once without raising a conflicting configuration exception -->
- <five:traversable class="Products.Five.testing.simplecontent.SimpleContent" />
+ <five:traversable class="Products.Five.tests.testing.simplecontent.SimpleContent" />
<!-- this tests whether five:traversable can be called on a class that
already provides __bobo_traverse__, such as our FancyContent -->
- <five:traversable class="Products.Five.testing.fancycontent.FancyContent" />
+ <five:traversable class="Products.Five.tests.testing.fancycontent.FancyContent" />
<!-- Testing the vocabulary directive -->
Modified: Zope/trunk/lib/python/Products/Five/tests/event.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/event.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/event.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,295 +1,394 @@
-Test events
-===========
+================
+Container events
+================
-Before we can start, we need to set up an event subscriber that allows
-us to inspect events that will be thrown during the test:
+Zope 3 container events are used to inform subscribers that an object is
+about to be added/removed from a container, and also after it has been
+done. This is used for bookkeeping and cleaning up in subobjects.
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
- >>> setUp()
+These events replace the old Zope 2 manage_afterAdd, manage_beforeDelete
+and manage_afterClone methods.
-Add a folder that doesn't verify objects on paste. We use it as a
-test sandbox:
+All standard Zope containers will only call manage_afterAdd & co on
+classes specified with the directive::
- >>> from Products.Five.testing import manage_addNoVerifyPasteFolder
- >>> manage_addNoVerifyPasteFolder(self.folder, 'npvf')
- >>> folder = self.folder.npvf
+ <five:deprecatedManageAddDelete class="some.content.class"/>
-Finally add a manager user login, give it the right permissions and
-log in using it:
+Classes that don't have this directive but still have manage_afterAdd &
+co methods will trigger a warning when they are called (and this is
+strictly a compatibility call, behavior may not be strictly equivalent
+to the original one).
- >>> uf = self.folder.acl_users
- >>> uf._doAddUser('manager', 'r00t', ['Manager'], [])
- >>> self.setPermissions(standard_permissions + ['Copy or Move'], 'Manager')
- >>> self.login('manager')
+Test setup
+==========
- >>> from zope.app.event.tests.placelesssetup import getEvents, clearEvents
+A bit of setup for the tests. Because we'll test copy/paste, we need to
+work inside a database::
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
+ >>> setUp()
-Sending events
---------------
+ >>> import ZODB.tests.util
+ >>> db = ZODB.tests.util.DB()
+ >>> connection = db.open()
+ >>> root = connection.root()
-Zope 2 classes need to be modified so that they send Zope 3 style
-events. Our stub class here is such a case. We can add it to a
-folder, for example, ...
+We'll use a few simple classes (defined in python code for picklability)
+for our tests.
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
- >>> manage_addSimpleContent(folder, 'foo', 'Foo')
+ >>> from Products.Five.tests.test_event import MyApp, MyContent
+ >>> from Products.Five.tests.test_event import MyFolder, MyBTreeFolder
+ >>> from Products.Five.tests.test_event import MyOrderedFolder
-and no event will have been triggered:
+ >>> app = MyApp('')
+ >>> root['app'] = app
+ >>> folder = MyFolder('folder')
+ >>> app._setObject('folder', folder) # doctest: +NORMALIZE_WHITESPACE
+ old manage_afterAdd folder folder
+ 'folder'
+ >>> folder = app.folder
+ >>> btfolder = MyBTreeFolder('btfolder')
+ >>> app._setObject('btfolder', btfolder) # doctest: +NORMALIZE_WHITESPACE
+ old manage_afterAdd btfolder btfolder
+ 'btfolder'
- >>> len(getEvents())
- 0
+To observe what object events are dispatched, we'll have some
+subscribers print them. We'll actually do that for a specific interface,
+not for (None, IObjectEvent), and register our subscribers before the
+framework's ones, so ours will be called first. This has the effect that
+printed events will be in their "natural" order::
-Clean up:
+ >>> from zope.app.event.interfaces import IObjectEvent
+ >>> from zope.app.container.interfaces import IObjectMovedEvent
+ >>> from OFS.interfaces import IObjectWillBeMovedEvent
+ >>> from OFS.interfaces import IObjectClonedEvent
+ >>> from OFS.interfaces import IItem
+ >>> def printObjectEvent(object, event):
+ ... print event.__class__.__name__, object.getId()
+ >>> def printObjectEventExceptSome(object, event):
+ ... if (IObjectMovedEvent.providedBy(event) or
+ ... IObjectWillBeMovedEvent.providedBy(event) or
+ ... IObjectClonedEvent.providedBy(event)):
+ ... return
+ ... print event.__class__.__name__, object.getId()
- >>> folder.manage_delObjects(['foo'])
+ >>> from zope.component import provideHandler
+ >>> provideHandler(printObjectEvent, (IItem, IObjectMovedEvent))
+ >>> provideHandler(printObjectEvent, (IItem, IObjectWillBeMovedEvent))
+ >>> provideHandler(printObjectEvent, (IItem, IObjectClonedEvent))
+ >>> provideHandler(printObjectEventExceptSome, (None, IObjectEvent))
-Now make the class send events:
+Finally we need to load the subscribers configuration::
- >>> from Products.Five.eventconfigure import classSendEvents
- >>> from Products.Five.testing.simplecontent import SimpleContent
- >>> classSendEvents(SimpleContent)
+ >>> from Products.Five import zcml
+ >>> import Products.Five
+ >>> import zope.app.component
+ >>> zcml.load_config('meta.zcml', zope.app.component)
+ >>> zcml.load_config('event.zcml', Products.Five)
+Old class
+=========
-Added event
-------------
+If we use an instance of an old class for which we haven't specified
+anything, events are sent and the manage_afterAdd & co methods are
+called but in a "compatibility" way.
-Let's add an object to a folder:
+Because the bases classes of Zope have been changed to not recurse
+except through the event framework, unexpected behavior may happen
+(however a warning will be sent)::
- >>> manage_addSimpleContent(folder, 'foo', 'Foo')
+ >>> ob = MyContent('dog')
+ >>> folder._setObject('dog', ob)
+ ObjectWillBeAddedEvent dog
+ ObjectAddedEvent dog
+ old manage_afterAdd dog dog folder
+ 'dog'
-One object event should have been sent with the event's object being
-our foo object:
+And when we delete the object, manage_beforeDelete is also called and
+events are sent::
- >>> events = getEvents()
- >>> len(events)
- 1
- >>> foo = folder.foo
- >>> events[0].object == foo
- True
+ >>> folder.manage_delObjects('dog')
+ old manage_beforeDelete dog dog folder
+ ObjectWillBeRemovedEvent dog
+ ObjectRemovedEvent dog
-That object event should have been an object added event:
+Old class with deprecatedManageAddDelete
+========================================
- >>> from zope.app.container.interfaces import IObjectAddedEvent
- >>> events = getEvents(IObjectAddedEvent)
- >>> len(events)
- 1
- >>> events[0].object == foo
- True
- >>> events[0].newParent == foo.aq_parent
- True
+We specifiy that our class is deprecated (using zcml in real life)::
-Check that the object's original manage_afterAdd method was also called:
+ >>> from Products.Five.eventconfigure import setDeprecatedManageAddDelete
+ >>> setDeprecatedManageAddDelete(MyContent)
+ >>> setDeprecatedManageAddDelete(MyFolder)
+ >>> setDeprecatedManageAddDelete(MyOrderedFolder)
- >>> foo.afterAdd_called
- True
+Now some events are sent but the old manage_afterAdd method is also
+called correctly::
-Now clean up:
+ >>> ob = MyContent('lassie')
+ >>> folder._setObject('lassie', ob)
+ ObjectWillBeAddedEvent lassie
+ ObjectAddedEvent lassie
+ old manage_afterAdd lassie lassie folder
+ 'lassie'
- >>> clearEvents()
+And when we delete the object, manage_beforeDelete is also called and
+events are sent::
+ >>> folder.manage_delObjects('lassie')
+ ObjectWillBeRemovedEvent lassie
+ old manage_beforeDelete lassie lassie folder
+ ObjectRemovedEvent lassie
-Moved event (I) -- Renaming
---------------------------
+The old behavior happens for a move or a copy, with events too.
+For a move::
-Somehow we need to at least commit a subtransaction to make renaming
-succeed:
+ >>> ob = MyContent('blueberry')
+ >>> folder._setObject('blueberry', ob)
+ ObjectWillBeAddedEvent blueberry
+ ObjectAddedEvent blueberry
+ old manage_afterAdd blueberry blueberry folder
+ 'blueberry'
+ >>> cp = folder.manage_cutObjects('blueberry')
+ >>> folder.manage_pasteObjects(cp)
+ ObjectWillBeMovedEvent blueberry
+ old manage_beforeDelete blueberry blueberry folder
+ ObjectMovedEvent blueberry
+ old manage_afterAdd blueberry blueberry folder
+ [{'new_id': 'blueberry', 'id': 'blueberry'}]
- >>> import transaction
- >>> transaction.commit(1)
+Old behavior with events for a copy::
-Let's rename the object we created before:
+ >>> cp = folder.manage_copyObjects('blueberry')
+ >>> folder.manage_pasteObjects(cp)
+ ObjectCopiedEvent copy_of_blueberry
+ ObjectWillBeAddedEvent copy_of_blueberry
+ ObjectAddedEvent copy_of_blueberry
+ old manage_afterAdd copy_of_blueberry copy_of_blueberry folder
+ ObjectClonedEvent copy_of_blueberry
+ old manage_afterClone copy_of_blueberry copy_of_blueberry
+ [{'new_id': 'copy_of_blueberry', 'id': 'blueberry'}]
- >>> folder.manage_renameObject('foo', 'bar')
+Old behavior with events for a renaming::
-We should get two events...
+ >>> folder.manage_renameObject('copy_of_blueberry', 'myrtille')
+ ObjectWillBeMovedEvent copy_of_blueberry
+ old manage_beforeDelete copy_of_blueberry copy_of_blueberry folder
+ ObjectMovedEvent myrtille
+ old manage_afterAdd myrtille myrtille folder
- >>> events = getEvents()
- >>> len(events)
- 2
+Old behavior with events for a clone::
-the removed event...
+ >>> res = folder.manage_clone(folder.blueberry, 'strawberry')
+ ObjectCopiedEvent strawberry
+ ObjectWillBeAddedEvent strawberry
+ ObjectAddedEvent strawberry
+ old manage_afterAdd strawberry strawberry folder
+ ObjectClonedEvent strawberry
+ old manage_afterClone strawberry strawberry
+ >>> res.getId()
+ 'strawberry'
- >>> event = events[0]
- >>> from zope.app.container.interfaces import IObjectRemovedEvent
- >>> IObjectRemovedEvent.providedBy(event)
- True
- >>> event.object == foo
- True
- >>> event.oldName, event.newName
- ('foo', None)
- >>> event.oldParent == folder
- True
- >>> event.newParent is None
- True
+Events are also sent when we work with a BTreeFolder::
-and the moved event:
+ >>> ob = MyContent('luckyluke')
+ >>> btfolder._setObject('luckyluke', ob)
+ ObjectWillBeAddedEvent luckyluke
+ ObjectAddedEvent luckyluke
+ old manage_afterAdd luckyluke luckyluke btfolder
+ 'luckyluke'
- >>> event = events[1]
- >>> event.object == foo
- True
- >>> event.oldName, event.newName
- ('foo', 'bar')
- >>> event.oldParent == folder
- True
- >>> event.newParent == folder
- True
+ >>> btfolder.manage_delObjects('luckyluke')
+ ObjectWillBeRemovedEvent luckyluke
+ old manage_beforeDelete luckyluke luckyluke btfolder
+ ObjectRemovedEvent luckyluke
-Now clean up:
+Here is what happens for a tree of objects. Let's create a simple one::
- >>> folder.manage_delObjects(['bar'])
- >>> clearEvents()
+ >>> subfolder = MyFolder('subfolder')
+ >>> folder._setObject('subfolder', subfolder)
+ ObjectWillBeAddedEvent subfolder
+ ObjectAddedEvent subfolder
+ old manage_afterAdd subfolder subfolder folder
+ 'subfolder'
+ >>> subfolder = folder.subfolder
+ >>> ob = MyContent('donald')
+ >>> subfolder._setObject('donald', ob)
+ ObjectWillBeAddedEvent donald
+ ObjectAddedEvent donald
+ old manage_afterAdd donald donald subfolder
+ 'donald'
-We don't delete the stub object just yet because it's being used in
-the next part of the test.
+Renaming a tree of objects. Note that manage_beforeDelete is called
+bottom-up::
+ >>> folder.manage_renameObject('subfolder', 'pluto')
+ ObjectWillBeMovedEvent subfolder
+ ObjectWillBeMovedEvent donald
+ old manage_beforeDelete donald subfolder folder
+ old manage_beforeDelete subfolder subfolder folder
+ ObjectMovedEvent pluto
+ old manage_afterAdd pluto pluto folder
+ ObjectMovedEvent donald
+ old manage_afterAdd donald pluto folder
-Moved event (II) -- Cut and paste
----------------------------------
+Cloning a tree of objects::
-Let's move from one folder to another:
+ >>> res = folder.manage_clone(folder.pluto, 'mickey')
+ ObjectCopiedEvent mickey
+ ObjectWillBeAddedEvent mickey
+ ObjectWillBeAddedEvent donald
+ ObjectAddedEvent mickey
+ old manage_afterAdd mickey mickey folder
+ ObjectAddedEvent donald
+ old manage_afterAdd donald mickey folder
+ ObjectClonedEvent mickey
+ old manage_afterClone mickey mickey
+ ObjectClonedEvent donald
+ old manage_afterClone donald mickey
+ >>> res.getId()
+ 'mickey'
- >>> manage_addNoVerifyPasteFolder(folder, 'folder1', 'Folder1')
- >>> folder1 = folder.folder1
- >>> manage_addNoVerifyPasteFolder(folder, 'folder2', 'Folder2')
- >>> folder2 = folder.folder2
- >>> manage_addSimpleContent(folder1, 'foo', 'Foo')
- >>> foo = folder1.foo
+New class
+=========
-We need to trigger a subtransaction before cut/paste can work:
+If we use classes that don't have any manage_afterAdd & co method,
+everything happens correctly::
- >>> transaction.commit(1)
- >>> cb = folder1.manage_cutObjects(['foo'])
- >>> info = folder2.manage_pasteObjects(cb)
+ >>> from Products.Five.tests.test_event import MyNewFolder, MyNewContent
+ >>> app = MyApp('')
+ >>> root['app'] = app
+ >>> folder = MyNewFolder('folder')
+ >>> app._setObject('folder', folder)
+ ObjectWillBeAddedEvent folder
+ ObjectAddedEvent folder
+ 'folder'
+ >>> folder = app.folder
-Apart from the added event we triggerred when we added the stub object
-to the folder, we expect two events...
+ >>> ob = MyNewContent('dogbert')
+ >>> folder._setObject('dogbert', ob)
+ ObjectWillBeAddedEvent dogbert
+ ObjectAddedEvent dogbert
+ 'dogbert'
+ >>> folder.manage_delObjects('dogbert')
+ ObjectWillBeRemovedEvent dogbert
+ ObjectRemovedEvent dogbert
- >>> events = getEvents()
- >>> len(events)
- 3
- >>> len(getEvents(IObjectAddedEvent))
- 1
+Now move::
-a removed event...
+ >>> ob = MyNewContent('dilbert')
+ >>> folder._setObject('dilbert', ob)
+ ObjectWillBeAddedEvent dilbert
+ ObjectAddedEvent dilbert
+ 'dilbert'
+ >>> cp = folder.manage_cutObjects('dilbert')
+ >>> folder.manage_pasteObjects(cp)
+ ObjectWillBeMovedEvent dilbert
+ ObjectMovedEvent dilbert
+ [{'new_id': 'dilbert', 'id': 'dilbert'}]
- >>> event = events[1]
- >>> from zope.app.container.interfaces import IObjectRemovedEvent
- >>> IObjectRemovedEvent.providedBy(event)
- True
- >>> event.oldParent == folder1
- True
- >>> event.newParent is None
- True
+And copy::
-and a moved event:
+ >>> cp = folder.manage_copyObjects('dilbert')
+ >>> folder.manage_pasteObjects(cp)
+ ObjectCopiedEvent copy_of_dilbert
+ ObjectWillBeAddedEvent copy_of_dilbert
+ ObjectAddedEvent copy_of_dilbert
+ ObjectClonedEvent copy_of_dilbert
+ [{'new_id': 'copy_of_dilbert', 'id': 'dilbert'}]
- >>> event = events[2]
- >>> event.object == foo
- True
- >>> event.oldName, event.newName
- ('foo', 'foo')
- >>> event.oldParent == folder1
- True
- >>> event.newParent == folder2
- True
+Then rename::
-Now clean up:
+ >>> folder.manage_renameObject('copy_of_dilbert', 'wally')
+ ObjectWillBeMovedEvent copy_of_dilbert
+ ObjectMovedEvent wally
- >>> folder.manage_delObjects(['folder1'])
- >>> folder.manage_delObjects(['folder2'])
- >>> clearEvents()
+Or copy using manage_clone::
+ >>> res = folder.manage_clone(folder.dilbert, 'phb')
+ ObjectCopiedEvent phb
+ ObjectWillBeAddedEvent phb
+ ObjectAddedEvent phb
+ ObjectClonedEvent phb
+ >>> res.getId()
+ 'phb'
-Copied event
-------------
+Also on a BTreeFolder::
- >>> manage_addSimpleContent(folder, 'foo', 'Foo')
- >>> manage_addNoVerifyPasteFolder(folder, 'folder1')
- >>> folder1 = folder.folder1
+ >>> ob = MyNewContent('alice')
+ >>> btfolder._setObject('alice', ob)
+ ObjectWillBeAddedEvent alice
+ ObjectAddedEvent alice
+ 'alice'
+ >>> btfolder.manage_renameObject('alice', 'rabbit')
+ ObjectWillBeMovedEvent alice
+ ObjectMovedEvent rabbit
+ >>> btfolder.manage_delObjects('rabbit')
+ ObjectWillBeRemovedEvent rabbit
+ ObjectRemovedEvent rabbit
-We need to trigger subtransaction before copy/paste can work
+Now for a tree of objects. Let's create a simple one::
- >>> transaction.commit(1)
- >>> cb = folder.manage_copyObjects(['foo'])
- >>> info = folder1.manage_pasteObjects(cb)
- >>> foo = folder1.foo
+ >>> subfolder = MyNewFolder('subfolder')
+ >>> folder._setObject('subfolder', subfolder)
+ ObjectWillBeAddedEvent subfolder
+ ObjectAddedEvent subfolder
+ 'subfolder'
+ >>> subfolder = folder.subfolder
+ >>> ob = MyNewContent('mel')
+ >>> subfolder._setObject('mel', ob)
+ ObjectWillBeAddedEvent mel
+ ObjectAddedEvent mel
+ 'mel'
-Apart from the added event we triggerred when we added the stub object
-to the folder, we expect two events...
+Renaming a tree of objects::
- >>> events = getEvents()
- >>> len(events)
- 3
+ >>> folder.manage_renameObject('subfolder', 'firefly')
+ ObjectWillBeMovedEvent subfolder
+ ObjectWillBeMovedEvent mel
+ ObjectMovedEvent firefly
+ ObjectMovedEvent mel
-a copied event...
+Cloning a tree of objects::
- >>> event = events[1]
- >>> from zope.app.event.interfaces import IObjectCopiedEvent
- >>> IObjectCopiedEvent.providedBy(event)
- True
- >>> events[1].object == foo
- True
+ >>> res = folder.manage_clone(folder.firefly, 'serenity')
+ ObjectCopiedEvent serenity
+ ObjectWillBeAddedEvent serenity
+ ObjectWillBeAddedEvent mel
+ ObjectAddedEvent serenity
+ ObjectAddedEvent mel
+ ObjectClonedEvent serenity
+ ObjectClonedEvent mel
+ >>> res.getId()
+ 'serenity'
-and an added event:
+OrderedFolder has the same renaming behavior than before::
- >>> event = events[2]
- >>> IObjectAddedEvent.providedBy(event)
- True
- >>> event.object == foo
- True
- >>> event.newName
- 'foo'
- >>> event.newParent == folder1
- True
+ >>> ofolder = MyOrderedFolder('ofolder')
+ >>> app._setObject('ofolder', ofolder) # doctest: +NORMALIZE_WHITESPACE
+ ObjectWillBeAddedEvent ofolder
+ ObjectAddedEvent ofolder
+ old manage_afterAdd ofolder ofolder
+ 'ofolder'
+ >>> ob1 = MyNewContent('ob1')
+ >>> ofolder._setObject('ob1', ob1)
+ ObjectWillBeAddedEvent ob1
+ ObjectAddedEvent ob1
+ 'ob1'
+ >>> ob2 = MyNewContent('ob2')
+ >>> ofolder._setObject('ob2', ob2)
+ ObjectWillBeAddedEvent ob2
+ ObjectAddedEvent ob2
+ 'ob2'
+ >>> ofolder.manage_renameObject('ob1', 'ob4')
+ ObjectWillBeMovedEvent ob1
+ ObjectMovedEvent ob4
+ >>> ofolder.objectIds()
+ ['ob4', 'ob2']
-Now clean up:
- >>> folder.manage_delObjects(['folder1'])
- >>> folder.manage_delObjects(['foo'])
- >>> clearEvents()
+Now cleanup::
-
-Removed event
--------------
-
- >>> manage_addSimpleContent(folder, 'foo', 'Foo')
- >>> foo = folder.foo
- >>> foo.beforeDelete_called
- False
- >>> folder.manage_delObjects(['foo'])
-
- >>> events = getEvents()
- >>> len(events)
- 2
-
- >>> events[1].object.id
- 'foo'
-
-Check that the object's original manage_beforeDelete method was also called:
-
- >>> foo.beforeDelete_called
- True
-
- >>> clearEvents()
-
-
-Clean up
---------
-
-Finally, we need to put our stub class back the way it was before we
-monkeyed with it:
-
- >>> from Products.Five.eventconfigure import cleanUp
- >>> cleanUp()
-
-Now adding an object won't trigger an event anymore:
-
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
- >>> manage_addSimpleContent(folder, 'foo', 'Foo')
- >>> len(getEvents())
- 0
-
-Finally, we need to tear down everything else (services, etc.)
-
+ >>> import transaction
+ >>> transaction.abort()
>>> tearDown()
Modified: Zope/trunk/lib/python/Products/Five/tests/test_directives.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_directives.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_directives.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -23,9 +23,6 @@
"""
Test ZCML directives
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
- >>> setUp()
-
There isn't much to test here since the actual directive handlers
are either tested in other, more specific tests, or they're
already tested in Zope 3. We'll just do a symbolic test of
@@ -62,9 +59,10 @@
>>> dest.method()
'Overridden'
- Clean up:
+ Clean up adapter registry and others:
- >>> tearDown()
+ >>> from zope.testing.cleanup import cleanUp
+ >>> cleanUp()
"""
def test_suite():
Modified: Zope/trunk/lib/python/Products/Five/tests/test_event.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_event.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_event.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -19,9 +19,64 @@
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
+
+# These classes aren't defined in the doctest because otherwise
+# they wouldn't be picklable, and we need that to test copy/paste.
+
+from OFS.SimpleItem import SimpleItem
+from OFS.Folder import Folder
+from OFS.OrderedFolder import OrderedFolder
+from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2
+
+class DontComplain(object):
+ def _verifyObjectPaste(self, object, validate_src=1):
+ pass
+ def cb_isMoveable(self):
+ return True
+ def cb_isCopyable(self):
+ return True
+
+class NotifyBase(DontComplain):
+ def manage_afterAdd(self, item, container):
+ print 'old manage_afterAdd %s %s %s' % (self.getId(), item.getId(),
+ container.getId())
+ def manage_beforeDelete(self, item, container):
+ print 'old manage_beforeDelete %s %s %s' % (self.getId(), item.getId(),
+ container.getId())
+ def manage_afterClone(self, item):
+ print 'old manage_afterClone %s %s' % (self.getId(), item.getId())
+
+class MyApp(Folder):
+ def getPhysicalRoot(self):
+ return self
+
+class MyFolder(NotifyBase, Folder):
+ pass
+
+class MyOrderedFolder(NotifyBase, OrderedFolder):
+ pass
+
+class MyBTreeFolder(NotifyBase, BTreeFolder2):
+ def _verifyObjectPaste(self, object, validate_src=1):
+ pass
+
+class MyContent(NotifyBase, SimpleItem):
+ def __init__(self, id):
+ self._setId(id)
+
+# These don't have manage_beforeDelete & co methods
+
+class MyNewContent(DontComplain, SimpleItem):
+ def __init__(self, id):
+ self._setId(id)
+
+class MyNewFolder(DontComplain, Folder):
+ pass
+
+
def test_suite():
- from Testing.ZopeTestCase import ZopeDocFileSuite
- return ZopeDocFileSuite('event.txt', package="Products.Five.tests")
+ from zope.testing.doctest import DocFileSuite
+ return DocFileSuite('event.txt', package="Products.Five.tests")
if __name__ == '__main__':
framework()
Modified: Zope/trunk/lib/python/Products/Five/tests/test_i18n.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_i18n.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_i18n.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -23,7 +23,7 @@
"""
Test the i18n directive
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
First, we need to register the ZCML directive:
@@ -44,9 +44,9 @@
Now, take an arbitrary message id from that domain:
- >>> from zope.i18nmessageid import MessageIDFactory
+ >>> from zope.i18nmessageid import MessageFactory
>>> from zope.i18n import translate
- >>> _ = MessageIDFactory('fivetest')
+ >>> _ = MessageFactory('fivetest')
>>> msg = _(u'explicit-msg', u'This is an explicit message')
As you can see, both the default functionality and translation to
Deleted: Zope/trunk/lib/python/Products/Five/tests/test_import_conflicts.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_import_conflicts.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_import_conflicts.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,40 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Test import conflicts
-
-$Id: test_import_conflicts.py 18150 2005-10-04 16:19:49Z philikon $
-"""
-import os, sys
-if __name__ == '__main__':
- execfile(os.path.join(sys.path[0], 'framework.py'))
-
-def testImportConflicts():
- """
- In a Five environment, importing Zope 3 packages that would use
- interfaces from the Zope 3 transaction module would lead to an
- error, because of the monkey patching. The zope.app.mail package
- makes use of transaction interfaces, for example the following
- class:
-
- >>> from zope.app.mail.delivery import QueueProcessorThread
-
- Note that this only concerns Zope 2.7 and Zope X3 3.0.
- """
-
-def test_suite():
- from Testing.ZopeTestCase import ZopeDocTestSuite
- return ZopeDocTestSuite()
-
-if __name__ == '__main__':
- framework()
Copied: Zope/trunk/lib/python/Products/Five/tests/test_registerclass.py (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/tests/test_registerclass.py)
Modified: Zope/trunk/lib/python/Products/Five/tests/test_security.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_security.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_security.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -45,7 +45,7 @@
Zope 2 can be replaced by ZCML statements without any loss of
information.
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
We start out with two classes, ``Dummy1`` and ``Dummy2``. They
@@ -141,7 +141,7 @@
"""
Test checkPermission
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
Zope 3 has a function zope.security.checkPermission which provides
Modified: Zope/trunk/lib/python/Products/Five/tests/test_size.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_size.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_size.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -54,21 +54,21 @@
Set up:
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> from zope.app.testing.placelesssetup import setUp, tearDown
>>> setUp()
>>> configure_zcml = '''
... <configure xmlns="http://namespaces.zope.org/zope"
... xmlns:five="http://namespaces.zope.org/five">
- ... <five:sizable class="Products.Five.testing.simplecontent.SimpleContent" />
- ... <five:sizable class="Products.Five.testing.fancycontent.FancyContent" />
+ ... <five:sizable class="Products.Five.tests.testing.simplecontent.SimpleContent" />
+ ... <five:sizable class="Products.Five.tests.testing.fancycontent.FancyContent" />
... <adapter
- ... for="Products.Five.testing.simplecontent.ISimpleContent"
+ ... for="Products.Five.tests.testing.simplecontent.ISimpleContent"
... provides="zope.app.size.interfaces.ISized"
... factory="Products.Five.tests.test_size.SimpleContentSize"
... />
... <adapter
- ... for="Products.Five.testing.fancycontent.IFancyContent"
+ ... for="Products.Five.tests.testing.fancycontent.IFancyContent"
... provides="zope.app.size.interfaces.ISized"
... factory="Products.Five.tests.test_size.FancyContentSize"
... />
@@ -79,8 +79,8 @@
>>> zcml.load_config('meta.zcml', Products.Five)
>>> zcml.load_string(configure_zcml)
- >>> from Products.Five.testing.simplecontent import manage_addSimpleContent
- >>> from Products.Five.testing.fancycontent import manage_addFancyContent
+ >>> from Products.Five.tests.testing.simplecontent import manage_addSimpleContent
+ >>> from Products.Five.tests.testing.fancycontent import manage_addFancyContent
We have registered an ``ISized`` adapter for SimpleContent:
Modified: Zope/trunk/lib/python/Products/Five/tests/test_viewable.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/tests/test_viewable.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/tests/test_viewable.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -23,9 +23,6 @@
"""
Testing default view functionality
- >>> from zope.app.tests.placelesssetup import setUp, tearDown
- >>> setUp()
-
Take a class Foo and an interface IFoo:
>>> class Foo:
@@ -37,14 +34,14 @@
Set up a default view for IFoo:
- >>> from zope.app import zapi
- >>> pres = zapi.getGlobalService('Presentation')
+ >>> from zope.component import provideAdapter
+ >>> from zope.component.interfaces import IDefaultViewName
>>> from zope.publisher.interfaces.browser import IBrowserRequest
and default view names for everything and IFoo objects in particular:
- >>> pres.setDefaultViewName(None, IBrowserRequest, u'index.html')
- >>> pres.setDefaultViewName(IFoo, IBrowserRequest, u'foo.html')
+ >>> provideAdapter(u'index.html', (None, IBrowserRequest), IDefaultViewName)
+ >>> provideAdapter(u'foo.html', (IFoo, IBrowserRequest), IDefaultViewName)
Now take a BrowserDefault for an instance of Foo::
@@ -73,10 +70,10 @@
>>> path
[u'foo.html']
+ Clean up adapter registry:
- Clean up:
-
- >>> tearDown()
+ >>> from zope.testing.cleanup import cleanUp
+ >>> cleanUp()
"""
def test_suite():
Copied: Zope/trunk/lib/python/Products/Five/tests/testing (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/tests/testing)
Modified: Zope/trunk/lib/python/Products/Five/traversable.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/traversable.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/traversable.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,28 +13,29 @@
##############################################################################
"""Machinery for making things traversable through adaptation
-$Id: traversable.py 18841 2005-10-23 09:57:38Z philikon $
+$Id: traversable.py 19283 2005-10-31 17:43:51Z philikon $
"""
from zExceptions import NotFound
-from zope.exceptions import NotFoundError
-from zope.component import getView, ComponentLookupError
-from zope.interface import implements
+
+from zope.component import getMultiAdapter, ComponentLookupError
+from zope.interface import implements, Interface
+from zope.publisher.interfaces import ILayer
from zope.publisher.interfaces.browser import IBrowserRequest
+
from zope.app.traversing.interfaces import ITraverser, ITraversable
from zope.app.traversing.adapters import DefaultTraversable
from zope.app.traversing.adapters import traversePathElement
+from zope.app.publication.browser import setDefaultSkin
+from zope.app.interface import queryType
from AccessControl import getSecurityManager
from Products.Five.security import newInteraction
_marker = object
-class FakeRequest:
+class FakeRequest(dict):
implements(IBrowserRequest)
- def getPresentationSkin(self):
- return None
-
def has_key(self, key):
return False
@@ -69,16 +70,20 @@
REQUEST = getattr(self, 'REQUEST', None)
if not IBrowserRequest.providedBy(REQUEST):
REQUEST = FakeRequest()
+
+ # set the default skin on the request if it doesn't have any
+ # layers set on it yet
+ if queryType(REQUEST, ILayer) is None:
+ setDefaultSkin(REQUEST)
+
# con Zope 3 into using Zope 2's checkPermission
newInteraction()
-
try:
return ITraverser(self).traverse(
path=[name], request=REQUEST).__of__(self)
- except (ComponentLookupError, NotFoundError,
+ except (ComponentLookupError, LookupError,
AttributeError, KeyError, NotFound):
pass
-
try:
return getattr(self, name)
except AttributeError:
@@ -100,8 +105,9 @@
REQUEST = getattr(context, 'REQUEST', None)
if not IBrowserRequest.providedBy(REQUEST):
REQUEST = FakeRequest()
- # Try to lookup a view first
+ setDefaultSkin(REQUEST)
+ # Try to lookup a view
try:
- return getView(context, name, REQUEST)
+ return getMultiAdapter((context, REQUEST), Interface, name)
except ComponentLookupError:
pass
Copied: Zope/trunk/lib/python/Products/Five/utilities (from rev 39847, Zope/branches/philikon-zope32-integration/lib/python/Products/Five/utilities)
Modified: Zope/trunk/lib/python/Products/Five/version.txt
===================================================================
--- Zope/trunk/lib/python/Products/Five/version.txt 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/version.txt 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1 +1 @@
-Five 1.1
+Five 1.3b
Modified: Zope/trunk/lib/python/Products/Five/viewable.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/viewable.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/Five/viewable.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,10 +17,10 @@
"""
import inspect
from zExceptions import NotFound
-from zope.exceptions import NotFoundError
-from zope.component import getView, getDefaultViewName, ComponentLookupError
+from zope.component import ComponentLookupError
from zope.interface import implements
from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.app.zapi import getDefaultViewName
from Products.Five.traversable import FakeRequest
from Products.Five.interfaces import IBrowserDefault
Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testHTMLTests.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testHTMLTests.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testHTMLTests.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -13,11 +13,6 @@
import os, sys, unittest
-#XXX utility service needed for Zope X3 3.0. This will go away before
-# when we switch to Zope 3.2 and thus be removed before the release --
-# philiKON
-import zope.app.tests.placelesssetup
-
from Products.PageTemplates.tests import util
from Products.PageTemplates.PageTemplate import PageTemplate
from Products.PageTemplates.GlobalTranslationService import \
@@ -154,22 +149,12 @@
self.assert_expected_unicode(self.folder.t, 'CheckUnicodeInserts.html')
def checkI18nTranslate(self):
- #XXX utility service needed for Zope X3 3.0. This will go
- # away before when we switch to Zope 3.2 and thus be removed
- # before the release -- philiKON
- zope.app.tests.placelesssetup.setUp()
self.assert_expected(self.folder.t, 'CheckI18nTranslate.html')
- zope.app.tests.placelesssetup.tearDown()
def checkI18nTranslateHooked(self):
- #XXX utility service needed for Zope X3 3.0. This will go
- # away before when we switch to Zope 3.2 and thus be removed
- # before the release -- philiKON
- zope.app.tests.placelesssetup.setUp()
old_ts = setGlobalTranslationService(TestTranslationService())
self.assert_expected(self.folder.t, 'CheckI18nTranslateHooked.html')
setGlobalTranslationService(old_ts)
- zope.app.tests.placelesssetup.tearDown()
def test_suite():
return unittest.makeSuite(HTMLTests, 'check')
Modified: Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/PythonScripts/PythonScript.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -330,6 +330,14 @@
if item is self:
self._filepath = self.get_filepath()
+ def manage_beforeDelete(self, item, container):
+ # shut up deprecation warnings
+ pass
+
+ def manage_afterClone(self, item):
+ # shut up deprecation warnings
+ pass
+
def get_filepath(self):
return self.meta_type + ':' + '/'.join(self.getPhysicalPath())
Modified: Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -26,8 +26,10 @@
transaction.begin()
self.app = makerequest(Zope2.app())
try:
- #self.app.manage_addProduct['SiteAccess'].manage_addVirtualHostMonster('VHM')
- # now we have a VHM as virtual_hosting per default
+ 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])
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -22,6 +22,10 @@
transaction.begin()
self.app = makerequest(Zope2.app())
try:
+ if not hasattr(self.app, 'error_log'):
+ # If ZopeLite was imported, we have no default error_log
+ from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog
+ self.app._setObject('error_log', SiteErrorLog())
self.app.manage_addDTMLMethod('doc', '')
except:
self.tearDown()
@@ -41,7 +45,10 @@
self.assert_(self.app.__error_log__ == sel_ob)
# Right now there should not be any entries in the log
- self.assertEquals(len(sel_ob.getLogEntries()), 0)
+ # but if another test fails and leaves something in the
+ # log (which belongs to app , we get a spurious error here.
+ # There's no real point in testing this anyway.
+ #self.assertEquals(len(sel_ob.getLogEntries()), 0)
def testSimpleException(self):
# Grab the Site Error Log and make sure it's empty
Modified: Zope/trunk/lib/python/Record/_Record.c
===================================================================
--- Zope/trunk/lib/python/Record/_Record.c 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/Record/_Record.c 2005-11-02 18:34:38 UTC (rev 39848)
@@ -17,7 +17,7 @@
"\n$Id: _Record.c,v 1.2 2003/11/28 16:46:36 jim Exp $"
;
-#include "ExtensionClass.h"
+#include "ExtensionClass/ExtensionClass.h"
/* ----------------------------------------------------- */
Modified: Zope/trunk/lib/python/TAL/DummyEngine.py
===================================================================
--- Zope/trunk/lib/python/TAL/DummyEngine.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/TAL/DummyEngine.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -22,17 +22,6 @@
from ITALES import ITALESCompiler, ITALESEngine
from DocumentTemplate.DT_Util import ustr
-IDomain = None
-try:
- from Zope2.I18n.ITranslationService import ITranslationService
- from Zope2.I18n.IDomain import IDomain
-except ImportError:
- pass
-if IDomain is None:
- # Before 2.7, or not in Zope
- class ITranslationService: pass
- class IDomain: pass
-
class _Default:
pass
Default = _Default()
@@ -234,7 +223,6 @@
return 1
class DummyDomain:
- __implements__ = IDomain
def translate(self, msgid, mapping=None, context=None,
target_language=None, default=None):
@@ -246,8 +234,10 @@
# things back together.
# simulate an unknown msgid by returning None
+ text = msgid
if msgid == "don't translate me":
- text = default
+ if default is not None:
+ text = default
else:
text = msgid.upper()
@@ -257,7 +247,6 @@
return cre.sub(repl, text)
class DummyTranslationService:
- __implements__ = ITranslationService
def translate(self, domain, msgid, mapping=None, context=None,
target_language=None, default=None):
Modified: Zope/trunk/lib/python/TAL/TALInterpreter.py
===================================================================
--- Zope/trunk/lib/python/TAL/TALInterpreter.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/TAL/TALInterpreter.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -24,7 +24,12 @@
from DocumentTemplate.DT_Util import ustr
from ZODB.POSException import ConflictError
-from zope.i18nmessageid import MessageID
+# BBB 2005/10/10 -- MessageIDs are to be removed for Zope 3.3
+import zope.deprecation
+zope.deprecation.__show__.off()
+from zope.i18nmessageid import Message, MessageID
+zope.deprecation.__show__.on()
+
from TALDefs import attrEscape, TAL_VERSION, METALError
from TALDefs import isCurrentVersion
from TALDefs import getProgramVersion, getProgramMode
@@ -32,7 +37,7 @@
from TranslationContext import TranslationContext
# This will become (MessageID, Message) when we use Zope 3.1 as a base:
-I18nMessageTypes = MessageID
+I18nMessageTypes = Message, MessageID
# TODO: In Python 2.4 we can use frozenset() instead of dict.fromkeys()
BOOLEAN_HTML_ATTRS = dict.fromkeys([
Modified: Zope/trunk/lib/python/TAL/tests/test_talinterpreter.py
===================================================================
--- Zope/trunk/lib/python/TAL/tests/test_talinterpreter.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/TAL/tests/test_talinterpreter.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -28,7 +28,7 @@
from TAL.DummyEngine import DummyEngine, DummyTranslationService
from TAL.TALInterpreter import interpolate
from TAL.tests import utils
-from zope.i18nmessageid import MessageID
+from zope.i18nmessageid import Message
class TestCaseBase(unittest.TestCase):
@@ -67,10 +67,10 @@
def setUp(self):
self.engine = DummyEngine()
- self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+ self.engine.setLocal('foo', Message('FoOvAlUe', 'default'))
self.engine.setLocal('bar', 'BaRvAlUe')
self.engine.setLocal('raw', ' \tRaW\n ')
- self.engine.setLocal('noxlt', MessageID("don't translate me"))
+ self.engine.setLocal('noxlt', Message("don't translate me"))
def _check(self, program, expected):
result = StringIO()
Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -14,11 +14,13 @@
$Id$
"""
-
from urllib import quote
import xmlrpc
from zExceptions import Forbidden
+from zope.event import notify
+from zope.app.publication.interfaces import EndRequestEvent
+
UNSPECIFIED_ROLES=''
try:
@@ -83,6 +85,7 @@
def close(self):
self.other.clear()
self._held=None
+ notify(EndRequestEvent(None, self))
def processInputs(self):
"""Do any input processing that could raise errors
Modified: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1339,16 +1339,6 @@
def taintWrapper(self, enabled=TAINTING_ENABLED):
return enabled and TaintRequestWrapper(self) or self
- # Used by Five
-
- def getPresentationSkin(self):
- """see zope.component.interfaces.IPresentationRequest"""
- return getattr(self, '_presentation_skin', None)
-
- def setPresentationSkin(self, skin):
- """see zope.publisher.interfaces.IPublicationRequest"""
- self._presentation_skin = skin
-
def getURL(self):
return self.URL
Property changes on: Zope/trunk/lib/python/zope
___________________________________________________________________
Name: svn:externals
- app svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/app
cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/cachedescriptors
component svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/component
configuration svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/configuration
documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/documenttemplate
event svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/event
exceptions svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/exceptions
hookable svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/hookable
i18n svn://svn.zope.org/repos/main/Zope3/tags/jim-fix-test-ZopeX3-3.0.1-Zope-2.8/src/zope/i18n
i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/i18nmessageid
interface svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/interface
modulealias svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/modulealias
pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/pagetemplate
proxy svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/proxy
publisher svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/publisher
schema svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/schema
security svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/security
server svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/server
structuredtext svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/structuredtext
tal svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tal
tales svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/tales
testing -r39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing
thread svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope/thread
+ app svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/app
cachedescriptors svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/cachedescriptors
component svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/component
configuration svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/configuration
documenttemplate svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/documenttemplate
event svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/event
exceptions svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/exceptions
hookable svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/hookable
i18n svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18n
i18nmessageid svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/i18nmessageid
interface svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/interface
modulealias svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/modulealias
pagetemplate svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/pagetemplate
proxy svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/proxy
publisher svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/publisher
schema svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/schema
security svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/security
server svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/server
structuredtext svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/structuredtext
tal svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tal
tales svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/tales
testing -r39830 svn://svn.zope.org/repos/main/zope.testing/trunk/src/zope/testing
thread svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/thread
deprecation svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/deprecation
dottedname svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/dottedname
formlib svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/formlib
index svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/index
testbrowser svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/testbrowser
Copied: Zope/trunk/releases (from rev 39847, Zope/branches/philikon-zope32-integration/releases)
Modified: Zope/trunk/setup.py
===================================================================
--- Zope/trunk/setup.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/setup.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,499 +1,45 @@
-#!/usr/bin/env python2.3
-
-##############################################################################
+#############################################################################
#
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# 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.
#
##############################################################################
-"""
-Distutils setup for Zope
-
- In-place building
-
- This builds extension modules in-place, much like build_extensions.py
- does. Use 'setup.py' like this::
-
- python setup.py build_ext -i
-
- Installation
-
- This builds extension modules, compiles python modules, and installs
- everything needed to support Zope instances in the directory of
- your choosing. For example, to use '/usr/local/lib/zope'::
-
- python setup.py install \
- --home=/usr/local/lib/zope \
- --install-platlib=/usr/local/lib/zope \
- --install-purelib=/usr/local/lib/zope
-"""
-
-import glob
import os
+import site
import sys
-import distutils.core
+here = os.path.dirname(os.path.abspath(__file__))
+buildsupport = os.path.join(here, "buildsupport")
-# Override install_data to install into module directories, and to support
-# globbing on data_files.
+# Add 'buildsupport' to sys.path and process *.pth files from 'buildsupport':
+last = len(sys.path)
+site.addsitedir(buildsupport)
+if len(sys.path) > last:
+ # Move all appended directories to the start.
+ # Make sure we use ZConfig shipped with the distribution
+ new = sys.path[last:]
+ del sys.path[last:]
+ sys.path[:0] = new
-from distutils.command.install import install
-from distutils.command.install_data import install_data
-from distutils.util import convert_path
+import zpkgsetup.package
+import zpkgsetup.publication
+import zpkgsetup.setup
-class ZopeInstallData(install_data):
- def finalize_options(self):
- self.set_undefined_options('install',
- ('install_purelib', 'install_dir'),
- ('root', 'root'),
- ('force', 'force'),
- )
- def run(self):
- self.mkpath(self.install_dir)
- for f in self.data_files:
- if isinstance(f, str):
- # it's a simple file, so copy it
- f = convert_path(f)
- gl = glob.glob(f)
- if len(gl) == 0:
- raise distutils.core.DistutilsFileError, \
- "can't copy '%s': no matching files" % f
- for g in gl:
- if os.path.isfile(g):
- if self.warn_dir:
- self.warn("setup script did not provide a "
- "directory for '%s' -- installing "
- "right in '%s'" %
- (g, self.install_dir))
- (out, _) = self.copy_file(g, self.install_dir)
- self.outfiles.append(out)
- else:
- # it's a tuple with path to install to and a list of files
- dir = convert_path(f[0])
- if not os.path.isabs(dir):
- dir = os.path.join(self.install_dir, dir)
- elif self.root:
- dir = change_root(self.root, dir)
- self.mkpath(dir)
- for data in f[1]:
- data = convert_path(data)
- gl = glob.glob(data)
- if len(gl) == 0:
- raise distutils.core.DistutilsFileError, \
- "can't copy '%s': no matching files" % data
- for g in gl:
- if os.path.isfile(g):
- (out, _) = self.copy_file(g, dir)
- self.outfiles.append(out)
+context = zpkgsetup.setup.SetupContext(
+ "Zope", "2.8.42", __file__)
-# We create a custom "install scheme" that works the same way on all
-# platforms. We do this in order to prevent distutils from trying to
-# guess where to put our files on a per-platform basis.
+context.load_metadata(
+ os.path.join(here, "releases", "Zope2",
+ zpkgsetup.publication.PUBLICATION_CONF))
-ZOPE_INSTALL_SCHEME = {
- 'purelib': '$base/lib/python',
- 'platlib': '$base/lib/python',
- 'headers': '$base/lib/python',
- 'scripts': '$base/bin',
- 'data' : '$base/lib/python',
- }
-
-class ZopeInstall(install):
- # give distutils install step knowledge about build file placement options
- user_options = install.user_options + [
- ('build-base=', None, 'base directory for build library'),
- ('build-lib=', None, 'build directory for all distribution'),
- ('build-scripts=', None, 'build directory for scripts'),
- ('build-temp=', None, 'temporary build directory'),
- ]
- build_scripts = None
- build_temp = None
-
- def run(self):
- """ Override run to pass along build location info so
- we can use custom build directories """
- build = self.distribution.get_command_obj('build')
- build.build_base = self.build_base
- build.build_lib = self.build_lib
- build.build_scripts = self.build_scripts
- build.build_temp = self.build_temp
-
- install.run(self)
-
- def select_scheme(self, name):
- """
- Override the default platform installation schemes, ignoring whatever
- 'name' is passed in. For our purposes, we want to put all library,
- header, and data into [install_base]/lib/python. Comment
- this method out to achieve distutils-standard platform-specific
- behavior for 'setup.py install'. This is most useful if you set the
- [install-base] by using the '--prefix' or '--home' flags on the
- setup.py install command line. Otherwise, all Zope software
- will probably be installed to your Python's 'lib/python' directory.
- """
- scheme = ZOPE_INSTALL_SCHEME
- import distutils.command.install
- for key in distutils.command.install.SCHEME_KEYS:
- attrname = 'install_' + key
- if getattr(self, attrname) is None:
- setattr(self, attrname, scheme[key])
-
-class ZopeDistribution(distutils.core.Distribution):
- def __init__(self, attrs):
- distutils.core.Distribution.__init__(self, attrs)
- self.cmdclass["install"] = ZopeInstall
- self.cmdclass["install_data"] = ZopeInstallData
-
-# presumes this script lives in the base dir
-BASE_DIR=os.path.dirname(os.path.abspath(sys.argv[0]))
-
-AUTHOR = 'Zope Corporation and Contributors'
-
-# Most modules are in lib/python in the source distribution
-PACKAGES_ROOT = os.path.join(BASE_DIR, 'lib', 'python')
-os.chdir(PACKAGES_ROOT)
-
-
-# Most of this is ripped from the Zope 3 setup.py.
-
-from distutils import dir_util
-from distutils.command.build import build as buildcmd
-from distutils.command.build_ext import build_ext
-from distutils.command.install_lib import install_lib as installcmd
-from distutils.core import setup
-from distutils.dist import Distribution
-from distutils.extension import Extension
-
-
-# This class serves multiple purposes. It walks the file system looking for
-# auxiliary files that distutils doesn't install properly, and it actually
-# copies those files (when hooked into by distutils). It also walks the file
-# system looking for candidate packages for distutils to install as normal.
-# The key here is that the package must have an __init__.py file.
-class Finder:
- def __init__(self, ignore, prefix):
- self._files = []
- self._pkgs = {}
- self._ignore = ignore
- # We're finding packages in lib/python in the source dir, but we're
- # copying them directly under build/lib.<plat>. So we need to lop off
- # the prefix when calculating the package names from the file names.
- self._plen = len(prefix) + 1
-
- def visit(self, dir, files):
- # First see if this is one of the packages we want to add, or if
- # we're really skipping this package.
- if '__init__.py' in files:
- aspkg = dir[self._plen:].replace(os.sep, '.')
- self._pkgs[aspkg] = True
- ignore = ('.py',) + self._ignore
- else:
- ignore = self._ignore
- # Add any extra files we're interested in
- for file in files:
- base, ext = os.path.splitext(file)
- if ext not in ignore:
- self._files.append(os.path.join(dir, file))
-
- def copy_files(self, cmd, outputbase):
- for file in self._files:
- dest = os.path.join(outputbase, file[self._plen:])
- # Make sure the destination directory exists
- dir = os.path.dirname(dest)
- if not os.path.exists(dir):
- dir_util.mkpath(dir)
- cmd.copy_file(file, dest)
-
- def get_packages(self):
- return self._pkgs.keys()
-
-def remove_stale_bytecode(arg, dirname, names):
- names = map(os.path.normcase, names)
- for name in names:
- if name.endswith(".pyc") or name.endswith(".pyo"):
- srcname = name[:-1]
- if srcname not in names:
- fullname = os.path.join(dirname, name)
- print "Removing stale bytecode file", fullname
- os.unlink(fullname)
-
-# Create the finder instance, which will be used in lots of places. `finder'
-# is the global we're most interested in.
-IGNORE_EXTS = ('.pyc', '.pyo', '.c', '.h', '.so', '.cfg')
-finder = Finder(IGNORE_EXTS, PACKAGES_ROOT)
-
-for dirpath, dirnames, filenames in os.walk(PACKAGES_ROOT):
- if not '.svn' in dirpath:
- finder.visit(dirpath, filenames)
-packages = finder.get_packages()
-
-# Distutils hook classes
-class MyBuilder(buildcmd):
- def run(self):
- os.path.walk(os.curdir, remove_stale_bytecode, None)
- buildcmd.run(self)
- finder.copy_files(self, self.build_lib)
-
-class MyExtBuilder(build_ext):
- # Override the default build_ext to remove stale bytecodes.
- # Technically, removing bytecode has nothing to do with
- # building extensions, but Zope's the build_ext -i variant
- # is used to build Zope in place.
- def run(self):
- os.path.walk(os.curdir, remove_stale_bytecode, None)
- build_ext.run(self)
-
-class MyLibInstaller(installcmd):
- def run(self):
- installcmd.run(self)
- finder.copy_files(self, self.install_dir)
-
-class MyDistribution(Distribution):
- # To control the selection of MyLibInstaller and MyPyBuilder, we
- # have to set it into the cmdclass instance variable, set in
- # Distribution.__init__().
- def __init__(self, *attrs):
- Distribution.__init__(self, *attrs)
- self.cmdclass['install'] = ZopeInstall
- self.cmdclass['build'] = MyBuilder
- self.cmdclass['build_ext'] = MyExtBuilder
- self.cmdclass['install_lib'] = MyLibInstaller
-
-
-# added . to EXTENSIONCLASS_INCLUDEDIRS in order to be able to compile
-# ZODB HEAD code (which uses qualified paths to find header files). This
-# should be a temporary change, thrown away once we use zpkg to package
-# Zope.
-EXTENSIONCLASS_INCLUDEDIRS = ['ExtensionClass', '.']
-
-# All extension modules must be listed here.
-ext_modules = [
-
- # AccessControl
- Extension(name='AccessControl.cAccessControl',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['Acquisition'],
- sources=['AccessControl/cAccessControl.c'],
- depends=['ExtensionClass/ExtensionClass.h',
- 'ExtensionClass/pickle/pickle.c',
- 'Acquisition/Acquisition.h']),
-
- # BTrees
- Extension(name='BTrees._OOBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- sources=['BTrees/_OOBTree.c']),
- Extension(name='BTrees._OIBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- sources=['BTrees/_OIBTree.c']),
- Extension(name='BTrees._IIBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
- sources=['BTrees/_IIBTree.c']),
- Extension(name='BTrees._IOBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
- sources=['BTrees/_IOBTree.c']),
- Extension(name='BTrees._IFBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
- sources=['BTrees/_IFBTree.c']),
- Extension(name='BTrees._fsBTree',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS+['persistent'],
- define_macros=[('EXCLUDE_INTSET_SUPPORT', None)],
- sources=['BTrees/_fsBTree.c']),
-
- # DocumentTemplate
- Extension(name='DocumentTemplate.cDocumentTemplate',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=['DocumentTemplate/cDocumentTemplate.c']),
-
- # ExtensionClass
- Extension(name='ExtensionClass._ExtensionClass',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["ExtensionClass/_ExtensionClass.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='Acquisition._Acquisition',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["Acquisition/_Acquisition.c"],
- depends=["ExtensionClass/ExtensionClass.h",
- "Acquisition/Acquisition.h"]),
- Extension(name='MethodObject._MethodObject',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["MethodObject/_MethodObject.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='MultiMapping._MultiMapping',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["MultiMapping/_MultiMapping.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='ThreadLock._ThreadLock',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["ThreadLock/_ThreadLock.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='Missing._Missing',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["Missing/_Missing.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='Record._Record',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["Record/_Record.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
- Extension(name='ComputedAttribute._ComputedAttribute',
- include_dirs=EXTENSIONCLASS_INCLUDEDIRS,
- sources=["ComputedAttribute/_ComputedAttribute.c"],
- depends=["ExtensionClass/ExtensionClass.h"]),
-
- # initgroups
- Extension(name='initgroups._initgroups',
- sources=['initgroups/_initgroups.c']),
-
- # indexes
- Extension(name='Products.PluginIndexes.TextIndex.Splitter.ZopeSplitter.ZopeSplitter',
- sources=['Products/PluginIndexes/TextIndex/Splitter/ZopeSplitter/src/ZopeSplitter.c']),
- Extension(name='Products.PluginIndexes.TextIndex.Splitter.ISO_8859_1_Splitter.ISO_8859_1_Splitter',
- sources=['Products/PluginIndexes/TextIndex/Splitter/ISO_8859_1_Splitter/src/ISO_8859_1_Splitter.c']),
- Extension(name='Products.PluginIndexes.TextIndex.Splitter.UnicodeSplitter.UnicodeSplitter',
- sources=['Products/PluginIndexes/TextIndex/Splitter/UnicodeSplitter/src/UnicodeSplitter.c']),
- Extension(name='Products.ZCTextIndex.stopper',
- sources=['Products/ZCTextIndex/stopper.c']),
- Extension(name='Products.ZCTextIndex.okascore',
- sources=['Products/ZCTextIndex/okascore.c']),
-
- #ZODB
- Extension(name = 'persistent.cPersistence',
- include_dirs = ['persistent'],
- sources= ['persistent/cPersistence.c',
- 'persistent/ring.c'],
- depends = ['persistent/cPersistence.h',
- 'persistent/ring.h',
- 'persistent/ring.c']
- ),
- Extension(name = 'Persistence._Persistence',
- include_dirs = ['persistent', 'ExtensionClass'],
- sources = ['Persistence/_Persistence.c'],
- depends = ['persistent/cPersistence.h',
- 'ExtensionClass/ExtensionClass.h']
- ),
- Extension(name = 'persistent.cPickleCache',
- include_dirs = ['persistent'],
- sources= ['persistent/cPickleCache.c',
- 'persistent/ring.c'],
- depends = ['persistent/cPersistence.h',
- 'persistent/ring.h',
- 'persistent/ring.c']
- ),
- Extension(name = 'persistent.TimeStamp',
- sources= ['persistent/TimeStamp.c']
- ),
- Extension(name = 'ZODB.winlock',
- sources = ['ZODB/winlock.c']
- ),
-
- #zope
- Extension("zope.proxy._zope_proxy_proxy",
- ["zope/proxy/_zope_proxy_proxy.c"],
- include_dirs = ["zope/proxy"],
- depends = ["zope/proxy/proxy.h"]),
-
- Extension("zope.security._proxy", ["zope/security/_proxy.c"],
- include_dirs = ["zope/proxy"],
- depends = ["zope/proxy/proxy.h"]),
-
- Extension("zope.security._zope_security_checker",
- ["zope/security/_zope_security_checker.c"],
- include_dirs = [],
- depends = []),
-
- Extension("zope.interface._zope_interface_coptimizations",
- ["zope/interface/_zope_interface_coptimizations.c"]),
-
- Extension("zope.hookable._zope_hookable",
- ["zope/hookable/_zope_hookable.c"]),
-
- Extension("zope.thread._zope_thread",
- ["zope/thread/_zope_thread.c"]),
-
- Extension("zope.app.container._zope_app_container_contained",
- ["zope/app/container/_zope_app_container_contained.c"],
- include_dirs = ["persistent",
- "zope/proxy",
- "zope/app/container"],
- depends = [
- "persistent/cPersistence.h",
- "zope/proxy/_zope_proxy_proxy.c",
- ]),
-
- ]
-
-# We're using the module docstring as the distutils descriptions.
-doclines = __doc__.split("\n")
-
-setup(name='Zope',
- author=AUTHOR,
- version="2.8",
- maintainer="Zope Corporation",
- maintainer_email="zope-dev at zope.org",
- url = "http://www.zope.org/",
- ext_modules = ext_modules,
- license = "http://www.zope.org/Resources/ZPL",
- platforms = ["any"],
- description = doclines[0],
- long_description = "\n".join(doclines[2:]),
- packages = packages,
- distclass = MyDistribution,
- )
-
-# The rest of these modules live in the root of the source tree
-os.chdir(BASE_DIR)
-
-IGNORE_NAMES = (
- 'CVS', '.svn', # Revision Control Directories
- )
-
-def skel_visit(skel, dirname, names):
- for ignore in IGNORE_NAMES:
- if ignore in names:
- names.remove(ignore)
- L = []
- for name in names:
- if os.path.isfile(os.path.join(dirname, name)):
- L.append("%s/%s" % (dirname, name))
- skel.append(("../../" + dirname, L))
-
-installed_data_files = [
- ["../../doc", ['doc/*.txt']],
- ["../../import", ['import/*.zexp']],
- ["../../bin", ['utilities/README.txt']],
- ]
-
-os.path.walk("skel", skel_visit, installed_data_files)
-
-setup(
- name='Zope',
- author=AUTHOR,
-
- data_files=installed_data_files,
- scripts=["utilities/mkzeoinstance.py", "utilities/mkzopeinstance.py",
- "utilities/check_catalog.py", "utilities/load_site.py",
- "utilities/requestprofiler.py", "utilities/zpasswd.py",
- "utilities/copyzopeskel.py", "utilities/reindex_catalog.py",
- "utilities/compilezpy.py", "utilities/decompilezpy.py",
- "utilities/ZODBTools/timeout.py", "utilities/ZODBTools/analyze.py",
- "utilities/ZODBTools/checkbtrees.py", "utilities/ZODBTools/fsdump.py",
- "utilities/ZODBTools/fsrefs.py" , "utilities/ZODBTools/fstail.py",
- "utilities/ZODBTools/fstest.py", "utilities/ZODBTools/migrate.py",
- "utilities/ZODBTools/netspace.py", "utilities/ZODBTools/parsezeolog.py",
- "utilities/ZODBTools/repozo.py", "utilities/ZODBTools/space.py",
- "utilities/ZODBTools/timeout.py", "utilities/ZODBTools/zeopack.py",
- "utilities/ZODBTools/zeoqueue.py", "utilities/ZODBTools/zeoreplay.py",
- "utilities/ZODBTools/zeoserverlog.py", "utilities/ZODBTools/zeoup.py",
- "utilities/ZODBTools/zodbload.py",
- "test.py"],
- distclass=ZopeDistribution,
- )
+context.walk_packages("lib/python")
+context.setup()
Modified: Zope/trunk/test.py
===================================================================
--- Zope/trunk/test.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/test.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -66,6 +66,8 @@
'zdaemon'
'|'
'zope[.]testing'
+ '|'
+ 'zope[.]app'
')[.]']
if ihome:
ihome = os.path.abspath(ihome)
Modified: Zope/trunk/utilities/check_catalog.py
===================================================================
--- Zope/trunk/utilities/check_catalog.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/check_catalog.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
Modified: Zope/trunk/utilities/compilezpy.py
===================================================================
--- Zope/trunk/utilities/compilezpy.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/compilezpy.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/copyzopeskel.py
===================================================================
--- Zope/trunk/utilities/copyzopeskel.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/copyzopeskel.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/decompilezpy.py
===================================================================
--- Zope/trunk/utilities/decompilezpy.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/decompilezpy.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/load_site.py
===================================================================
--- Zope/trunk/utilities/load_site.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/load_site.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/mkzeoinstance.py
===================================================================
--- Zope/trunk/utilities/mkzeoinstance.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/mkzeoinstance.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/mkzopeinstance.py
===================================================================
--- Zope/trunk/utilities/mkzopeinstance.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/mkzopeinstance.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
Modified: Zope/trunk/utilities/requestprofiler.py
===================================================================
--- Zope/trunk/utilities/requestprofiler.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/requestprofiler.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
Modified: Zope/trunk/utilities/zpasswd.py
===================================================================
--- Zope/trunk/utilities/zpasswd.py 2005-11-02 17:17:42 UTC (rev 39847)
+++ Zope/trunk/utilities/zpasswd.py 2005-11-02 18:34:38 UTC (rev 39848)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/env python2.4
##############################################################################
#
More information about the Zope-Checkins
mailing list