Commit 1edfa8e6 authored by Hanno Schlichting's avatar Hanno Schlichting

Factor out OFSP

parent 5132aeba
...@@ -33,10 +33,10 @@ Restructuring ...@@ -33,10 +33,10 @@ Restructuring
- Avoid using the ``Products.PythonScripts.standard`` module inside the - Avoid using the ``Products.PythonScripts.standard`` module inside the
database manager ZMI. database manager ZMI.
- Factored out the `Products.MIMETools`, `Products.ExternalMethod` and - Factored out the `Products.ExternalMethod`, `Products.MIMETools`,
`Products.PythonScripts` packages into their own distributions. They will `Products.OFSP` and `Products.PythonScripts` packages into their own
no longer be included by default in Zope 2.14 but live on as independent distributions. They will no longer be included by default in Zope 2.14 but
add-ons. live on as independent add-ons.
- Factored out the `Products.ZSQLMethods` into its own distribution. The - Factored out the `Products.ZSQLMethods` into its own distribution. The
distribution also includes the `Shared.DC.ZRDB` code. The Zope2 distribution distribution also includes the `Shared.DC.ZRDB` code. The Zope2 distribution
......
...@@ -100,6 +100,7 @@ setup(name='Zope2', ...@@ -100,6 +100,7 @@ setup(name='Zope2',
# BBB optional dependencies to be removed in Zope 2.14 # BBB optional dependencies to be removed in Zope 2.14
'Products.ExternalMethod', 'Products.ExternalMethod',
'Products.MIMETools', 'Products.MIMETools',
'Products.OFSP',
'Products.PythonScripts', 'Products.PythonScripts',
], ],
......
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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 AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from OFS.SimpleItem import Item
from Persistence import Persistent
class Draft(Persistent, Item):
"Draft objects"
meta_type = 'Zope Draft'
security = ClassSecurityInfo()
def __init__(self, id, baseid, PATH_INFO):
self.id = id
def icon(self):
return 'p_/broken'
InitializeClass(Draft)
OFSP
OFSP registers common OFS types and provides the general Zope help.
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
"""Version object"""
__version__='$Revision: 1.55 $'[11:-2]
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from OFS.SimpleItem import Item
from Persistence import Persistent
from OFS.ObjectManager import BeforeDeleteException
class VersionException(BeforeDeleteException):
pass
class Version(Persistent, Item):
""" """
meta_type='Version'
security = ClassSecurityInfo()
cookie=''
index_html=None # Ugh.
def __init__(self, id, title, REQUEST):
self.id=id
self.title=title
def icon(self):
return 'p_/broken'
InitializeClass(Version)
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def initialize(context):
context.registerHelp()
context.registerHelpTitle('Zope Help')
Cache manager associations
For background information, see the
<a href="Caching.stx">description of cache management</a>.
The 'Associate' form lets you search for cacheable objects and
make or break multiple cache management associations at once.
Simply select the search criteria then click the 'Locate'
button. Zope will return a list of cacheable objects with a
checkbox for each one. Select or unselect objects and click the
'Save changes' button when you're done.
Cacheable objects
For background information, see the
<a href="Caching.stx">description of cache management</a>.
The 'Cache' tab allows you to associate a cacheable object with a
cache manager. It is only available when at least one cache manager
exists somewhere in the current context.
Use the drop-down box to select which cache manager should be
associated with the object. Some types of objects provide
additional caching options.
DTML methods can be cached according to the DTML namespace. The entry
box on the 'Cache' tab allows you to enter the names
(one per line) that Zope should look up in the namespace to create the
cache key. Note, however, that the namespace lookup operation can be
expensive, so use this feature with care. Also note that it is not
possible for accelerated HTTP cache managers to make use of this feature.
(TODO) Python scripts may also provide further options.
Cache Management: Configurable Caching
Performing some computations in Zope can take a long time or use
a lot of resources. One way to deal with expensive tasks is to
cache them. The first time the computation is requested, the results
are stored in a table or *cache*. Subsequent requests get the results
from the cache. This can result in a dramatic speed increase.
There are so many possible strategies for caching that no one could
possibly come up with them all. Caches can be
stored in memory, on disk, on other computers, or by other means.
Caches can be limited in size or unconstrained. They can be
made to work with only specific types of objects. They can be
tuned in different ways.
So instead of trying to provide for every possible caching strategy,
Zope defines an API called *cache management* that lets developers
write their own caching strategies, or *cache managers*, and lets
site administrators easily connect cacheable objects to those cache
managers.
You can use caching to speed up access to often-requested pages,
reduce disk access and network traffic, and deal with heavy loads.
All these benefits come with risks of excessive caching, however,
so it's important to fine-tune the cache settings. More on this
later.
How to set up caching
The first thing you need to do is create a cache manager instance.
In the Zope management interface, go to a folder containing objects
that would benefit from caching. From the add list, select a
cache manager type such as 'RAM Cache Manager'. Use an ID that
describes the purpose of the cache manager.
Next, visit one of the objects that you want to cache. A new tab
labeled 'Cache' should be visible. Select it. From the drop-down
box, select the cache manager you just created and press the
'Change' button.
The object is now ready to be cached. Visit the 'View' tab. If
the object is a script that takes a long time to render, the first
view will still take just as long as before. But if you're using
a RAM cache manager or similar, the second view should be much faster.
Press the *reload* button in your browser to try it out.
You can associate many objects to a cache manager at once using the
'Associate' tab of all cache managers. Visit the cache manager
object you created and select the 'Associate' tab. Press the
'Locate' button. Zope will locate all cacheable objects in the
folder. Select the checkboxes next to the objects you want to
cache and press the 'Save changes' button.
Inherent risks
Cache managers generally don't know the nature of what is being
cached, so here are some issues that can surface:
- Data that is intended for authorized viewers only can
be inadvertently cached in public caches.
- Data is cached for too long a time.
- If more than one cache is involved, data is purged from one
cache but not the other.
- A method that makes up part of the page sets the caching headers
for the entire response, fooling downstream caches into thinking
the whole response should be cached.
- Result data can depend on any number of objects. Early on it was
decided that the standard cache managers will not try to deduce
dependencies, but instead rely on the user for configuration of
simple dependencies.
Because of these risks, you should be careful when setting up caching.
You'll need to fine-tune the cache settings. Sometimes you'll find
that you can't cache one of your major pages, but that you can cache
pieces of it.
Also remember that caching can actually slow down Zope if it is
applied unscrupulously. You should perform speed tests to verify that
caching really does speed up your site.
Control Panel - Zope administration facilities.
Description
Control Panel provides centralized Zope administration facilities.
In the Control Panel you can restart and shutdown Zope,
access debugging information, manage the Zope database, and manage
versions.
Zope products are located inside the Control Panel.
Control Panel - Contents: Zope system controls
Description
This view displays information about the Zope process and
allows you to restart and/or shutdown Zope.
System Information
'Zope version' -- The version of Zope, the type of the release
(binary/source), the Python version, and the platform the
binaries were compiled on.
'Python version' -- The Python version that Zope is using.
'System Platform' -- The type of machine Zope is running on.
'INSTANCE_HOME' -- The filesystem path where Zope loads add-on
software.
'CLIENT_HOME' -- The filesystem path where Zope stores data and
log files.
'Process ID' -- The PID of the Zope process.
'Running for' -- How long the Zope process has been running.
Management Options
'Database Management' -- Provides access to the database
management functions such as packing and cache management.
'Product Management' -- Provides access to management functions
for installed Zope Products.
Controls
'Shutdown' -- Shutsdown the Zope process. **Important: You will
not be able to access Zope through the web after shutting it
down.**
'Restart' -- Restarts Zope. This control will only appear if Zope
is running under daemon control or as a win32 service. **Note: It
may take a few moments until the Zope comes back up after being
restarted.**
If your browser supports JavaScript, you should be able to add the
following link to your bookmarks/favorites and use it to restart
any Zope site: <a href="javascript:window.open('Control_Panel/manage_restart'+'','restart','width=200,height=200,menubar=no,toolbar=no,scrollbars=no,resizable=yes').focus()" class="std-text">(Restart Zope)</a>.
DTML Document: Content object.
Description
A DTML Document contains web-editable content. A DTML Document
roughly corresponds to a web page.
DTML Documents can contain scripting commands in Document
Template Markup Language (DTML), which allows for dynamic
behavior.
Unlike DTML Methods, DTML Documents have properties and lookup
variables in their own namespace.
\ No newline at end of file
DTML Document/Method - Add: Create a DTML Document/Method
Description
Creates a new DTML Document or Method.
Controls
'Id' -- The id of the DTML Document or Method.
'Title' -- The optional title of the DTML Document or Method.
'File' -- Allows you to upload a file to provide the contents for
the DTML Document or Method. Use the 'Browse...' button to select
a local file.
'Add' -- Create the DTML Document or Method.
'Add and Edit' -- Create the DTML Document or Method, and return
the 'Edit' view of the created object.
DTML Document/Method - Edit: Edit contents.
Description
This view allows you to edit the contents of a DTML Document or
Method.
Information
'Id' -- The id of the DTML Document or Method.
'Size' -- The size of the contents.
'Last modified' -- The time the object was last changed.
Controls
'Title' -- The optional title.
'[Text area]' -- The contents of the DTML Document or Method.
'Taller' and 'Shorter' -- Allows to adjust the height of the
contents text area.
'Wider' and 'Narrower' -- Allows to adjust the width of the
contents text area.
'Save Changes' -- Changes the contents.
**Note: When you change the contents it is parsed for correct
DTML syntax. If there is a syntax error, the contents will not
be changed.**
'File' -- Indicates a file to be uploaded to replace the contents
of the current object. Use the 'Browse ...' button to select a
local file.
'Upload File' -- Upload the file and change the contents.
DTML Document/Method - Proxy: Manage proxy roles.
Description
Proxy roles control security for DTML Documents and Methods.
Normally a DTML Document or Method executes with an intersection
of the owner's and viewer's roles. This means that the DTML can
only perform actions that are available to both the owner and
viewer.
Proxy roles explicitly list the roles that a DTML Document or
Method will execute with. This allows you to carefully control
access. Proxy roles can either increase or decrease access. **Note:
Proxy roles are limited to a subset of the owner's roles.**
Controls
'Proxy Roles' -- The proxy roles for the DTML Document or Method.
'Change' -- Change the proxy roles.
DTML Document/Method - Upload: Upload contents.
Description
Use this view to completely replace the contents of a DTML
Document or Method with the contents of an uploaded file from your
local computer.
Controls
'File' -- The file to upload. Use the 'Browse ...' button to
select a local file.
'Change' -- Upload the file and change the contents.
DTML Document/Method - View: Display
Description
This view displays a DTML Document or Method.
DTML Method: Template object.
Description
DTML Methods provide general templating and scripting facilities.
DTML Documents can contain scripting commands in Document
Template Markup Language (DTML), which allows for dynamic
behavior.
Unlike DTML Documents, DTML Methods have no properties, and lookup
variables in the namespace of the object they are bound to.
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def manage_addDocument(id, title):
"""
Add a DTML Document to the current ObjectManager
"""
class DTMLDocument:
"""
A DTML Document is a Zope object that contains and executes DTML
code. It is useful to represent web pages.
"""
def __call__(client=None, REQUEST={}, RESPONSE=None, **kw):
"""
Calling a DTMLDocument causes the Document to interpret the DTML
code that it contains. The method returns the result of the
interpretation, which can be any kind of object.
To accomplish its task, DTML Document often needs to resolve various
names into objects. For example, when the code '&lt;dtml-var
spam&gt;' is executed, the DTML engine tries to resolve the name
'spam'.
In order to resolve names, the Document must be passed a
namespace to look them up in. This can be done several ways:
* By passing a 'client' object -- If the argument 'client' is
passed, then names are looked up as attributes on the
argument.
* By passing a 'REQUEST' mapping -- If the argument 'REQUEST'
is passed, then names are looked up as items on the
argument. If the object is not a mapping, an TypeError
will be raised when a name lookup is attempted.
* By passing keyword arguments -- names and their values can
be passed as keyword arguments to the Document.
The namespace given to a DTML Document is the composite of
these three methods. You can pass any number of them or none
at all. Names are looked up first in the keyword arguments,
then in the client, and finally in the mapping.
A DTMLDocument implicitly pass itself as a client argument in
addition to the specified client, so names are looked up in
the DTMLDocument itself.
Passing in a namespace to a DTML Document is often referred to
as providing the Document with a *context*.
DTML Documents can be called three ways.
From DTML
A DTML Document can be called from another DTML
Method or Document::
<dtml-var standard_html_header>
<dtml-var aDTMLDocument>
<dtml-var standard_html_footer>
In this example, the Document 'aDTMLDocument' is being called
from another DTML object by name. The calling method
passes the value 'this' as the client argument and the
current DTML namespace as the REQUEST argument. The above
is identical to this following usage in a DTML Python
expression::
<dtml-var standard_html_header>
<dtml-var "aDTMLDocument(_.None, _)">
<dtml-var standard_html_footer>
From Python
Products, External Methods, and Scripts can call a DTML
Document in the same way as calling a DTML Document from a
Python expression in DTML; as shown in the previous example.
By the Publisher
When the URL of a DTML Document is fetched from Zope, the
DTML Document is called by the publisher. The REQUEST
object is passed as the second argument to the Document.
Permission -- 'View'
"""
def manage_edit(data, title):
"""
Change the DTML Document, replacing its contents with 'data'
and
changing its title.
The data argument may be a file object or a string.
Permission -- 'Change DTML Documents'
"""
def document_src():
"""
Returns the unrendered source text of the DTML Document.
Permission -- 'View management screens'
"""
def get_size():
"""
Returns the size of the unrendered source text of the DTML
Document in bytes.
Permission -- 'View'
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def manage_addDTMLMethod(id, title):
"""
Add a DTML Method to the current ObjectManager
"""
class DTMLMethod:
"""
A DTML Method is a Zope object that contains and executes DTML
code. It can act as a template to display other objects. It can
also hold small pieces of content which are inserted into other
DTML Documents or DTML Methods.
The DTML Method's id is available via the 'document_id'
variable and the title is available via the 'document_title'
variable.
"""
def __call__(client=None, REQUEST={}, **kw):
"""
Calling a DTMLMethod causes the Method to interpret the DTML
code that it contains. The method returns the result of the
interpretation, which can be any kind of object.
To accomplish its task, DTML Method often needs to resolve various
names into objects. For example, when the code '&lt;dtml-var
spam&gt;' is executed, the DTML engine tries to resolve the name
'spam'.
In order to resolve names, the Method must be passed a
namespace to look them up in. This can be done several ways:
* By passing a 'client' object -- If the argument 'client' is
passed, then names are looked up as attributes on the
argument.
* By passing a 'REQUEST' mapping -- If the argument 'REQUEST'
is passed, then names are looked up as items on the
argument. If the object is not a mapping, an TypeError
will be raised when a name lookup is attempted.
* By passing keyword arguments -- names and their values can
be passed as keyword arguments to the Method.
The namespace given to a DTML Method is the composite of
these three methods. You can pass any number of them or none
at all. Names will be looked up first in the keyword argument,
next in the client and finally in the mapping.
Unlike DTMLDocuments, DTMLMethods do not look up names in
their own instance dictionary.
Passing in a namespace to a DTML Method is often referred to
as providing the Method with a *context*.
DTML Methods can be called three ways:
From DTML
A DTML Method can be called from another DTML Method or
Document::
<dtml-var standard_html_header>
<dtml-var aDTMLMethod>
<dtml-var standard_html_footer>
In this example, the Method 'aDTMLMethod' is being called
from another DTML object by name. The calling method passes
the value 'this' as the client argument and the current DTML
namespace as the REQUEST argument. The above is identical
to this following usage in a DTML Python expression::
<dtml-var standard_html_header>
<dtml-var "aDTMLMethod(_.None, _)">
<dtml-var standard_html_footer>
From Python
Products, External Methods, and Scripts can call a DTML
Method in the same way as calling a DTML Method from a
Python expression in DTML; as shown in the previous example.
By the Publisher
When the URL of a DTML Method is fetched from Zope, the DTML
Method is called by the publisher. The REQUEST object is
passed as the second argument to the Method.
Permission -- 'View'
"""
def manage_edit(data, title):
"""
Change the DTML Method, replacing its contents with 'data' and
changing its title.
The data argument may be a file object or a string.
Permission -- 'Change DTML Methods'
"""
def document_src():
"""
Returns the unrendered source text of the DTML Method.
Permission -- 'View management screens'
"""
def get_size():
"""
Returns the size of the unrendered source text of the DTML
Method in bytes.
Permission -- 'View'
"""
Database Management: Zope Database Management.
Description
Database Management gives you access to Zope database controls.
The Zope database stores Zope objects.
You can manage the size of the Zope database by packing it. You
can control memory usage with the Zope database cache parameters.
Database Management - Activity
Description
This view displays activity in the ZODB over a period of time.
It shows how many objects were loaded and stored. You can use
this information to determine the optimal memory cache size for
your Zope application. You can also use it to discover
applications that write to the database too often.
Information
'Keep History' -- Lets you define how many seconds of history
to keep for analysis. 3600 is one hour. 86400 is one day.
Note that in the current implementation, analysis data is
kept only in memory and is never stored to disk, so each time
you restart, you lose the historical information.
'Displayed Range' -- Tells you what period of time is displayed
by the chart.
'Show current chart' -- Redisplays the chart for the current
time.
The chart contains a bar graph. The rightmost bar shows the
most recent activity. The red portion indicates the number of
objects stored and the blue portion indicates the number of
objects loaded during that time period. To the right of the
graph there is a total.
If you click on a bar, the chart will zoom in on the time
period for just that bar. You will see the details of the
activity during that short time period. Click the "Show current
chart" button to return to the chart for the current time.
How to use this information
Once Zope has loaded enough objects, the ZODB cache consistently
keeps in the cache the number of objects you specify under the
"Cache Parameters" tab. Because the cache size is so consistent
and ZODB is so transparent to both the user and
application developer, Zope applications can invisibly develop a
performance problem by loading objects from ZODB on every request.
Also, if the cache size is set too high, Zope will consume more
RAM than it needs. You need to find a good balance that fits
your site. If the bar chart shows a large number of objects being
loaded all the time, increase the cache size, which will increase
memory usage but should also increase performance. If the
chart shows little activity even though the site is visited
frequently, you can reduce the cache size so Zope will consume less
RAM.
As your site changes, its cache size requirements may change also,
so remember to make adjustments over time.
If the graph shows a lot of writes (a significant portion of red),
some application or product may be writing to the database too
frequently. Check the "undo" log for clues. Note that the activity
graph does not show activity in mounted databases, so objects loaded
and stored by the sessioning machinery are not counted in the graph.
Database Management - Cache Parameters: Zope database cache.
Description
This view allows you to view Zope database cache statistics and
set cache parameters. The Zope database cache operates by keeping
recently used objects in memory to improve performance. A large
cache improves object access speed, but increases memory usage. A
small cache reduces memory usage but may slow down object access
speed.
Information
'Total number of objects in the database' -- Indicates the
number of persistent objects in the Zope database. All of these
objects are stored on disk, some of them are in memory too.
'Total number of objects in memory from all caches' --
Indicates the number of objects which are currently
cached in memory. This is a good indication of the amount
of memory used by Zope.
'Target number of objects in memory per cache' -- Indicates
the target number of objects to have in each cache at any
given time. Zope will allow the number of objects to grow
above this number while processing a request, but will always
reduce the level to this number at the end of each request.
This parameter is one factor affecting the amount of memory
use by Zope. It controls the amount of memory used per cache,
the other factor is the number of caches. In general,
Zope uses one cache per worker thread (specified by the '-t'
switch on the command line)
'Total number of objects in each cache' -- This table displays
one row for each object cache.
'Number of objects in memory' -- This value should not stay
larger than the configured target size for longer than one
transaction.
Note that the total number at the bottom of this column
should be the same as the figure in the top half of the
page. It may be slightly different because there is a small
time interval between the calculation of the two totals.
'Number of ghost objects' -- Ghost objects are those
which only have a tiny memory footprint because their full
state has not been loaded. You generally do not need to
worry about the number of ghost objects because they are
so small.
Database Management - Database: Zope database information and pack.
Description
This view gives you information about the size and location of the
Zope database. The Zope database stores all Zope objects.
You can reduce the size of your Zope database by packing
it. Packing removes old revisions of objects, thus freeing up
space but also limiting your ability to undo object changes.
Controls
'Pack' -- Pack will remove all versions of objects from the Zope
database. This will reduce the size of your database. **Note Pack
will prevent you from undoing some or all old transactions.**
You can control which old revisions of objects are removed from
the database by specifying how many days old the revisions must be
to be removed. If you specify 0 days old, then all old object
revisions will be removed.
Database Management - Flush Cache: Zope Database cache flush.
Description
This view allows you to flush the Zope database cache.
Controls
'Minimize' -- Allows you to remove all persistent objects from
memory. They will be reloaded again on demand, when they
are next accessed.
This diff is collapsed.
WebDAV Lock Management - Manage Locks
Description
This view allows you to manage WebDAV WriteLocks. WebDAV, as an
extension to the HTTP Protocol, allows the users to create *Write
Locks* as a way of trying to avoid the "lost updates problem".
However, sometimes WriteLocks may become abandoned. This may be due
to users forgetting to unlock their resources, software failures
such as crashes, etc. In many cases, locks might just time out
before this becomes a problem. In cases where it's not, this
control panel object may be used to locate locked resources inside
of Zope and clear *ALL* of their WebDAV writelocks.
Controls
'Path' -- This lets you enter a path (based off the root of the Zope
site) to filter down the list of locked objects. Clicking 'Go'
executes the filter.
When locked objects are found, they are listed one per line with a
checkbox that can be used to select the item. Also listed in each
line is information about the lock(s) on the object - the user who
created the lock (identified by the path to the user folder the user
is defined in), and the locktoken that identifies the lock. In the
majority of cases, there should only be one lock per object.
'[Checkbox]' -- Selects locked items.
'Select All' -- This button marks all items displayed as selected.
'Deselect All' -- After 'Select All' has been clicked, it changes to
say 'Deselect All'. Clicking this deselects all displayed items.
'Unlock objects' -- Unlocks the selected items.
\ No newline at end of file
Debug Information - Debugging Information: Online Zope debugging
Description
This view provides simple debugging information to help product
authors find memory leaks in their products as well as Zope
itself.
Debugging Information
* The Zope version
* The Python version
* The system platform name
* The filesystem path of the Zope core software, add-on software,
and data files.
* The ID number of the Zope process (if available on your platform)
* The length of time Zope has been running
* The Python module search paths (sys.path).
* The top refcounts, including a table listing the changes since
* the last snapshot
* The open object database connections
The Zope version, Python version, and system platform name are
used to verify compatibility between Zope, Python, and your
system. On platforms where the process ID number is available,
the Zope process can be managed using a more forceful means than
is available through the web.
Refcounts
The top refcounts list lets you take a look at what is being
stored by Zope in memory. The scrollable list shows how many
instances of each type of object are currently in memory.
If there are items in the list with a very high refcount, there
is a good chance there is a memory leak in a product or in Zope.
Using the snapshot and refresh options allow you to determine
which operations are causing memory leaks.
Open Connections
A database connection usually corresponds with an HTTP request.
The left column shows the time at which the connection was
opened. If there is a request that has been running for a long
time you may need to restart Zope to kill the corresponding
thread. The middle column usually shows the state of the REQUEST
object with size of the cache for that connection in
parentheses. The right column shows information about the
version the user is working in.
Controls
'Update Snapshot' -- Takes the current refcounts and store them in
memory. Then each time the debugging page is reloaded, the table
will show the difference in refcounts between the snapshot and the
current state.
'Refresh' -- Reloads and updates the debugging information.
'Auto refresh interval' -- The number of seconds to wait before
automatically refreshing the debugging information.
'Start auto refresh' -- Begins automatically refreshing the
debugging information.
'Stop auto refresh' -- Ends automatic refreshing of the debugging
information.
Debug Management - Profile: Performance testing.
Description
Zope can provide real-time profiling information. Profiling helps
product authors to speed up sections of code that are taking too
long to perform their tasks.
In order to use profiling Zope has to be started with the
'PROFILE_PUBLISHER' environment variable set to a non-empty
value. If the variable is set to a valid filesystem path, then the
accumulated profile information will be dumped to the named file
when Zope is shut down. If the variable is simply set to a
non-empty value that is not a valid filesystem path then Zope will
still run in profiling mode, but profile information will only be
available through the web interface.
**Note: Profiling will slow Zope performance significantly.**
Once Zope has started in profiling mode visit your site with your Web
browser - Zope will accumulate profiling information as you are
working with your site. When you want to view the profiling
information, visit the Control Panel, click on the 'Debugging
information' link and select the 'Profiling' tab.
The profiling screen will show a list of methods and the amount of
time each method is taking. Multiple views are available by
changing the sort order and pushing the "update" button. The
online profiler is based on the standard Python profile module.
For specific information on the meaning of the profile
information, see the standard Python documentation for the
'profile' module.
When you are done profiling turn profiling off by restarting Zope
without the 'PROFILE_PUBLISHER' environment variable set.
Controls
'Sort' -- How to sort function calls.
'Limit' -- How many function calls to display.
'Update' -- Updates the profiling information.
See Also
"Python profiler documentation":http://www.python.org/doc/current/lib/module-profile.html
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def manage_addFile(id, file='', title='', precondition='', content_type=''):
"""
Add a new File object.
Creates a new File object 'id' with the contents of 'file'
"""
class File:
"""
A File is a Zope object that contains file content. A File object
can be used to upload or download file information with Zope.
Using a File object in Zope is easy. The most common usage is
to display the contents of a file object in a web page. This is
done by simply referencing the object from DTML::
<dtml-var standard_html_header>
<dtml-var FileObject>
<dtml-var standard_html_footer>
A more complex example is presenting the File object for
download by the user. The next example displays a link to every
File object in a folder for the user to download::
<dtml-var standard_html_header>
<ul>
<dtml-in "ObjectValues('File')">
<li><a href="<dtml-var absolute_url>"><dtml-var
id></a></li>
</dtml-in>
</ul>
<dtml-var standard_html_footer>
In this example, the 'absolute_url' method and 'id' are used to
create a list of HTML hyperlinks to all of the File objects in
the current Object Manager.
Also see ObjectManager for details on the 'objectValues'
method.
"""
def update_data(data, content_type=None, size=None):
"""
Updates the contents of the File with 'data'.
The 'data' argument must be a string. If 'content_type' is not
provided, then a content type will not be set. If size is not
provided, the size of the file will be computed from 'data'.
Permission -- Python only
"""
def getSize():
"""
Returns the size of the file in bytes.
Permission -- 'View'
"""
def getContentType():
"""
Returns the content type of the file.
Permission -- 'View'
"""
File: Generic File.
Description
File objects can hold any binary or textual data such as zip
files, Java applets, video, text, etcetera.
Files provide a very limited through the web interface and are
appropriate for data that will not be manipulated very much by
Zope.
File/Image - Add: Create a File or Image.
Description
Creates a new File or Image.
Controls
'Id' -- The id of the File or Image.
**Note: If you do not provide an Id then the file name will be used.**
'Title' -- The optional title of the File or Image.
'File' -- The file to upload. use the 'Browse...' button to
select a local file.
'Add' -- Creates a new File or Image.
File - Edit: File Properties.
Description
This view allows you to edit File properties.
Form Elements
'Title' -- The optional title of the File.
'Content type' -- The content type of the file. Zope will try to
guess an appropriate content type when you upload a File.
'Precondition' -- Allows you to specify a precondition for the
File. A precondition is a method or document which is executed
before the File is viewed or downloaded. If the precondition
raises an exception then the File cannot be viewed.
'File Content' -- If the content of the file object is text-based
and small enough to be edited with a Web form, a textarea
containing the content of the file will be displayed. You can make
changes to the content in this text area and click the 'Save
Changes' button to update the file content.
'Last Modified' -- The time that the object was last changed. This
is only displayed if the file data is non-text or too large to be
edited with a Web form.
'File Size' -- The size (in bytes) of the image data. This is only
displayed if the file data is not text or too large to be edited
with a Web form.
'File Data' -- The file to upload. Use the 'Browse...' button to
select a local file.
'Upload' -- Uploads the file.
File/Image - Upload: File upload.
Description
Use this view to completely replace the File or Image with an
uploaded file from your local computer.
Controls
'Data' -- The file to upload. Use the 'Browse...' button to select
a local file.
'Change' -- Uploads the file.
File - View: File Preview.
Description
This view downloads a File to your local computer.
ObjectManager - Find: Search Zope.
Description
This view allows you to search for Zope objects.
To find objects you specify search criteria in the top frame and
then click the 'Find' button. The find results will appear in the
button frame. For more search criteria click the 'Advanced...'
link.
Controls
'Find objects of type' -- The types of objects to find.
'with ids' -- The ids of objects to find. You may specify one or
more ids separated by spaces.
'containing' -- The text that must be contained in the *body* of
found items. Text in the title or other attribute fields will not
be searched.
'modified' -- Allows you to restrict your search to a specific
time period. You can choose whether objects 'before' or 'after' a
specified date/time.
**Note: The date should be a DateTime string such as 'YYYY/MM/DD
hh:mm:ss', 'YYYY-MM-DD', or 'hh:mm'.**
'Search only in this folder' -- Find objects in this folder.
'Search all subfolders' -- Find objects in all subfolders.
'Find' -- Find objects matching the find criteria.
\ No newline at end of file
ObjectManager - Advanced Find: Search Zope.
Description
This view allows you to search for Zope objects.
To find objects you specify search criteria in the top frame and
then click the 'Find' button. The find results will appear in the
button frame. For fewer search criteria click the 'Simple...'
link.
Controls
'Find objects of type' -- The types of objects to find.
'with ids' -- The ids of objects to find. You may specify one or
more ids separated by spaces.
'containing' -- The text that must be contained in the *body* of
found items. Text in the title or other attribute fields will not
be searched.
'expr' -- A DTML expressions to restrict found items. If the
expression evaluates to false in the context of the found object,
the object is rejected.
'modified' -- Allows you to restrict your search to a specific
time period. You can choose whether objects 'before' or 'after' a
specified date/time.
**Note: The date should be a DateTime string such as 'YYYY/MM/DD
hh:mm:ss', 'YYYY-MM-DD', or 'hh:mm'.**
'where the roles' -- Use in combination with 'have permission'
option. Restricts found objects to those which provide the the
indicated permissions for the indicated roles.
'have permission' -- Use in combination with 'where the
roles'.Restricts found objects to those which provide the the
indicated permissions for the indicated roles.
'Search only in this folder' -- Find objects in this folder.
'Search all subfolders' -- Find objects in all subfolders.
'Find' -- Find objects matching the find criteria.
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def manage_addFolder(id, title):
"""
Add a Folder to the current ObjectManager
Permission -- 'Add Folders'
"""
class Folder:
"""
A Folder is a generic container object in Zope.
Folders are the most common ObjectManager subclass in Zope.
"""
Folder - Container object.
Description
Folders allow you to organize Zope objects by grouping them together
inside Folders. Folder contain other Zope objects including other
Folders.
Folders behave like directories in a filesystem.
Folder - Add: Add a Folder.
Description
This view allows you to create a new Folder.
Controls
'Id' -- The id of the Folder.
'Title' -- The optional title of the Folder.
'Create public interface' -- Creates an 'index_html' Page Template
inside the new Folder.
'Create user folder' -- Creates a User Folder inside the new
Folder to hold authorization information for the Folder.
'Add' -- Creates a new Folder.
Folder - View: Folder Preview.
Description
This view allows you to preview the public appearance of a Folder.
This view will only be available if the Folder contains (or acquires)
an 'index_html' object.
\ No newline at end of file
History: Object history.
Description
DTML Documents and Methods keep a history of their contents. This
view allows you to browse, compare, and revert to old versions.
Controls
Historical revisions are described by a date, a user and a
URL. This describes at what time by whom and at what URL the
object was changed.
Click on a historical version to view the object as it existed at
a given point in history.
'[Checkbox]' -- Select a historical revision.
'Copy to present' -- Changes the object to the same state as the
selected historical revision.
'Compare' -- Summarizes the difference between two historical
revisions. If you select one historical revision it will be
compared to the current state.
The comparison shows the changes needed to change the older
revision to match the newer revision.
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
def manage_addImage(id, file, title='', precondition='', content_type=''):
"""
Add a new Image object.
Creates a new Image object 'id' with the contents of 'file'.
"""
class Image:
"""
An Image is a Zope object that contains image content. An Image
object can be used to upload or download image information with
Zope.
Image objects have two properties the define their dimension,
'height' and 'width'. These are calculated when the image is
uploaded. For image types that Zope does not understand, these
properties may be undefined.
Using a Image object in Zope is easy. The most common usage is
to display the contents of an image object in a web page. This
is done by simply referencing the object from DTML::
<dtml-var standard_html_header>
<dtml-var ImageObject>
<dtml-var standard_html_footer>
This will generate an HTML IMG tag referencing the URL to the
Image. This is equivalent to::
<dtml-var standard_html_header>
<dtml-with ImageObject>
<img src="<dtml-var absolute_url>">
</dtml-with>
<dtml-var standard_html_footer>
You can control the image display more precisely with the 'tag'
method. For example::
<dtml-var "ImageObject.tag(border='5', align='left')">
"""
def tag(height=None, width=None, alt=None,
scale=0, xscale=0, yscale=0, **args):
"""
This method returns a string which contains an HTML IMG tag
reference to the image.
Optionally, the 'height', 'width', 'alt', 'scale', 'xscale'
and 'yscale' arguments can be provided which are turned into
HTML IMG tag attributes. Note, 'height' and 'width' are
provided by default, and 'alt' comes from the 'title'
property.
Keyword arguments may be provided to support other or future IMG
tag attributes. The one exception to this is the HTML Cascading
Style Sheet tag 'class'. Because the word 'class' is a reserved
keyword in Python, you must instead use the keyword argument
'css_class'. This will be turned into a 'class' HTML tag attribute
on the rendered 'img' tag.
Permission -- 'View'
"""
Image - Image object.
Description
The Image object allows you to store image files in Zope.
Images can be displayed in DTML by calling them. For example,
&lt;dtml-var myImageId&gt;' The Image will generate an HTML 'IMG'
tag with all the correct attributes.
Image - Edit: Image Properties.
Description
This view allows you to edit Image properties.
Form Elements
'Title' -- The optional title of the Image.
'Content type' -- The content type of the Image. Zope will try to
guess an appropriate content type when you upload an Image.
'Preview' -- Displays a preview version of the actual image
content. If an image is very large, the preview may be scaled to a
smaller size.
'Last Modified' -- The time that the object was last changed.
'File Size' -- The size (in bytes) of the image data.
'File Data' -- The file to upload. Use the 'Browse...' button to
select a local file.
'Upload' -- Uploads the file.
Image - View: Preview Image.
Description
This view displays the Image.
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class ObjectManager:
"""
An ObjectManager contains other Zope objects. The contained
objects are Object Manager Items.
To create an object inside an object manager use 'manage_addProduct'::
self.manage_addProduct['OFS'].manage_addFolder(id, title)
In DTML this would be::
<dtml-call "manage_addProduct['OFS'].manage_addFolder(id, title)">
These examples create a new Folder inside the current
ObjectManager.
'manage_addProduct' is a mapping that provides access to product
constructor methods. It is indexed by product id.
Constructor methods are registered during product initialization
and should be documented in the API docs for each addable
object.
"""
def objectIds(type=None):
"""
This method returns a list of the ids of the contained
objects.
Optionally, you can pass an argument specifying what object
meta_type(es) to restrict the results to. This argument can be
a string specifying one meta_type, or it can be a list of
strings to specify many.
Example::
<dtml-in objectIds>
<dtml-var sequence-item>
<dtml-else>
There are no sub-objects.
</dtml-in>
This DTML code will display all the ids of the objects
contained in the current Object Manager.
Permission -- 'Access contents information'
"""
def objectValues(type=None):
"""
This method returns a sequence of contained objects.
Like objectItems and objectIds, it accepts one argument,
either a string or a list to restrict the results to objects
of a given meta_type or set of meta_types.
Example::
<dtml-in expr="objectValues('Folder')">
<dtml-var icon>
This is the icon for the: <dtml-var id> Folder<br>.
<dtml-else>
There are no Folders.
</dtml-in>
The results were restricted to Folders by passing a
meta_type to 'objectValues' method.
Permission -- 'Access contents information'
"""
def objectItems(type=None):
"""
This method returns a sequence of (id, object) tuples.
Like objectValues and objectIds, it accepts one argument,
either a string or a list to restrict the results to objects
of a given meta_type or set of meta_types.
Each tuple's first element is the id of an object contained in
the Object Manager, and the second element is the object
itself.
Example::
<dtml-in objectItems>
id: <dtml-var sequence-key>,
type: <dtml-var meta_type>
<dtml-else>
There are no sub-objects.
</dtml-in>
Permission -- 'Access contents information'
"""
def superValues(type):
"""
This method returns a list of objects of a given meta_type(es)
contained in the Object Manager and all its parent Object
Managers.
The type argument specifies the meta_type(es). It can be a string
specifying one meta_type, or it can be a list of strings to
specify many.
Permission -- Python only
"""
def manage_delObjects(ids):
"""
Removes one or more children from the Object Manager. The
'ids' argument is either a list of child ids, or a single
child id.
Permission -- 'Delete objects'
"""
def __getitem__(id):
"""
Returns a child object given a child id. If there is no child
with the given id, a KeyError is raised. This method makes it easy
to refer to children that have id with file extensions. For
example::
page=folder['index.html']
Note: this function only finds children; it doesn't return
properties or other non-child attributes.
Note: this function doesn't use acquisition to find
children. It only returns direct children of the Object
Manager. By contrast, using dot notation or 'getattr' will
locate children (and other attributes) via acquisition if
necessary.
Permission -- 'Access contents information'
"""
def setBrowserDefaultId(id='', acquire=0):
"""
Sets the id of the object or method used as the default method when
the object manager is published. If acquire is set then the default
method id will be acquired from the parent container.
Permission -- 'Manage folderish settings'
"""
def getBrowserDefaultId(acquire=0):
"""
Returns the id of the object or method used as the default when the
object manager is published. By default, this setting is acquired. If
the acquire argument is true, then the return value will be acquired
from the parent if it is not set locally. Otherwise, None is returned
if the default id is not set on this object manager.
Permission -- 'View'
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class ObjectManagerItem:
"""
A Zope object that can be contained within an Object Manager.
Almost all Zope objects that can be managed through the web are
Object Manager Items.
ObjectMangerItems have these instance
attributes:
'title' -- The title of the object.
This is an optional one-line string description of the object.
'meta_type' -- A short name for the type of the object.
This is the name that shows up in product add list for the
object and is used when filtering objects by type.
This attribute is provided by the object's class and should
not be changed directly.
'REQUEST' -- The current web request.
This object is acquired and should not be set.
"""
def getId():
"""
Returns the object's id.
The 'id' is the unique name of the object within its parent
object manager. This should be a string, and can contain
letters, digits, underscores, dashes, commas, and spaces.
This method replaces direct access to the 'id' attribute.
Permission -- Always available
"""
def title_or_id():
"""
If the title is not blank, return it, otherwise
return the id.
Permission -- Always available
"""
def title_and_id():
"""
If the title is not blank, the return the title
followed by the id in parentheses. Otherwise return the id.
Permission -- Always available
"""
def manage_workspace():
"""
This is the web method that is called when a user selects an
item in a object manager contents view or in the Zope
Management navigation view.
Permission -- 'View management screens'
"""
def this():
"""
Return the object.
This turns out to be handy in two situations. First, it
provides a way to refer to an object in DTML expressions.
The second use for this is rather deep. It provides a way to
acquire an object without getting the full context that it was
acquired from. This is useful, for example, in cases where
you are in a method of a non-item subobject of an item and you
need to get the item outside of the context of the subobject.
Permission -- Always available
"""
def absolute_url(relative=None):
"""
Return the absolute URL of the object.
This a canonical URL based on the object's physical
containment path. It is affected by the virtual host
configuration, if any, and can be used by external
agents, such as a browser, to address the object.
If the relative argument is provided, with a true value, then
the value of virtual_url_path() is returned.
Some Products incorrectly use '/'+absolute_url(1) as an
absolute-path reference. This breaks in certain virtual
hosting situations, and should be changed to use
absolute_url_path() instead.
Permission -- Always available
"""
def absolute_url_path():
"""
Return the path portion of the absolute URL of the object.
This includes the leading slash, and can be used as an
'absolute-path reference' as defined in RFC 2396.
Permission -- Always available
"""
def virtual_url_path():
"""
Return a URL for the object, relative to the site root.
If a virtual host is configured, the URL is a path relative to
the virtual host's root object. Otherwise, it is the physical
path. In either case, the URL does not begin with a slash.
Permission -- Always available
"""
def getPhysicalRoot():
"""
Returns the top-level Zope Application object.
Permission -- Python only
"""
def getPhysicalPath():
"""
Get the path of an object from the root, ignoring virtual
hosts.
Permission -- Always available
"""
def unrestrictedTraverse(path, default=None):
"""
Return the object obtained by traversing the given path from
the object on which the method was called. This method begins
with "unrestricted" because (almost) no security checks are
performed.
If an object is not found then the 'default' argument will be
returned.
Permission -- Python only
"""
def restrictedTraverse(path, default=None):
"""
Return the object obtained by traversing the given path from
the object on which the method was called, performing security
checks along the way.
If an object is not found then the 'default' argument will be
returned.
Permission -- Always available
"""
ObjectManager - Contents: Edit contained objects.
Description
This view displays the contained objects and allows you to add,
delete and change them.
Each contained object is displayed on a line and is identified by
an icon, an id and a title in parenthesis. Additionally, the size
(if applicable) and the date during which the object was last modified
are displayed. You can manage an object by clicking on its identifying
link.
Sorting
You can sort contained objects by type, name (id), size, or modification
date. To do so, click on the appropriate column heading. Clicking
a second time on any column heading will reverse the sort on that
field.
Controls
'[Checkbox]' -- Selects the object in order to perform operations
on it. The operations you can perform are rename, cut, copy,
delete, and export. Some operations may not be visible if they are
not allowed.
'Rename' -- Changes the ids of the selected objects.
'Cut' -- Cuts selected objects and place them into the
clipboard. This is similar to cut in most file managers. Cut
objects can be pasted in a new location. When cut objects are
pasted into another location the old objects are deleted.
'Copy' -- Copies selected objects and place them in the
clipboard. This is similar to copy in most file managers. Copied
objects can be pasted in a new location.
'Paste' -- Allows you to paste objects from the clipboard into
this object. **Note: This option will only appear if objects have
previously been copied or cut.**
'Delete' -- Deletes the selected objects. Deleted objects are
*not* placed in the clipboard.
'Import/Export' -- Imports or exports a Zope object.
'Available Objects' -- Selects a type of object to add.
'Add' -- Adds an object specified in 'Available Objects'.
'Select All (Deselect All)' -- Toggles between selecting and
deselecting each item currently displayed in the contents view.
**Note: This control will only appear if your browser is
javascript-enabled.**
Folder - Import/Export: Import/export Zope objects.
Description
This view allows you to import or export Zope objects. Imported
objects will be inserted into the current object. Exported objects
will be saved to a file on the Zope server or downloaded to the
local client.
Controls
'Export object id' -- The id of the object to be exported.
**Note: The exported object must be contained by the current
object.**
'Export to' -- Where you want to save the exported file. 'Download
to local machine' downloads the export file to your client, 'Save to
file server' saves the export file to the Zope 'var' directory.
'XML format?' -- Whether the exported object
is in a binary format or in XML format.
'Export' -- Exports the object.
'Import file name' -- The filename of the Zope export file that
you would like to import. The file must be located in the Zope
'import' directory.
'Import' -- Imports the object.
ObjectManager - Rename: Change object ids.
Description
This view allows you to change the id of one or more objects.
Controls
'to' -- The new id of each object. The
default value is the old id.
'OK' -- Changes the ids of the objects.
'Cancel' -- Cancels renaming operation.
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
#
##############################################################################
class OrderSupport:
""" Ordered container mixin class.
This is an extension to the regular ObjectManager. It saves the objects in
order and lets you change the order of the contained objects. This is
particular helpful, if the order does not depend on object attributes, but
is totally user-specific.
"""
def moveObjectsByDelta(ids, delta, subset_ids=None):
""" Move specified sub-objects by delta.
If delta is higher than the possible maximum, objects will be moved to
the bottom. If delta is lower than the possible minimum, objects will
be moved to the top.
If subset_ids is not None, delta will be interpreted relative to the
subset specified by a sequence of ids. The position of objects that
are not part of this subset will not be changed.
The order of the objects specified by ids will always be preserved. So
if you don't want to change their original order, make sure the order
of ids corresponds to their original order.
If an object with id doesn't exist an error will be raised.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def moveObjectsUp(ids, delta=1, subset_ids=None):
""" Move specified sub-objects up by delta in container.
If no delta is specified, delta is 1. See moveObjectsByDelta for more
details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def moveObjectsDown(ids, delta=1, subset_ids=None):
""" Move specified sub-objects down by delta in container.
If no delta is specified, delta is 1. See moveObjectsByDelta for more
details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def moveObjectsToTop(ids, subset_ids=None):
""" Move specified sub-objects to top of container.
See moveObjectsByDelta for more details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def moveObjectsToBottom(ids, subset_ids=None):
""" Move specified sub-objects to bottom of container.
See moveObjectsByDelta for more details.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def orderObjects(key, reverse=None):
""" Order sub-objects by key and direction.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
def getObjectPosition(id):
""" Get the position of an object by its id.
Permission -- Access contents information
Returns -- Position
"""
def moveObjectToPosition(id, position):
""" Move specified object to absolute position.
Permission -- Manage properties
Returns -- Number of moved sub-objects
"""
ObjectManager with OrderSupport - Contents: Edit contained objects.
Description
This view displays the contained objects and allows you to add,
delete, change and order them.
Each contained object is displayed on a line and is identified by
an icon, an id and a title in parenthesis. Additionally, the size
(if applicable) and the date during which the object was last modified
are displayed. You can manage an object by clicking on its identifying
link.
Sorting vs. Ordering
You can sort contained objects by type, name (id), size,
modification date or by position (fixed order, see below). To do so,
click on the appropriate column heading. Clicking a second time
on any column heading (except position) will reverse the sort
on that field. Sorting takes no actions on the contained
objects, but will only change the users personal point of view.
You can order contained objects with the controls on the bottom
of the page. The order of objects ('sort by position') is stored
in the database and remains fixed until it is changed by another
user.
Controls
'[Checkbox]' -- Selects the object in order to perform operations
on it. The operations you can perform are rename, cut, copy,
delete, and export. Some operations may not be visible if they are
not allowed.
'Rename' -- Changes the ids of the selected objects.
'Cut' -- Cuts selected objects and place them into the
clipboard. This is similar to cut in most file managers. Cut
objects can be pasted in a new location. When cut objects are
pasted into another location the old objects are deleted.
'Copy' -- Copies selected objects and place them in the
clipboard. This is similar to copy in most file managers. Copied
objects can be pasted in a new location.
'Paste' -- Allows you to paste objects from the clipboard into
this object. **Note: This option will only appear if objects have
previously been copied or cut.**
'Delete' -- Deletes the selected objects. Deleted objects are
*not* placed in the clipboard.
'Import/Export' -- Imports or exports a Zope object.
'Available Objects' -- Selects a type of object to add.
'Add' -- Adds an object specified in 'Available Objects'.
'Select All (Deselect All)' -- Toggles between selecting and
deselecting each item currently displayed in the contents view.
**Note: This control will only appear if your browser is
javascript-enabled.**
'Set View as Default' -- Sets current sorted view as default contents view
for this folder. **Note: This option will only appear if your current
sorted view is not the default view.**
**The following options will only appear in Position view:**
'Up' -- Moves selected objects up by the selected amount of steps
(default is 1).
'Down' -- Moves selected objects down by the selected amount of steps
(default is 1).
'Top' -- Moves selected objects to the top of the page.
'Bottom' -- Moves selected objects to the bottom of the page.
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
#
##############################################################################
def manage_addOrderedFolder(id, title='', createPublic=0, createUserF=0,
REQUEST=None):
""" Add a new ordered Folder object with id *id*.
If the 'createPublic' and 'createUserF' parameters are set to any true
value, an 'index_html' and a 'UserFolder' objects are created respectively
in the new folder.
"""
class OrderedFolder:
""" Extends the default Folder by order support.
"""
Product Management: Contains Zope Products.
Description
The Product Management Folder contains installed Zope Products.
The notion of installed Zope products is deprecated.
Product - Zope extension.
Description
Products were an old mechanism by which you could extend Zope.
The product concept is deprecated.
Product - Refresh: Reload a filesystem-based Python product.
Description
This view allows you to reload filesystem-based product code
without restarting Zope. This function is useful during
development of products.
To enable your product to be refreshed, it is required that you
put a file called 'refresh.txt' in your product directory.
It can optionally contain a warning for others who might use
the refresh function.
(Producting refreshing is not perfect. Some products, especially
"hotfix" style products which patch Zope, should not be refreshed.
That's why 'refresh.txt' is required. Most products are safe to
refresh, however.)
There are two modes of operation. You can visit your product's
'Refresh' tab and manually push the refresh button. Or you can
turn on "auto-refresh" mode, which causes Zope to periodically
scan the modification time of the Python files that make up your
product and execute a refresh operation in the background.
**NOTE**: Don't enable auto-refresh for too many products at once.
Scanning file modification times can take a lot of time per
request.
You can also select dependent refreshable products. If you have
a product that subclasses from a product you're working on,
you'll want to enable refresh for both products and add the
product that subclasses as a dependent of the product you're
modifying. This enables subclasses to be updated.
Controls
'Refresh this product' -- The manual refresh button.
'Auto refresh mode' -- Check the checkbox to enable auto-refresh.
'Dependent auto-refreshable products' -- A list of other products
which are auto-refreshable.
How it works
To execute a refresh, Zope looks in the sys.modules dictionary
for modules with names that start with the prefix for your product.
It tries to scan for dependencies between the modules that make
up your product then uses Python's reload() function for each
module in order. Then it sets a flag that will cause ZODB to dump
its cache on the next connection so that changes to persistent
classes will take effect.
To implement auto-refresh, Zope stores a PersistentMapping called
RefreshData on the database root object (below the Application
object). The contents of the PersistentMapping are examined at the
moment a database connection is opened by ZApplication. The
PersistentMapping contains a list of which products have auto-refresh
enabled. For each product with auto-refresh enabled, Zope compares
the file mod times with the last recorded times and executes a
refresh if there are any changes.
Properties - Define properties.
Description
This view allows you to edit and define properties on the current
object.
Property types
'boolean' -- 1 or 0.
'date' -- A 'DateTime' value, for example '12/31/1999 15:42:52 PST'.
'float' -- A decimal number, for example '12.4'.
'int' -- An integer number, for example, '12'.
'lines', 'ulines' -- A list of strings, one per line.
'long' -- A long integer, for example '12232322322323232323423'.
'string', 'ustring' -- A string of characters, for example 'This is a string'.
'text', 'utext' -- A multi-line string, for example a paragraph.
'tokens', 'utokens' -- A list of strings separated by white space, for example
'one two three'.
'selection' -- A string selected by a pop-up menu.
'multiple selection' -- A list of strings selected by a selection list.
Some of these textual properties come in two forms. The 'u'-prefixed
form stores Unicode text. The form without the prefix stores a python
plain string object, which is commonly assumed to contain latin-1
text.
Controls
Editing Properties
Existing properties can be edited by selecting them.
'[Checkbox]' -- Select the properties to change.
'Property' -- The value of the property.
'Save Changes' -- Changes the value of the selected properties.
'Delete' -- Deletes the selected properties.
Creating new properties
'Id' -- The id of the property.
'Type' -- The type of the property.
'Value' -- The value of the property.
**Note: When creating 'selection' and 'multiple selection'
properties, specify the name of another property (or method)
as the 'Value'. This property (or method) should return a
list of strings will be used to provide choices for the
selection.**
'Add' -- Creates a new property.
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class PropertyManager:
"""
A Property Manager object has a collection of typed attributes
called properties. Properties can be managed through the web or
via DTML.
In addition to having a type, properties can be writable or
read-only and can have default values.
"""
def getProperty(id, d=None):
"""
Return the value of the property 'id'. If the property is not
found the optional second argument or None is returned.
Permission -- 'Access contents information'
"""
def getPropertyType(id):
"""
Get the type of property 'id'. Returns None if no such
property exists.
Permission -- 'Access contents information'
"""
def hasProperty(id):
"""
Returns a true value if the Property Manager has the property
'id'. Otherwise returns a false value.
Permission -- 'Access contents information'
"""
def propertyIds():
"""
Returns a list of property ids.
Permission -- 'Access contents information'
"""
def propertyValues():
"""
Returns a list of property values.
Permission -- 'Access contents information'
"""
def propertyItems():
"""
Return a list of (id, property) tuples.
Permission -- 'Access contents information'
"""
def propertyMap():
"""
Returns a tuple of mappings, giving meta-data for properties.
The meta-data includes 'id', 'type', and 'mode'.
Permission -- 'Access contents information'
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class PropertySheet:
"""
A PropertySheet is an abstraction for organizing and working
with a set of related properties. Conceptually it acts like a
container for a set of related properties and meta-data describing
those properties. A PropertySheet may or may not provide a web
interface for managing its properties.
"""
def xml_namespace():
"""
Return a namespace string usable as an xml namespace
for this property set. This may be an empty string if
there is no default namespace for a given property sheet.
Permission -- Python only
"""
def getProperty(id, d=None):
"""
Get the property 'id', returning the optional second
argument or None if no such property is found.
Permission -- Python only
"""
def getPropertyType(id):
"""
Get the type of property 'id'. Returns None if no such
property exists.
Permission -- Python only
"""
def hasProperty(id):
"""
Returns true if 'self' has a property with the given 'id',
false otherwise.
Permission -- 'Access contents information'
"""
def propertyIds():
"""
Returns a list of property ids.
Permission -- 'Access contents information'
"""
def propertyValues():
"""
Returns a list of actual property values.
Permission -- 'Access contents information'
"""
def propertyItems():
"""
Return a list of (id, property) tuples.
Permission -- 'Access contents information'
"""
def propertyMap():
"""
Returns a tuple of mappings, giving meta-data for properties.
Permssion -- Python only
"""
def propertyInfo():
"""
Returns a mapping containing property meta-data.
Permission -- Python only
"""
def manage_addProperty(id, value, type, REQUEST=None):
"""
Add a new property with the given 'id', 'value' and 'type'.
These are the
property types:
'boolean' -- 1 or 0.
'date' -- A 'DateTime' value, for example '12/31/1999 15:42:52 PST'.
'float' -- A decimal number, for example '12.4'.
'int' -- An integer number, for example, '12'.
'lines' -- A list of strings, one per line.
'long' -- A long integer, for example '12232322322323232323423'.
'string' -- A string of characters, for example 'This is a string'.
'text' -- A multi-line string, for example a paragraph.
'tokens' -- A list of strings separated by white space, for example
'one two three'.
'selection' -- A string selected by a pop-up menu.
'multiple selection' -- A list of strings selected by a selection list.
This method will use the passed in 'type' to try to convert
the 'value' argument to the named type. If the given 'value'
cannot be converted, a ValueError will be raised.
The value given for 'selection' and 'multiple selection'
properites may be an attribute or method name. The attribute
or method must return a sequence values.
If the given 'type' is not recognized, the 'value' and 'type'
given are simply stored blindly by the object.
If no value is passed in for 'REQUEST', the method will return
'None'. If a value is provided for 'REQUEST' (as it will when
called via the web), the property management form for the
object will be rendered and returned.
This method may be called via the web, from DTML or from
Python code.
Permission -- 'Manage Properties'
"""
def manage_changeProperties(REQUEST=None, **kw):
"""
Change object properties by passing either a REQUEST object or
name=value parameters
Some objects have "special" properties defined by product
authors that cannot be changed. If you try to change one of
these properties through this method, an error will be raised.
Note that no type checking or conversion happens when this
method is called, so it is the caller's responsibility to
ensure that the updated values are of the correct type.
*This should probably change*.
If a REQUEST object is passed (as it will be when
called via the web), the method will return an HTML message
dialog. If no REQUEST is passed, the method returns 'None' on
success.
This method may be called via the web, from DTML or from
Python code.
Permission -- 'Manage Properties'
"""
def manage_delProperties(ids=None, REQUEST=None):
"""
Delete one or more properties with the given 'ids'. The 'ids'
argument should be a sequence (tuple or list) containing the
ids of the properties to be deleted. If 'ids' is empty no
action will be taken. If any of the properties named in 'ids'
does not exist, an error will be raised.
Some objects have "special" properties defined by product
authors that cannot be deleted. If one of these properties is
named in 'ids', an HTML error message is returned.
If no value is passed in for 'REQUEST', the method will return
None. If a value is provided for 'REQUEST' (as it will be when
called via the web), the property management form for the
object will be rendered and returned.
This method may be called via the web, from DTML or from
Python code.
Permission -- 'Manage Properties'
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class PropertySheets:
"""
A PropertySheet is an abstraction for organizing and working with
a set of related properties. Conceptually it acts like a container
for a set of related properties and meta-data describing those
properties. PropertySheet objects are accessed through a
PropertySheets object that acts as a collection of PropertySheet
instances.
Objects that support property sheets (objects that support the
PropertyManager interface) have a
'propertysheets' attribute (a PropertySheets instance) that is the
collection of PropertySheet objects. The PropertySheets object
exposes an interface much like a Python mapping, so that
individual PropertySheet objects may be accessed via
dictionary-style key indexing.
"""
def values():
"""
Return a sequence of all of the PropertySheet objects
in the collection.
Permission -- Python only
"""
def items():
"""
Return a sequence containing an '(id, object)' tuple for
each PropertySheet object in the collection.
Permission -- Python only
"""
def get(name, default=None):
"""
Return the PropertySheet identified by 'name', or the value
given in 'default' if the named PropertySheet is not found.
Permission -- Python only
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class Request:
"""
The request object encapsulates all of the information regarding
the current request in Zope. This includes, the input headers,
form data, server data, and cookies.
The request object is a mapping object that represents a
collection of variable to value mappings. In addition, variables
are divided into five categories:
- Environment variables
These variables include input headers, server data, and
other request-related data. The variable names are as <a
href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
in the <a
href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
specification</a>
- Form data
These are data extracted from either a URL-encoded query
string or body, if present.
- Cookies
These are the cookie data, if present.
- Lazy Data
These are callables which are deferred until explicitly
referenced, at which point they are resolved (called) and
the result stored as "other" data, ie regular request data.
Thus, they are "lazy" data items. An example is SESSION objects.
Lazy data in the request may only be set by the Python
method set_lazy(name,callable) on the REQUEST object. This
method is not callable from DTML or through the web.
- Other
Data that may be set by an application object.
The request object may be used as a mapping object, in which case
values will be looked up in the order: environment variables,
other variables, form data, and then cookies.
These special variables are set in
the Request:
'PARENTS' -- A list of the objects traversed to get to the
published object. So, 'PARENTS[0]' would be the ancestor of
the published object.
'REQUEST' -- The Request object.
'RESPONSE' -- The Response object.
'PUBLISHED' -- The actual object published as a result of
url traversal.
'URL' -- The URL of the Request without query string.
*URLn* -- 'URL0' is the same as 'URL'. 'URL1' is the same as
'URL0' with the last path element removed. 'URL2' is the same
as 'URL1' with the last element removed. Etcetera.
For example if URL='http://localhost/foo/bar', then
URL1='http://localhost/foo' and URL2='http://localhost'.
*URLPATHn* -- 'URLPATH0' is the path portion of 'URL',
'URLPATH1' is the path portion of 'URL1', and so on.
For example if URL='http://localhost/foo/bar', then
URLPATH1='/foo' and URLPATH2='/'.
*BASEn* -- 'BASE0' is the URL up to but not including the Zope
application object. 'BASE1' is the URL of the Zope application
object. 'BASE2' is the URL of the Zope application object with
an additional path element added in the path to the published
object. Etcetera.
For example if URL='http://localhost/Zope.cgi/foo/bar', then
BASE0='http://localhost', BASE1='http://localhost/Zope.cgi',
and BASE2='http://localhost/Zope.cgi/foo'.
*BASEPATHn* -- 'BASEPATH0' is the path portion of 'BASE0',
'BASEPATH1' is the path portion of 'BASE1', and so on.
'BASEPATH1' is the externally visible path to the root Zope
folder, equivalent to CGI's 'SCRIPT_NAME', but virtual-host aware.
For example if URL='http://localhost/Zope.cgi/foo/bar', then
BASEPATH0='/', BASEPATH1='/Zope.cgi', and BASEPATH2='/Zope.cgi/foo'.
"""
def set(name, value):
"""
Create a new name in the REQUEST object and assign it a value.
This name and value is stored in the 'Other' category.
Permission -- Always available
"""
def get_header(name, default=None):
"""
Return the named HTTP header, or an optional default argument
or None if the header is not found. Note that both original
and CGI header names without the leading 'HTTP_' are
recognized, for example, 'Content-Type', 'CONTENT_TYPE' and
'HTTP_CONTENT_TYPE' should all return the Content-Type header,
if available.
Permission -- Always available
"""
def has_key(key):
"""
Returns a true value if the REQUEST object contains key,
returns a false value otherwise.
Permission -- Always available
"""
def keys():
"""
Returns a sorted sequence of all keys in the REQUEST object.
Permission -- Always available
"""
def items():
"""
Returns a sequence of (key, value) tuples for all the keys in
the REQUEST object.
Permission -- Always available
"""
def values():
"""
Returns a sequence of values for all the keys in the REQUEST
object.
Permission -- Always available
"""
def setServerURL(protocol=None, hostname=None, port=None):
"""
Sets the specified elements of 'SERVER_URL', also affecting
'URL', 'URLn', 'BASEn', and 'absolute_url()'.
Provides virtual hosting support.
Permission -- Always available
"""
def setVirtualRoot(path, hard=0):
"""
Alters 'URL', 'URLn', 'URLPATHn', 'BASEn', 'BASEPATHn', and
'absolute_url()' so that the current object has path 'path'.
If 'hard' is true, 'PARENTS' is emptied.
Provides virtual hosting support. Intended to be called from
publishing traversal hooks.
Permission -- Always available
"""
def text():
"""
Returns information about the request as text. This is useful
for debugging purposes. The returned text lists form contents,
cookies, special variables, and evironment variables.
Permissions -- Always available
"""
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This 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
#
##############################################################################
class Response:
"""
The Response object represents the response to a Zope request.
"""
def setStatus(status, reason=None):
'''
Sets the HTTP status code of the response; the argument may
either be an integer or one of the following strings:
OK,
Created,
Accepted,
NoContent,
MovedPermanently,
MovedTemporarily,
NotModified,
BadRequest,
Unauthorized,
Forbidden,
NotFound,
InternalError,
NotImplemented,
BadGateway,
ServiceUnavailable
that will be converted to the correct integer value.
Permission -- Always available
'''
def setHeader(name, value):
'''
Sets an HTTP return header "name" with value "value", clearing
the previous value set for the header, if one exists. If the
literal flag is true, the case of the header name is
preserved, otherwise word-capitalization will be performed on
the header name on output.
Permission -- Always available
'''
def addHeader(name, value):
'''
Set a new HTTP return header with the given value, while
retaining any previously set headers with the same name.
Permission -- Always available
'''
def setBase(base):
"""
Set the base URL for the returned document.
Permission -- Always available
"""
def appendCookie(name, value):
'''
Returns an HTTP header that sets a cookie on cookie-enabled
browsers with a key "name" and value "value". If a value for the
cookie has previously been set in the response object, the new
value is appended to the old one separated by a colon.
Permission -- Always available
'''
def expireCookie(name, **kw):
'''
Cause an HTTP cookie to be removed from the browser
The response will include an HTTP header that will remove the cookie
corresponding to "name" on the client, if one exists. This is
accomplished by sending a new cookie with an expiration date
that has already passed. Note that some clients require a path
to be specified - this path must exactly match the path given
when creating the cookie. The path can be specified as a keyword
argument.
Permission -- Always available
'''
def setCookie(name, value, quoted=True, **kw):
'''
Set an HTTP cookie on the browser
The response will include an HTTP header that sets a cookie on
cookie-enabled browsers with a key "name" and value
"value". This overwrites any previously set value for the
cookie in the Response object.
By default, the cookie value will be enclosed in double quotes.
To suppress the double quotes you can pass the "quoted" argument
with a False value such as False or 0.
Permission -- Always available
'''
def appendHeader(name, value, delimiter=","):
'''
Append a value to a header.
Sets an HTTP return header "name" with value "value",
appending it following a comma if there was a previous value
set for the header.
Permission -- Always available
'''
def redirect(location, lock=0):
"""
Cause a redirection without raising an error. If the "lock"
keyword argument is passed with a true value, then the HTTP
redirect response code will not be changed even if an error
occurs later in request processing (after redirect() has
been called).
Permission -- Always available
"""
def write(data):
"""
Return data as a stream
HTML data may be returned using a stream-oriented interface.
This allows the browser to display partial results while
computation of a response to proceed.
The published object should first set any output headers or
cookies on the response object.
Note that published objects must not generate any errors
after beginning stream-oriented output.
Permission -- Always available
"""
Undo - Undo management actions.
Description
This view allows you to undo changes to Zope's database.
Zope allows you to undo changes to its database. Changes are
defined in terms of transactions which group together related
changes. Each transaction has a URL and a user associated with
it. In general the URL of a transaction indicates the URL that was
called to initiate the changes.
If an object was changed several times and you want to recover a
version several changes back, you have to undo all the
intermediary transactions as well.
Controls
'[Checkbox]' -- Selects one or more transactions. Each line shows one
transaction. The transactions are sorted by date and time. The
checkbox in the front allows you to check the transactions you
would like to undo. The next entry on the line is the URL that
caused the transaction, followed by the user who committed the
transaction and the time transaction was performed.
'Earlier Transactions' -- Allows you to see transactions that were
performed earlier then the ones you currently see.
'Later Transactions' -- Allows you to see transactions that were
performed later then the ones you currently see.
'Undo' -- Undo the selected transactions.
Z Search Interface: Search wizard.
Description
A Search Interface is a wizard that creates search and results forms.
The Search Interface will create a search-input form and a report
for displaying the search results. You can search ZCatalogs, or any other
objects that implement the searchable interface.
Z Search Interface - Add: Add a Zope Search Interface
Description
This view allows you to create new a search results document and
optionally a search input form.
Controls
'Select one or more seachable objects' -- The objects to be searched.
'Report Id' -- The id of the results document.
'Report Title' -- The optional title of the results document.
'Report Style' -- Search results format.
'Search Input Id' -- The id of the input form.
**Note: If you do not enter a search input id then no search
input form will be created.**
'Search Input Title' -- The optional title of the input form.
'Add' -- Creates a results document and optionally a search input
form.
call: Call a method
The 'call' tag lets you call a method without inserting the results
into the DTML output.
Syntax
'call' tag syntax::
<dtml-call Variable|expr="Expression">
If the call tag uses a variable, the methods arguments are passed
automatically by DTML just as with the 'var' tag. If the method is
specified in a expression, then you must pass the arguments yourself.
Examples
Calling by variable name::
<dtml-call UpdateInfo>
This calls the 'UpdateInfo' object automatically passing arguments.
Calling by expression::
<dtml-call expr="RESPONSE.setHeader('content-type', 'text/plain')">
See Also
"var tag":dtml-var.stx
comment: Comments DTML
The comment tag lets you document your DTML with comments. You can
also use it to temporarily disable DTML tags by commenting them out.
Syntax
'comment' tag syntax::
<dtml-comment>
</dtml-comment>
The 'comment' tag is a block tag. The contents of the block are
not executed, nor are they inserted into the DTML output.
Examples
Documenting DTML::
<dtml-comment>
This content is not executed and does not appear in the
output.
</dtml-comment>
Commenting out DTML::
<dtml-comment>
This DTML is disabled and will not be executed.
<dtml-call someMethod>
</dtml-comment>
This diff is collapsed.
if: Tests Conditions
The 'if' tags allows you to test conditions and to take different
actions depending on the conditions. The 'if' tag mirrors Python's
'if/elif/else' condition testing statements.
Syntax
If tag syntax::
<dtml-if ConditionVariable|expr="ConditionExpression">
[<dtml-elif ConditionVariable|expr="ConditionExpression">]
...
[<dtml-else>]
</dtml-if>
The 'if' tag is a block tag. The 'if' tag and optional 'elif' tags
take a condition variable name or a condition expression, but not
both. If the condition name or expression evaluates to true then
the 'if' block is executed. True means not zero, an empty string
or an empty list. If the condition variable is not found then the
condition is considered false.
If the initial condition is false, each 'elif' condition is tested
in turn. If any 'elif' condition is true, its block is
executed. Finally the optional 'else' block is executed if none of
the 'if' and 'elif' conditions were true. Only one block will be
executed.
Examples
Testing for a variable::
<dtml-if snake>
The snake variable is true
</dtml-if>
Testing for expression conditions::
<dtml-if expr="num > 5">
num is greater than five
<dtml-elif expr="num < 5">
num is less than five
<dtml-else>
num must be five
</dtml-if>
See Also
"Python Tutorial: If Statements":http://www.python.org/doc/current/tut/node6.html#SECTION006100000000000000000
in: Loops over sequences
The 'in' tag gives you powerful controls for looping over sequences
and performing batch processing.
Syntax
'in' tag syntax::
<dtml-in SequenceVariable|expr="SequenceExpression">
[<dtml-else>]
</dtml-in>
The 'in' block is repeated once for each item in the sequence
variable or sequence expression. The current item is pushed on to
the DTML namespace during each executing of the 'in' block.
If there are no items in the sequence variable or expression, the
optional 'else' block is executed.
Attributes
mapping -- Iterates over mapping objects rather than
instances. This allows values of the mapping objects to be
accessed as DTML variables.
no_push_item -- Inhibit pushing sequence-item onto the namespace
stack.
reverse -- Reverses the sequence.
sort=string -- Sorts the sequence by the given attribute name.
start=int -- The number of the first item to be shown, where
items are numbered from 1.
end=int -- The number of the last item to be shown, where items
are numbered from 1.
size=int -- The size of the batch.
skip_unauthorized -- Don't raise an exception if an unauthorized
item is encountered.
orphan=int -- The desired minimum batch size. This controls how
sequences are split into batches. If a batch smaller than the
orphan size would occur, then no split is performed, and a batch
larger than the batch size results.
For example, if the sequence size is 12, the batch size is 10
the orphan size is 3, then the result is one batch with all 12
items since splitting the items into two batches would result in
a batch smaller than the orphan size.
The default value is 0.
overlap=int -- The number of items to overlap between batches. The
default is no overlap.
previous -- Iterates once if there is a previous batch. Sets batch
variables for previous sequence.
next -- Iterates once if there is a next batch. Sets batch variables
for the next sequence.
prefix=string -- Provide versions of the tag variables that start
with this prefix instead of "sequence", and that use underscores
(_) instead of hyphens (-). The prefix must start with a letter and
contain only alphanumeric characters and underscores (_).
sort_expr=expression -- Sorts the sequence by an attribute named
by the value of the expression. This allows you to sort on
different attributes.
reverse_expr=expression -- Reverses the sequence if the expression
evaluates to true. This allows you to selectively reverse the
sequence.
Tag Variables
Current Item Variables
These variables describe the
current item.
sequence-item -- The current item.
sequence-key -- The current key. When looping over tuples of the
form '(key,value)', the 'in' tag interprets them as
'(sequence-key, sequence-item)'.
sequence-index -- The index starting with 0 of the current item.
sequence-number -- The index starting with 1 of the current item.
sequence-roman -- The index in lowercase Roman numerals of the
current item.
sequence-Roman -- The index in uppercase Roman numerals of the
current item.
sequence-letter -- The index in lowercase letters of the current
item.
sequence-Letter -- The index in uppercase letters of the current
item.
sequence-start -- True if the current item is the first item.
sequence-end -- True if the current item is the last item.
sequence-even -- True if the index of the current item is even.
sequence-odd -- True if the index of the current item is odd.
sequence-length -- The length of the sequence.
sequence-var-*variable* -- A variable in the current item. For
example, 'sequence-var-title' is the 'title' variable of the
current item. Normally you can access these variables directly
since the current item is pushed on the DTML namespace. However
these variables can be useful when displaying previous and next
batch information.
sequence-index-*variable* -- The index of a variable of the
current item.
Summary Variables
These variable summarize information about numeric item
variables. To use these variable you must loop over objects
(like database query results) that have numeric variables.
total-*variable* -- The total of all occurrences of an item variable.
count-*variable* -- The number of occurrences of an item variable.
min-*variable* -- The minimum value of an item variable.
max-*variable* -- The maximum value of an item variable.
mean-*variable* -- The mean value of an item variable.
variance-*variable* -- The variance of an item variable with
count-1 degrees of freedom.
variance-n-*variable* -- The variance of an item variable with
n degrees of freedom.
standard-deviation-*variable* -- The standard-deviation of an
item variable with count-1 degrees of freedom.
standard-deviation-n-*variable* -- The standard-deviation of
an item variable with n degrees of freedom.
Grouping Variables
These variables allow you to track changes in current item
variables.
first-*variable* -- True if the current item is the first with
a particular value for a variable.
last-*variable* -- True if the current item is the last with a
particular value for a variable.
Batch Variables
sequence-query -- The query string with the 'start' variable
removed. You can use this variable to construct links to next
and previous batches.
sequence-step-size -- The batch size.
previous-sequence -- True if the current batch is not the
first one. Note, this variable is only true for the first loop
iteration.
previous-sequence-start-index -- The starting index of the
previous batch.
previous-sequence-start-number -- The starting number of the
previous batch. Note, this is the same as
'previous-sequence-start-index' + 1.
previous-sequence-end-index -- The ending index of the previous
batch.
previous-sequence-end-number -- The ending number of the
previous batch. Note, this is the same as
'previous-sequence-end-index' + 1.
previous-sequence-size -- The size of the previous batch.
previous-batches -- A sequence of mapping objects with
information about all previous batches. Each mapping object has
these keys 'batch-start-index', 'batch-end-index', and
'batch-size'.
next-sequence -- True if the current batch is not the last
batch. Note, this variable is only true for the last loop
iteration.
next-sequence-start-index -- The starting index of the next
sequence.
next-sequence-start-number -- The starting number of the next
sequence. Note, this is the same as 'next-sequence-start-index'
+ 1.
next-sequence-end-index -- The ending index of the next
sequence.
next-sequence-end-number -- The ending number of the next
sequence. Note, this is the same as 'next-sequence-end-index'
+ 1.
next-sequence-size -- The size of the next index.
next-batches -- A sequence of mapping objects with information
about all following batches. Each mapping object has these keys
'batch-start-index', 'batch-end-index', and 'batch-size'.
Examples
Looping over sub-objects::
<dtml-in objectValues>
title: <dtml-var title><br>
</dtml-in>
Looping over two sets of objects, using prefixes::
<dtml-let rows="(1,2,3)" cols="(4,5,6)">
<dtml-in rows prefix="row">
<dtml-in cols prefix="col">
<dtml-var expr="row_item * col_item"><br>
<dtml-if col_end>
<dtml-var expr="col_total_item * row_mean_item">
</dtml-if>
</dtml-in>
</dtml-in>
</dtml-let>
Looping over a list of '(key, value)' tuples::
<dtml-in objectItems>
id: <dtml-var sequence-key>, title: <dtml-var title><br>
</dtml-in>
Creating alternate colored table cells::
<table>
<dtml-in objectValues>
<tr <dtml-if sequence-odd>bgcolor="#EEEEEE"
<dtml-else>bgcolor="#FFFFFF"
</dtml-if>
<td><dtml-var title></td>
</tr>
</dtml-in>
</table>
Basic batch processing::
<p>
<dtml-in largeSequence size=10 start=start previous>
<a href="<dtml-var absolute_url><dtml-var sequence-query>start=<dtml-var previous-sequence-start-number>">Previous</a>
</dtml-in>
<dtml-in largeSequence size=10 start=start next>
<a href="<dtml-var absolute_url><dtml-var sequence-query>start=<dtml-var next-sequence-start-number>">Next</a>
</dtml-in>
</p>
<p>
<dtml-in largeSequence size=10 start=start>
<dtml-var sequence-item>
</dtml-in>
</p>
This example creates *Previous* and *Next* links to navigate
between batches. Note, by using 'sequence-query', you do not lose
any GET variables as you navigate between batches.
let: Defines DTML variables
The 'let' tag defines variables in the DTML namespace.
Syntax
'let' tag syntax::
<dtml-let [Name=Variable][Name="Expression"]...>
</dtml-let>
The 'let' tag is a block tag. Variables are defined by tag
arguments. Defined variables are pushed onto the DTML namespace
while the 'let' block is executed. Variables are defined by
attributes. The 'let' tag can have one or more attributes with
arbitrary names. If the attributes are defined with double quotes
they are considered expressions, otherwise they are looked up by
name. Attributes are processed in order, so later attributes can
reference, and/or overwrite earlier ones.
Examples
Basic usage::
<dtml-let name="'Bob'" ids=objectIds>
name: <dtml-var name>
ids: <dtml-var ids>
</dtml-let>
Using the 'let' tag with the 'in' tag::
<dtml-in expr="(1,2,3,4)">
<dtml-let num=sequence-item
index=sequence-index
result="num*index">
<dtml-var num> * <dtml-var index> = <dtml-var result>
</dtml-let>
</dtml-in>
This yields::
1 * 0 = 0
2 * 1 = 2
3 * 2 = 6
4 * 3 = 12
See Also
"with tag":dtml-with.stx
mime: Formats data with MIME
The 'mime' tag allows you to create MIME encoded data. It is chiefly
used to format email inside the 'sendmail' tag.
Syntax
'mime' tag syntax::
<dtml-mime>
[<dtml-boundry>]
...
</dtml-mime>
The 'mime' tag is a block tag. The block is can be divided by one
or more 'boundry' tags to create a multi-part MIME message. 'mime'
tags may be nested. The 'mime' tag is most often used inside the
'sendmail' tag.
Attributes
Both the 'mime' and 'boundry' tags
have the same attributes.
encode=string -- MIME Content-Transfer-Encoding header, defaults
to 'base64'. Valid encoding options include 'base64',
'quoted-printable', 'uuencode', 'x-uuencode', 'uue', 'x-uue',
and '7bit'. If the 'encode' attribute is set to '7bit' no
encoding is done on the block and the data is assumed to be in a
valid MIME format.
type=string -- MIME Content-Type header.
type_expr=string -- MIME Content-Type header as a variable
expression. You cannot use both 'type' and 'type_expr'.
name=string -- MIME Content-Type header name.
name_expr=string -- MIME Content-Type header name as a variable
expression. You cannot use both 'name' and 'name_expr'.
disposition=string -- MIME Content-Disposition header.
disposition_expr=string -- MIME Content-Disposition header as a
variable expression. You cannot use both 'disposition' and
'disposition_expr'.
filename=string -- MIME Content-Disposition header filename.
filename_expr=string -- MIME Content-Disposition header filename
as a variable expression. You cannot use both 'filename' and
'filename_expr'.
skip_expr=string -- A variable expression that if true, skips
the block. You can use this attribute to selectively include
MIME blocks.
Examples
Sending a file attachment::
<dtml-sendmail>
To: <dtml-recipient>
Subject: Resume
<dtml-mime type="text/plain" encode="7bit">
Hi, please take a look at my resume.
<dtml-boundary type="application/octet-stream" disposition="attachment"
encode="base64" filename_expr="resume_file.getId()"><dtml-var expr="resume_file.read()"></dtml-mime>
</dtml-sendmail>
See Also
"Python Library: mimetools":http://www.python.org/doc/current/lib/module-mimetools.html
raise: Raises an exception
The 'raise' tag raises an exception, mirroring the Python 'raise'
statement.
Syntax
'raise' tag syntax::
<dtml-raise ExceptionName|ExceptionExpression>
</dtml-raise>
The 'raise' tag is a block tag. It raises an exception. Exceptions
can be an exception class or a string. The contents of the tag are
passed as the error value.
Examples
Raising a KeyError::
<dtml-raise KeyError></dtml-raise>
Raising an HTTP 404 error::
<dtml-raise NotFound>Web Page Not Found</dtml-raise>
See Also
"try tag":dtml-try.stx
"Python Tutorial: Errors and
Exceptions":http://www.python.org/doc/current/tut/node10.html
"Python Built-in
Exceptions":http://www.python.org/doc/current/lib/module-exceptions.html
return: Returns data
The 'return' tag stops executing DTML and returns data. It mirrors
the Python 'return' statement.
Syntax
'return' tag syntax::
<dtml-return ReturnVariable|expr="ReturnExpression">
Stops execution of DTML and returns a variable or expression. The
DTML output is not returned. Usually a return expression is more
useful than a return variable. Scripts largely obsolete this tag.
Examples
Returning a variable::
<dtml-return result>
Returning a Python dictionary::
<dtml-return expr="{'hi':200, 'lo':5}">
sendmail: Sends email with SMTP
The 'sendmail' tag sends an email message
using SMTP.
Syntax
'sendmail' tag syntax::
<dtml-sendmail>
</dtml-sendmail>
The 'sendmail' tag is a block tag. It either requires a 'mailhost'
or a 'smtphost' argument, but not both. The tag block is sent as
an email message. The beginning of the block describes the email
headers. The headers are separated from the body by a blank
line. Alternately the 'To', 'From' and 'Subject' headers can be
set with tag arguments.
Attributes
mailhost -- The name of a Zope MailHost object
to use to send email. You cannot specify both a mailhost and a smtphost.
smtphost -- The name of a SMTP server used to send email. You
cannot specify both a mailhost and a smtphost.
port -- If the smtphost attribute is used, then the port attribute
is used to specify a port number to connect to. If not specified,
then port 25 will be used.
mailto -- The recipient address or a list of recipient addresses
separated by commas. This can also be specified with the 'To' header.
mailfrom -- The sender address. This can also be specified with
the 'From' header.
subject -- The email subject. This can also be specified with the
'Subject' header.
Examples
Sending an email message using a Mail Host::
<dtml-sendmail mailhost="mailhost">
To: <dtml-var recipient>
From: <dtml-var sender>
Subject: <dtml-var subject>
Dear <dtml-var recipient>,
You order number <dtml-var order_number> is ready.
Please pick it up at your soonest convenience.
</dtml-sendmail>
See Also
"RFC 821 (SMTP Protocol)":http://www.ietf.org/rfc/rfc0821.txt
"mime tag":dtml-mime.stx
sqlgroup: Formats complex SQL expressions
The 'sqlgroup' tag formats complex boolean SQL expressions. You can
use it along with the 'sqltest' tag to build dynamic SQL queries
that tailor themselves to the environment. This tag is used in SQL
Methods.
Syntax
'sqlgroup' tag syntax::
<dtml-sqlgroup>
[<dtml-or>]
[<dtml-and>]
...
</dtml-sqlgroup>
The 'sqlgroup' tag is a block tag. It is divided into blocks with
one or more optional 'or' and 'and' tags. 'sqlgroup' tags can be
nested to produce complex logic.
Attributes
required=boolean -- Indicates whether the group is required. If it
is not required and contains nothing, it is excluded from the DTML
output.
where=boolean -- If true, includes the string "where". This is
useful for the outermost 'sqlgroup' tag in a SQL 'select' query.
Examples
Sample usage::
select * from employees
<dtml-sqlgroup where>
<dtml-sqltest salary op="gt" type="float" optional>
<dtml-and>
<dtml-sqltest first type="nb" multiple optional>
<dtml-and>
<dtml-sqltest last type="nb" multiple optional>
</dtml-sqlgroup>
If 'first' is 'Bob' and 'last' is 'Smith, McDonald' it renders::
select * from employees
where
(first='Bob'
and
last in ('Smith', 'McDonald')
)
If 'salary' is 50000 and 'last' is 'Smith' it renders::
select * from employees
where
(salary > 50000.0
and
last='Smith'
)
Nested 'sqlgroup' tags::
select * from employees
<dtml-sqlgroup where>
<dtml-sqlgroup>
<dtml-sqltest first op="like" type="nb">
<dtml-and>
<dtml-sqltest last op="like" type="nb">
<dtml-sqlgroup>
<dtml-or>
<dtml-sqltest salary op="gt" type="float">
</dtml-sqlgroup>
Given sample arguments, this template renders to SQL like so::
select * form employees
where
(
(
name like 'A*'
and
last like 'Smith'
)
or
salary > 20000.0
)
See Also
"sqltest tag":dtml-sqltest.stx
sqltest: Formats SQL condition tests
The 'sqltest' tag inserts a condition test into SQL code. It tests a
column against a variable. This tag is used in SQL Methods.
Syntax
'sqltest' tag syntax::
<dtml-sqltest Variable|expr="VariableExpression">
The 'sqltest' tag is a singleton. It inserts a SQL condition test
statement. It is used to build SQL queries. The 'sqltest' tag
correctly escapes the inserted variable. The named variable or
variable expression is tested against a SQL column using the
specified comparison operation.
Attributes
type=string -- The type of the variable. Valid types include:
'string', 'int', 'float' and 'nb'. 'nb' means non-blank string,
and should be used instead of 'string' unless you want to test for
blank values. The type attribute is required and is used to
properly escape inserted variable.
column=string -- The name of the SQL column to test against. This
attribute defaults to the variable name.
multiple=boolean -- If true, then the variable may be a sequence
of values to test the column against.
optional=boolean -- If true, then the test is optional and will
not be rendered if the variable is empty or non-existent.
op=string -- The comparison operation. Valid comparisons include:
eq -- equal to
gt -- greater than
lt -- less than
ne -- not equal to
ge -- greater than or equal to
le -- less than or equal to
The comparison defaults to equal to. If the comparison is not
recognized it is used anyway. Thus you can use comparisons such
as 'like'.
Examples
Basic usage::
select * from employees
where <dtml-sqltest name type="nb">
If the 'name' variable is 'Bob' then this renders::
select * from employees
where name = 'Bob'
Multiple values::
select * from employees
where <dtml-sqltest empid type=int multiple>
If the 'empid' variable is '(12,14,17)' then this renders::
select * from employees
where empid in (12, 14, 17)
See Also
"sqlgroup tag":dtml-sqlgroup.stx
"sqlvar tag":dtml-sqlvar.stx
sqlvar: Inserts SQL variables
The 'sqlvar' tag safely inserts variables into SQL code. This tag is
used in SQL Methods.
Syntax
'sqlvar' tag syntax::
<dtml-sqlvar Variable|expr="VariableExpression">
The 'sqlvar' tag is a singleton. Like the 'var' tag, the 'sqlvar'
tag looks up a variable and inserts it. Unlike the var tag, the
formatting options are tailored for SQL code.
Attributes
type=string -- The type of the variable. Valid types include:
'string', 'int', 'float' and 'nb'. 'nb' means non-blank string and
should be used in place of 'string' unless you want to use blank
strings. The type attribute is required and is used to properly
escape inserted variable.
optional=boolean -- If true and the variable is null or
non-existent, then nothing is inserted.
Examples
Basic usage::
select * from employees
where name=<dtml-sqlvar name type="nb">
This SQL quotes the 'name' string variable.
See Also
"sqltest tag":dtml-sqltest.stx
This diff is collapsed.
This diff is collapsed.
unless: Tests a condition
The 'unless' tag provides a shortcut for testing negative
conditions. For more complete condition testing use the 'if' tag.
Syntax
'unless' tag syntax::
<dtml-unless ConditionVariable|expr="ConditionExpression">
</dtml-unless>
The 'unless' tag is a block tag. If the condition variable or
expression evaluates to false, then the contained block is
executed. Like the 'if' tag, variables that are not present are
considered false.
Examples
Testing a variable::
<dtml-unless testMode>
<dtml-call dangerousOperation>
</dtml-unless>
The block will be executed if 'testMode' does not exist, or exists
but is false.
See Also
"if tag":dtml-if.stx
This diff is collapsed.
This diff is collapsed.
"""
math: Python 'math' module
The 'math' module provides trigonometric and other math
functions. It is a standard Python module.
Since Zope 2.4 requires Python 2.1, make sure to consult the Python
2.1 documentation.
See Also
"Python 'math'
module":http://www.python.org/doc/current/lib/module-math.html
documentation at Python.org
"""
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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