Commit c815993a authored by Hanno Schlichting's avatar Hanno Schlichting

Update documentation some more. Removed pretty much outdated and obsolete bits

parent c4eb640d
Running Zope in Debug Mode
If you wish to run Zope in debug mode, set the 'debug-mode'
......@@ -14,64 +13,16 @@ Running Zope in Debug Mode
Using 'zopectl debug'
In Zopes 2.7 and better, a utility known as 'zopectl' is installed
into generated instance homes. You can use it to inspect a Zope
instance's running state via an interactive Python interpreter by
passing zopectl the 'debug' parameter on the command line. The
'top-level' Zope object (the root folder) will be bound to the name
'app' within the interpreter. You can then use normal Python method
calls against app and use the Python interpreter normally to inspect
results::
A utility known as 'zopectl' is installed into generated instance homes.
You can use it to inspect a Zope instance's running state via an
interactive Python interpreter by passing zopectl the 'debug' parameter
on the command line. The 'top-level' Zope object (the root folder) will
be bound to the name 'app' within the interpreter. You can then use
normal Python method calls against app and use the Python interpreter
normally to inspect results::
[chrism@james Trunk]$ bin/zopectl debug
Starting debugger (the name "app" is bound to the top-level Zope object)
>>> app.objectIds()
['acl_users', 'Control_Panel', 'temp_folder', 'browser_id_manager', 'session _data_manager', 'error_log', 'index_html', 'standard_error_message', 'standa rd_html_footer', 'standard_html_header', 'standard_template.pt']
['acl_users', 'Control_Panel', 'temp_folder', 'browser_id_manager', 'session_data_manager', 'error_log', 'index_html', 'standard_error_message']
>>>
Using the Medusa Monitor
NOTE: as of Zope 2.7, the Medusa monitor client is known to have
operational problems due to lack of maintenance. It may work, it
may not. If it doesn't work as advertised, please try 'zopectl
debug' instead.
If you're running Zope with a medusa monitor port, you can connect
and interact via a python prompt with a running Zope session, while
others interact with it over the web.
Some constraints:
o You must connect to a server running on the local host.
o You must authenticate as superuser.
o At the time of writing the superuser password (in the access
file) must be plain text, not encrypted.
To use the monitor, start it from the shell prompt like so (as if
from the Zope root):
python lib/python/ZServer/medusa/monitor_client.py localhost 8099
You'll get back a python prompt. To connect with the running Zope
session:
>>> import Zope
>>> app = Zope.app()
>>> dir(app.Control_Panel.Products)
['ExternalMethod', 'MIMETools', 'MailHost', 'OFSP', 'ZCatalog',
'ZGadflyDA', 'ZSQLMethods', '_objects']
>>>
To see ODB changes caused by access concurrent with your debug
session (eg, those web connections that can still be happening, or
other debug sessions!), you may have to do a bit of magic:
>>> app._p_jar.sync()
To commit changes you make, before exiting, you may have to do
another bit of magic:
>>> import transaction
>>> transaction.commit()
Zope Installation Frequently Asked Questions
--------------------------------------------
Installing Zope
1. On certain Unix platforms (usually Solaris) I get a "checksum
......@@ -27,7 +26,7 @@ Zope Installation Frequently Asked Questions
changing the line: do('make') to: do('make -k').
3. I am having trouble building Zope on my OpenBSD system. I get
some wierd compilation errors.
some weird compilation errors.
Make sure you unpack Zope using GNU tar; you will not get any
error messages with OpenBSD's standard tar, but your installation
......@@ -59,7 +58,6 @@ Zope Installation Frequently Asked Questions
Look in the error log for your web server for details of the error.
2. I have installed Zope, and when I go to the URL in my web
browser, I get a password prompt. Although I type in the correct
username and password, I keep getting prompted. What is going on?
......@@ -74,24 +72,15 @@ Zope Installation Frequently Asked Questions
Zope. See the doc/WEBVSERVER.txt file for information on correctly
configuring your web server to pass authentication information.
3. I have installed Zope, and when I go to the URL in my web
browser, I get a "Connection refused" error.
Probably this means that Zope has failed to start. You should try
to start Zope in the foreground and look for error messages.
On Linux / Unix / OSX, you can do this by giving the command
"./bin/runzope" or "./bin/zopectl fg" in your zope instance
(they are equivalent).
On Windows, navigate to the Zope folder in your Start Menu and
click on "Run Zope in Console". A console window with process
startup information will be displayed.
If there are errors, the last error shown should explain
what went wrong.
You can do this by giving the command "./bin/zopectl fg" in your
Zope instance. If there are errors, the last error shown should
explain what went wrong.
4. When I go to a URL for an application that isn't running, it
takes quite a while to startup. Why is that?
......@@ -101,21 +90,7 @@ Zope Installation Frequently Asked Questions
take a while. Packing your Zope database at regular intervals
can reduce startup time.
5. I have Zope with the Oracle Database adapter installed, and can't
get it running. Why?
If you have Oracle installed, you need to ensure that the
environment variable "ORACLE_HOME" is in the environment of
the running application. You can do this by adding a line to
the <environment> section of etc/zope.conf, such as:
<environment>
ORACLE_HOME /foo/bar/
</environment>
6. I have forgotten the only password used to access the site or
5. I have forgotten the only password used to access the site or
I have modified the security settings in such a way that even
I can't get access. How do I fix it?
......@@ -133,8 +108,8 @@ Zope Installation Frequently Asked Questions
As the emergency user, you are allowed to create user folders
and user accounts as well as adjust security settings but you
are not allowed to create objects like DTML methods or folders.
This is a safety precaution.
are not allowed to create objects like folders. This is a
safety precaution.
See more details in the file SECURITY.TXT.
......@@ -174,80 +149,30 @@ Zope Installation Frequently Asked Questions
Upgrading from Earlier Versions of Zope
1. How can I upgrade to Zope 2.8?
1. How can I upgrade to the latest Zope 2 version?
The usual procedure when installing a new version of Zope is:
- Create a new instance (see doc/INSTALL.txt).
- Copy the var/Data.fs file from your old instance into your
new instance's var/ directory.
- Create a new environment (see doc/INSTALL.txt).
It is best to do this while the old instance is not running;
alternatively, you can use repozo.py as described at
http://www.zope.org/Wikis/ZODB/FileStorageBackup
to make a live backup, then create a new Data.fs from that
backup in your new instance.
- Include your application code in the environment.
Keep your old Data.fs in the old instance as a backup.
- Copy the Products and Extensions directories from your old
instance into the new instance.
Leave the old instance directories intact as a backup.
- Copy your database files, (often var/Data.fs) from your old
environment into your new environment's var/ directory.
Only do this while the old database files are not in use.
- Update etc/zope.conf with any changes you made in your
old instance. (Likewise for zeo.conf if you are using zeo.)
- Start the new instance. (Be sure the old instance is not running.)
- Update any ZCatalogs as described below.
old environment.
- Update any Python Scripts. This is not strictly necessary,
but it will make Zope restart somewhat faster. Visit this URL
in your browser:
- Start the new application process. (Be sure the old process
is not running.)
http://.../manage_addProduct/PythonScripts/recompile
2. After moving my old Data.fs to Zope 2.8 I get an
"AttributeError, _length" when trying to use the ZCatalog?
In Zope 2.8 we cleaned up the index implementations and therefore
you need to migrate every single ZCatalog manually.
Notice: **YOU SHOULD BACKUP YOUR var/Data.fs file before starting
the migration**, see http://www.zope.org/Wikis/ZODB/FileStorageBackup
for backup instructions.
To perform the migration:
- go to the ZMI
- click on your ZCatalog instance (or portal_catalog inside
your CMF or Plone instance)
- you will get an "AttributeError, _length"...don't panic
- call the "manage_convertIndexes" method of the ZCatalog
(by replacing the "manage_main" part of the URL with
"manage_convertIndexes")
- depending on the size of your ZCatalog the migration may
take a while
- after the conversion a message will appear: "Indexes
converted and reindexed"
3. CMF doesn't work!
2. CMF doesn't work!
Check that you have a recent stable version of CMF.
As of Zope 2.8.0, you need at least CMF-1.4.8.
CMF is available at http://www.zope.org/Products/CMF/
4. Plone doesn't work!
3. Plone doesn't work!
All Plone versions require a certain Zope version.
Check the Plone release informations on http://www.plone.org
......@@ -255,7 +180,6 @@ Zope Installation Frequently Asked Questions
General
1. My browser is giving a message, 'Sorry, an error occurred.'
How do I find out what the real error is?
......@@ -271,12 +195,11 @@ Zope Installation Frequently Asked Questions
In general, error_log will show the *traceback* for errors.
This traceback explains the error message.
Occassionally you won't see any error message. Rather, the HTML
Occasionally you won't see any error message. Rather, the HTML
source will contain the last good HTML returned by the request
before the error occurred. This is due to caching by the
browser. Clear your cache and view the HTML source again.
2. I'm using Python 2.x and I'm having a problem ...
The correct version of Python should always be automatically detected
......
Zope Help System
The Zope Help System provides context-sensitive on-line help for
Zope users. The system is flexible and can provide help for
Python Zope Products.
In the future the Help System will be expanded to provide additional
help including API documentation.
Using the Help System
Every standard Zope management screen should include a help button
which provides access to help for that screen.
Additionally all the installed help topics can be browsed and
searched.
Architecture
The Help System is based around Zope Products. When a product is
installed, its help objects are installed along with it. All help
content is associated with a product.
Help content is provided by 'Help Topic' objects. These objects live
inside Product folders within a special container object called a
'Product Help' object. When you browse a Product folder in the
Control Panel you will see these 'Product Help' objects and their
'Help Topics'.
In general you get access to the Help System through the help system
object which has methods for drawing help buttons. This object lives
in the Zope application object and has an id of 'HelpSys'.
Writing Help for Python Products
To support help your Python product needs to register help topics
during product registration, and it needs to indicate which help
topics should be associated with which management screens.
Registering Help Topics
To register help topics use the 'registerHelp' method on the
ProductContext object. For example::
def initialize(context):
...
context.registerHelp()
This method will create help topics for all files found in the
'help' subdirectory of the product. Supported file types include:
.html, .htm, .txt, .stx, .dtml, .gif, .jpg, .png. Appropriate
classes of help topics are used depending on the suffix of the
help files.
If you want more control over how your help topics are created you
can use the 'registerHelpTopic' method that takes an id and a help
topic object as arguments. For example::
from mySpecialHelpTopics import MyTopic
def initialize(context):
...
context.registerHelpTopic('myTopic', MyTopic())
Associating Help Topics with Management Screens
The chief way to bind a help topic to a management screen is to
include information about the help topic in the class's
'manage_options' structure. For example::
manage_options=(
{'label':'Edit',
'action':'editMethod',
'help':('productId','topicId')},
)
In this example, 'productId' refers to the name of the Zope
Product in which the class is defined, and 'topicId' refers to the
id of the Help Topic associated with this management view.
When Zope draws the management view it will automatically include
a help button pointing to the right help topic if you provide this
information in the 'manage_options' structure.
Note: sometimes Zope gets confused and defaults to highlighting
the first management tab in place of the correct one. To fix this,
set the 'management_view' variable to the name of the correct
view. If the wrong view is hilighted, then the wrong help button
will be drawn.
To draw a help button on a management screen that is not a view,
use the 'HelpButton' method of the 'HelpSys' object like so::
<dtml-var "HelpSys.HelpButton('productId', 'topicId')">
This will draw a help button linked to the specified help topic.
If you prefer to draw your own help button you can use the helpURL
method instead like so::
<dtml-var "HelpSys.helpURL(
topic='productId',
product='topicId')">
This will give you a URL to the help topic. You can choose to draw
whatever sort of button or link you wish.
\ No newline at end of file
......@@ -15,11 +15,11 @@ Prerequisites
System requirements when building from source
- A supported version of Python, including the development support if
installed from system-level packages. Supported versions include::
installed from system-level packages. Supported versions include:
o 2.4.x, (x >= 4)
* 2.5.x, (x >= 4)
o 2.5.x
* 2.6.x
- Zope needs the Python ``zlib`` module to be importable. If you are
building your own Python from source, please be sure that you have the
......@@ -145,7 +145,7 @@ by directing your browser to::
http://yourhost:8080/manage
.. where 'yourhost' is the DNS name or IP address of the machine
where 'yourhost' is the DNS name or IP address of the machine
running Zope. If you changed the HTTP port as described, use the port
you configured.
......@@ -165,22 +165,11 @@ start. You can access the Zope Book at:
http://www.zope.org/Documentation/Books/ZopeBook
Integrating Zope With An Existing Webserver
--------------------------------------------
Zope doesn't require any existing webserver to run, but you can
integrate it with other webservers as necessary. See the
``doc/WEBSERVER.txt`` file for more information about configuring Zope
with an existing web server. There is also information about integrating
Zope with existing webservers on the Zope.org website.
Troubleshooting
---------------
- This version of Zope requires Python 2.4.4 or better, including
2.5.x. It may run with Python 2.6.x, although this configuration
is not supported in this version of Zope. It will *not* run with
Python 3.x.
- This version of Zope requires Python 2.5.4 or better, including
2.6.x. It will *not* run with Python 3.x.
- The Python you run Zope with *must* have threads compiled in,
which is the case for a vanilla build. Warning: Zope will not run
......
from Thiebaut Champenier
"python wo_pcgi.py" doesn't build the extensions correctly due to
linking problems. To fix it, I just SymLinked ld_so_aix, makexp_aix
and python.exp (found in <python-build>/Modules/) into each of the
dirs in <Zope-build>/python/lib that contain .c files... and it
worked just great. But I'm sure it's not the best solution
from Wolfgang Roesner (reporting segfaults and a fix)
The default stack size for a pthread on AIX (at least in my
configuration) is 96kB. On Solaris it's 1M. As soon as I explicitly
set the initial stack size to 1M the problem went away and it
appears as if Zope is up and running.
Unfortunately I really had to change "thread_pthread.h" in Python
which obviously is not a nice thing to do as I now have a need for
my own private version of Python. But at least I have a running
version of Zope on AIX.
Steps to building python for use with Zope on FreeBSD to avoid
segmentation faults (by Andrew Sawyers for Pythons up to 2.3).
The default thread stack size for FreeBSD is too small; when building
Python for use with Zope it is often necessary to increase the thread
stack size to avoid segmentation faults. There are two ways which you
can increase the default python thread stack size.
Way #1: In your Python source directory:
* >cd Python
* >edit thread_pthreads.h
at the top of the header file, add #define THREAD_STACK_SIZE 1000000
* >save
* >cd ..; ./configure
Way #2: In your Python source directory:
* >./configure
* >make OPT="-DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=1000000"
Passing in the define or adding the define to your source solves all
experiences I have experienced with Zope segfaulting while running on
my FreeBSD platforms.
This directory is to collect notes that people send us on using Zope
on Platforms that we (Digital Creations) don't have and can't support
directly.
Integration of reStructuredText (reST) in Zope:
Zope 2.7 or higher integrates reST as part of the Python
docutils package. The syntax of reST is defined under
http://docutils.sf.net/spec/rst/introduction.html
Usage inside DTML:
<dtml-var rest-document fmt="restructured-text">
Usage inside ZPT:
<span tal:content="structure python: modules['Products.PythonScripts.standard'].restructured_test(rest_txt)" />
Usage inside PythonScripts:
from Products.PythonScripts.standard import restructured_text
rendered_html = restructured_test(rest_txt)
return rendered_html
Usage inside Zope products:
from reStructuredText import HTML
rendered_html = HTML(rest_txt)
...
Character set issues:
reST processes the reST document internally using unicode. A reST
document is converted using Pythons default encoding to unicode and
converted back from unicode to the default encoding on the output side.
This means you must ensure that Python default encoding is properly.
You can customize the default encoding by creating a file sitecustomize.py
somewhere in yout PYTHONPATH:
import sys
sys.setdefaultencoding("iso-8859-1")
This version of Zope also includes the ZReST product written by Richard Jones.
ZRest is a standalone Zope product to handle reStructuredText documents.
This diff is collapsed.
This diff is collapsed.
How to build and install Zope from source code on Windows.
----------------------------------------------------------
These instructions appear to work for 2.7 and the trunk:
* Ensure you have the correct MSVC version installed for the
version of Python you will be using.
......@@ -11,14 +10,13 @@ These instructions appear to work for 2.7 and the trunk:
* Install (or build from sources) the Python for Windows extensions
http://sourceforge.net/projects/pywin32/
* Unpack the Zope source distribution or pull from CVS. Change
to that directory.
* Unpack the Zope source distribution. Change to that directory.
* Execute:
% python.exe inst\configure.py
It should say something like:
>
> - Zope top-level binary directory will be c:\Zope-2.7.
> - Zope top-level binary directory will be c:\Zope-2.12.
> - Makefile written.
>
> Next, run the Visual C++ batch file "VCVARS32.bat" and then "nmake".
......@@ -33,16 +31,6 @@ These instructions appear to work for 2.7 and the trunk:
but they can be ignored. The last message in the build process should be:
> Zope binaries installed successfully.
* If you are running from CVS, the build may fail:
See http://collector.zope.org/Zope/1530
> running install_data
> error: can't copy 'version.txt': no matching files
> NMAKE : fatal error U1077: '"e:\src\python-2.3-cvs\pcbuild\python.exe"' : return code '0x1'
> Stop.
If you see this error, edit setup.py and comment the line referencing
'version.txt'
* Zope itself has now been installed. We need to create an instance. Run:
% python.exe {install_path}\bin\mkzopeinstance.py
......
The Zope Object Database, ZODB, version 3.0
ZODB is the next generation of our object database architecture.
It provides a number of advantages over or existing databases:
- Support for concurrency,
- Well-defined storage management interface that will allow many
different storage management strategies to be used, from file
storage, to RDBMS storage, to memory storage,
- More robust file storage format,
- Much better version support and integrations of
versions with the transaction system. For example,
it is possible to commit from one version to another,
to undo version commit and abort, and to use "temporary
versions" to reduce memory use when manipulating large
quantities of data.
- Support for multiple databases in the same object system.
- Support for multi-process storage managers, although the
standard distribution will not include any multiple process
storage managers.
Note: Using ZODB 3 from Python
In ZODB 2, you could access the top-level application object
with::
import Main
app=Main.app
You could then navigate from the top-level object by getting
attributes, calling methods, etc..
In ZODB 3, you get the top-level object like this::
import Zope
app=Zope.app()
... do stuff with objects
# and when you're done:
app._p_jar.close()
You have to import the Zope application module, which uses
ZODB 3 rather than ZODB 2. In ZODB 3, you have to get a
connection to a database before you access an object. The
'app()' function combines opening a connection and getting the
top level object. When your done using the top-level object
(or any objects accessible from it) you can close the database
connection by calling the 'close' method on the '_p_jar'
attribute, which is the database connection. You don't need
to close the connection if you are going to exit Python
without doing any more work.
Don't forget to::
import transaction
transaction.commit()
If you want any changes to made to be saved.
Note: Converting ZODB 2 (aka BoboPOS) data files to ZODB 3.
The bbb.py script in utilities can be used to convert data
files from ZODB 2 to ZODB 3 format::
utilities/bbb.py -f output_file input_file
Here's a example::
utilities/bbb.py -f var/Data.fs var/Data.bbb
You can also convert export files from ZODB 2 by inclding the
-x option::
utilities/bbb.py -x -f output.zexp input.bbe
ZODB 3 and Zope Database Adapters
Most database adapters are *currently* likely to be problematic unless
the underlying extensions and libraries:
- allow multiple simultaneous database connections,
- are thread safe,
- give up the Python global interpreter lock when
making database calls.
This is only a problem when running Zope 2 with multiple
threads.
ZODB 3 Futures
These are features that are lkely to wait for releases after 2.0.
- Multiple database support
- OPTIMIZATION: FileStorage will get a more efficient data
structure for maintaining index information and key methods
in the ZODB framework will move to C.
Using Zope 3 Components in Zope 2 Applications
Using Zope Components in Zope 2 Applications
Background
Zope 3 is the next major revision of Zope. It is designed to be more
'programmer-centric' and easier to learn, use and extend. Zope 3
introduces an interface-centric component architecture that makes
it easier to develop and deploy components without requiring
developers to learn and understand the entire Zope framework.
Much more information on Zope 3 is available on the Zope 3 area
of the zope.org Website at http://dev.zope.org/Zope3/.
Zope 3 is a separate project from the Zope community aimed at web
development. It is designed to be more 'programmer-centric' and easier
to learn, use and extend for programmers. Zope 3 introduces an
interface-centric component architecture that makes it easier to develop
and deploy components without requiring developers to learn and
understand the entire Zope framework.
As of Zope 2.8, the "Five" project has been integrated into the
Zope 2 core. The "Five" project implements a compatibility layer
that allows many Zope 3 components and patterns to be used in
new and existing Zope 2 applications. This provides a number of
benefits::
- availability of Zope 3 technologies in Zope 2 like the
component architecture and declarative configuration
- you can gradually evolve your Zope 2 projects to better plan
for migration to Zope 3
- you start learning about Zope 3 right now, preparing yourself
better for the future. Since Zope 3 is open to contributions,
you could even influence your future for the better ;)
new and existing Zope 2 applications.
Features
The Five integration layer provides support for Zope 3 interfaces,
Zope Configuration Markup Language (ZCML), adapters, views,
utilities, schema-driven content, and Zope 3 add and edit forms.
utilities and schema-driven content.
Note that the Five layer does *not* attempt to provide a ZMI user
interface for Zope 3 components.
Zope 2.8+ includes the essential Zope 3 packages, so it is not
Zope 2 includes the essential Zope 3 packages, so it is not
necessary to install Zope 3.
Zope 3 Interfaces
Everything in the zope.interface package should work. Zope 3 interfaces
are the foundation of the component architecture, and also the foundation
of schemas.
Historically, Zope 2 has used the ``__implements__`` class attribute for
interface declarations. Zope 2 cannot detect Zope 3 interfaces and the
Zope 3 machinery cannot detect Zope 2 interfaces. This is a good thing,
as Zope 2 has no way to deal with Zope 3 interfaces, and Zope 3 cannot
work with Zope 2 interfaces. This means you can safely make a class
declare both a Zope 2 and Zope 3 interface independently from each
other. It's a rare case where you need this - you're usually better off
just switching to ``implements()`` for your application if possible.
Switching from Zope 2 interfaces to Zope 3 interfaces is easy -- just
make your interfaces inherit from ``zope.interface.Interface`` instead
of ``Interface.Interface`` (or ``Interface.Base``). Next, change all
``__implements__`` to ``implements()``.
You will also have to change any calls to ``isImplementedBy`` and such
in your application to ``providedBy``, as ``isImplementedBy`` has been
deprecated (you'll see the DeprecationWarnings in your Zope log).
ZCML
ZCML is the Zope Configuration Markup Language, an XML application.
Zope 3 code consists of a lot of components that can be plugged together
using ZCML.
If you put a 'site.zcml' in the home directory of your Zope instance,
this is the root of the ZCML tree. An example of 'site.zcml' is in
'site.zcml.in'. If you don't place a site.zcml, Five falls back on
'fallback.zcml'.
ZCML in Zope 2 with Five has a special directive, 'five:loadProducts',
to load the ZCML ('meta.zcml', 'configure.zcml') of all installed
Zope 2 products, if available.
Another special directive, 'five:loadProductsOverrides' is available to
load any overriding ZCML (overrides.zcml) in these products. In the
'overrides.zcml' you can override existing views or adapters, in this
or in other products.
The Five integration layer tries to use the Zope 3 ZCML directives where
possible, though it does sometimes support only a subset of the possible
attributes. It also introduces a few directives of its own under the
``five`` namespace. The supported directives are listed per namespace
in alphabetic order below.
zope ``http://namespaces.zope.org/zope``
========================================
adapter
-------
Hook an adapter factory to an interface.
content
-------
Declare interface and permissions on content object. Declares Zope 2
permissions.
permission
----------
Way to make Zope 2 permissions available to Five, ``title`` is
permission name.
redefinePermission
------------------
Redefine a permission in included ZCML as another one.
service
-------
Declare a global service
serviceType
-----------
Declare a type of service.
skin
----
Declare a skin, consisting of layers.
utility
-------
Declare a global utility.
browser ``http://namespaces.zope.org/browser``
==============================================
page
----
Declare a page view for an interface. Permission is a Zope 2
permission.
pages
-----
Declare multiple page views for an interface. Permissions are Zope 2
permissions.
defaultView
-----------
Declare the name of the view that should be used for the default when
viewing the object; i.e. when the object is traversed to without a view.
defaultSkin
-----------
Declare the default skin used.
interface
---------
Define an interface in ZCML.
layer
-----
Declare a layer.
menu
----
Declare a menu
menuItem, menuItems
-------------------
Declare menuItems
five ``http://namespaces.zope.org/five``
========================================
implements
----------
Make a class declare it implements an interface.
loadProducts
------------
Loads ZCML in all Zope 2 products. First processes all ``meta.zcml``
files, then processes all ``configure.zcml`` files.
loadProductsOverrides
---------------------
Loads overriding ZCML in all products (``overrides.zcml``).
traversable
-----------
Make a Zope 2 content class traversable in the Zope 3 manner using
Five. This is used to attached views, resources and other things to
Zope 2 objects.
defaultViewable
---------------
Make a Zope 2 content class use a Zope 3 default view when looking at
it without any paths appended to it. This works then instead of
``index_html`` in Zope 2.
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.
browser:editform
----------------
Create an edit form based on a schema.
browser:addform
---------------
Create an add form based on a schema.
Adapters
Generally, adapters can now be used in Zope 2 just as they are used in
Zope 3.
Zope 3 Views
Zope 3 views work in Zope 2 with Five, including layers and skins. To
make them work however, you need to make a Zope 2 class "traversable".
This can be done by using the 'five:traversable' directive in ZCML.
Schemas and Forms
With the Five layer, it is possible to use schema-based content using
the standard Zope 3 patterns.
Security declarations
Five aims to eradicate declareProtected, ClassSecurityInfo and
initializeClass from your Zope 2 code.
In order to do this, Five provides the Zope 3 way of declaring
permissions from ZCML, but uses the Zope 2 mechanisms to actually set
them. To declare permissions for methods and templates on views you use
the permission attribute on the browser:page directive, and specify a
Zope 2 permission (given a Zope 3 name). You can find a list of these
permissions in permissions.zcml in Five. The permission check takes
place before the view is executed.
The content directive can also be used to declare permissions on Zope 2
content classes. Note however that these permissions will be 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).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment