[Zope-CVS] CVS: Products/Basket - VERSION.txt:1.1 README.txt:1.3
TODO.txt:1.2 __init__.py:1.18
Chris McDonough
chrism at plope.com
Wed Nov 9 19:01:11 EST 2005
Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv9534
Modified Files:
README.txt TODO.txt __init__.py
Added Files:
VERSION.txt
Log Message:
Add docs, create VERSION.txt, monkey-patch sys.modules['pkg_resources'] so Basket package authors don't need to import anything from Basket.
=== Added File Products/Basket/VERSION.txt ===
0.1
=== Products/Basket/README.txt 1.2 => 1.3 ===
--- Products/Basket/README.txt:1.2 Mon Nov 7 14:42:35 2005
+++ Products/Basket/README.txt Wed Nov 9 19:00:40 2005
@@ -61,7 +61,7 @@
detects a situation in which two distinct Product distributions
contain a Product that has the same name (a case which is not
caught by pkg_resources), Basket will prevent startup by raising
- an exception.
+ an exception if Zope is in debug mode.
How Do I Create Eggs that are Compatible with Basket?
@@ -93,7 +93,7 @@
for legacy Zope API methods which expect to be able to use a Product
name to access constructor functions. Note that the behavior of
Products packaged within Product distributions differs slightly from
- that of "legacy" Products inasmuch as "egg Products" are not
+ that of "legacy" Products inasmuch as "egg Products" will not be
imported at Zope startup time and will not show up in the
ControlPanel list unless their packaging specifies a
'zope2.initialize' entry point.
@@ -226,10 +226,50 @@
'python setup.py bdist_egg'
The ".egg" file created in dist is the Product distribution. Refer
- to the setuptools documentation for advanced options.
+ to the "setuptools
+ documentation":http://peak.telecommunity.com/DevCenter/setuptools for
+ advanced options.
+
+Replacements for File-Bound Classes
+
+ The following Zope classes may not be sucessfully used within a
+ Product packaged as a 'zip-safe' egg::
+
+ Globals.DTMLFile
+ Globals.ImageFile
+ Products.PageTemplates.PageTemplateFile.PageTemplateFile
+
+ Instead, use these replacement classes (which have compatible constructors
+ and are monkey-patched into place by Basket)::
+
+ Globals.DTMLResource
+ Globals.ImageResource
+ Products.PageTemplates.PageTemplateResource
+
+ CMF's "Filesystem Directory View" and its supporting classes like
+ "FSFile", "FSPageTemplate", et. al may also not be used in Products
+ packaged as zipfiles. Work to make the CMF filesystem skin
+ machinery understand zipfiles is underway in a SVN branch at the
+ time of this writing but is not yet released.
+
+ Custom code within your product that expects to be able to use
+ package resources as files on a filesystem (e.g. by using
+ "os.listdir", "open", "os.stat", etc.) against files in the product
+ package will fail. Replace this code with the equivalent calls from
+ the "pkg_resources" module (which may be imported via "import
+ pkg_resources" when Basket is installed). See the "pkg_resources
+ documentation":http://peak.telecommunity.com/DevCenter/setuptools
+ for more information.
Forward Compatibility Notices
+ Basket ships with a Python 2.3-compatible version of setuptools'
+ pkg_resources module. At Basket initialization time, this module is
+ inserted into sys.modules as "pkg_resources" (possibly shadowing
+ another pkg_resources module you've imported). This is necessary
+ unless we want to require people to install setuptools before using
+ Basket.
+
Note that the use of PRODUCT_DISTRIBUTIONS.txt may vanish in a later
release of Basket in favor of a special section within the Zope 2
main configuration file.
@@ -240,7 +280,8 @@
The "Basket" product is a stopgap solution to the problem of being
able to package Zope products as Python eggs. Its functionality
- will be foldeed into a later Zope release, at which point it will
- cease to be useful and disappear. Therefore, you should not depend
- on importing or otherwise using the "Products.Basket" package or its
- contents anywhere in your own Zope code.
+ will be folded into a later Zope release, at which point it will
+ cease to be useful and disappear (although eggs created which make
+ use of its facilities will continue to work). Therefore, you should
+ not depend on importing or otherwise using the "Products.Basket"
+ package or its contents anywhere in your own Zope code.
=== Products/Basket/TODO.txt 1.1.1.1 => 1.2 ===
--- Products/Basket/TODO.txt:1.1.1.1 Mon Nov 7 13:47:23 2005
+++ Products/Basket/TODO.txt Wed Nov 9 19:00:40 2005
@@ -1,17 +1,12 @@
-- Allow ImageResource, PageTemplateResource, and DTMLResource to
- monkeypatch their counterparts in Zope.
+- For non-zip-safe Products, unpack the entire source tree into
+ a temporary location and put it on the path (removing the zipfile
+ from the path).
-- Do "jackboot" import prevention by putting a wrapper around Basket
- in sys.modules (Basket is immediately deprecated; it is a stopgap
- until we get support for egg distributions in the Zope core).
+- When an egg distribution is uninstalled, its persistent object
+ sticks around in the control panel. It should go away.
-- Cause egg-distribution-packaged Products to show up in the Control
- Panel -> Products area.
+- Hurt system files aren't registered or displayed.
-- Cause module-scope resources like "misc_", "methods", "__roles__",
- and so on to be registered (see OFS.Application.install_product).
-
-- Passing Basket's "context" in to each subproducts' initialize
- function is wrong; instead we need to create a ProductContext object
- specially for the product (see OFS.Application.install_product).
+- Tracebacks from egg products don't include code from inside the egg.
+ Investigate this more (check if this is a known bug).
=== Products/Basket/__init__.py 1.17 => 1.18 ===
--- Products/Basket/__init__.py:1.17 Wed Nov 9 18:22:28 2005
+++ Products/Basket/__init__.py Wed Nov 9 19:00:40 2005
@@ -4,6 +4,12 @@
import traceback
import textwrap
+# until it's part of Python, this needs to happen before Products.Basket.utils
+# is imported
+sys.modules['pkg_resources'] = pkg_resources
+sys.modules['Products.Basket.pkg_resources'] = pkg_resources
+sys.modules['Basket.pkg_resources'] = pkg_resources
+
from Products.Basket.utils import EggProductContext
from Products.Basket.utils import EggProduct
import zLOG
More information about the Zope-CVS
mailing list