Commit 32331d3d authored by Amos Latteier's avatar Amos Latteier

Many small structured text fixes, typos fixes, and small wording and...

Many small structured text fixes, typos fixes, and small wording and formatting corrections. Some of these were pointed out by Tom Deprez.
parent 653ba6f1
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
def manage_addExternalMethod(self, id, title, module, function): def manage_addExternalMethod(id, title, module, function):
""" """
Add an external method to an Add an external method to an
'ObjectManager'. 'ObjectManager'.
...@@ -93,22 +93,22 @@ def manage_addExternalMethod(self, id, title, module, function): ...@@ -93,22 +93,22 @@ def manage_addExternalMethod(self, id, title, module, function):
In addition to the standard object-creation arguments, In addition to the standard object-creation arguments,
'id' and title, the following arguments are defined: 'id' and title, the following arguments are defined:
function -- The name of the python function. This can be a function -- The name of the python function. This can be a
an ordinary Python function, or a bound method. an ordinary Python function, or a bound method.
module -- The name of the file containing the function module -- The name of the file containing the function
definition. definition.
The module normally resides in the 'Extensions' The module normally resides in the 'Extensions'
directory, however, the file name may have a prefix of directory, however, the file name may have a prefix of
'product.', indicating that it should be found in a product 'product.', indicating that it should be found in a product
directory. directory.
For example, if the module is: 'ACMEWidgets.foo', then an For example, if the module is: 'ACMEWidgets.foo', then an
attempt will first be made to use the file attempt will first be made to use the file
'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this
failes, then the file 'Extensions/ACMEWidgets.foo.py' will be failes, then the file 'Extensions/ACMEWidgets.foo.py' will be
used. used.
""" """
...@@ -124,8 +124,8 @@ class ExternalMethod: ...@@ -124,8 +124,8 @@ class ExternalMethod:
'Extensions' subdirectory of a product directory. 'Extensions' subdirectory of a product directory.
Due to the way ExternalMethods are loaded, it is not *currently* Due to the way ExternalMethods are loaded, it is not *currently*
possible to use Python modules that reside in the 'Extensions' possible to import Python modules that reside in the 'Extensions'
directory. It is possible to load modules found in the directory. It is possible to import modules found in the
'lib/python' directory of the Zope installation, or in 'lib/python' directory of the Zope installation, or in
packages that are in the 'lib/python' directory. packages that are in the 'lib/python' directory.
...@@ -133,7 +133,7 @@ class ExternalMethod: ...@@ -133,7 +133,7 @@ class ExternalMethod:
__constructor__=manage_addExternalMethod __constructor__=manage_addExternalMethod
def manage_edit(self, title, module, function, REQUEST=None): def manage_edit(title, module, function, REQUEST=None):
""" """
Change the Change the
External Method. External Method.
...@@ -148,7 +148,7 @@ class ExternalMethod: ...@@ -148,7 +148,7 @@ class ExternalMethod:
""" """
def __call__(self, *args, **kw): def __call__(*args, **kw):
""" """
Call the Call the
...@@ -164,9 +164,11 @@ class ExternalMethod: ...@@ -164,9 +164,11 @@ class ExternalMethod:
- The supplied number of arguments is one less than the - The supplied number of arguments is one less than the
required number of arguments, and required number of arguments, and
- The name of the function\'s first argument is 'self'. - The name of the function's first argument is 'self'.
In this case, the URL parent of the object is supplied as the In this case, the URL parent of the object is supplied as the
first argument. first argument.
""" """
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
def manage_addMailHost(self, id, title='', smtp_host=None, def manage_addMailHost(id, title='', smtp_host=None,
localhost='localhost', smtp_port=25, localhost='localhost', smtp_port=25,
timeout=1.0): timeout=1.0):
""" """
...@@ -97,18 +97,18 @@ class MailHost: ...@@ -97,18 +97,18 @@ class MailHost:
""" """
MailHost objects work as adapters to Simple Mail Transfer Protocol MailHost objects work as adapters to Simple Mail Transfer Protocol
(SMTP) servers. MailHosts are used by '<dtml-sendmail> tags (SMTP) servers. MailHosts are used by DTML 'sendmail' tags
to find the proper host to deliver mail to. to find the proper host to deliver mail to.
""" """
__constructor__=manage_addMailHost __constructor__=manage_addMailHost
def send(self, messageText, mto=None, mfrom=None, subject=None, def send(messageText, mto=None, mfrom=None, subject=None,
encode=None): encode=None):
""" """
Sends an email message. Sends an email message.
The arguments are:
messageText -- The body of the mail message. messageText -- The body of the mail message.
...@@ -118,7 +118,7 @@ class MailHost: ...@@ -118,7 +118,7 @@ class MailHost:
subject -- The subject of the message. subject -- The subject of the message.
encode - is the rfc822 defined encoding of the message. The encode -- The rfc822 defined encoding of the message. The
default of 'None' means no encoding is done. Valid values default of 'None' means no encoding is done. Valid values
are 'base64', 'quoted-printable' and 'uuencode'. are 'base64', 'quoted-printable' and 'uuencode'.
......
...@@ -95,7 +95,7 @@ class AuthenticatedUser: ...@@ -95,7 +95,7 @@ class AuthenticatedUser:
Return the name of a user Return the name of a user
Permission - Always available Permission -- Always available
""" """
...@@ -105,7 +105,7 @@ class AuthenticatedUser: ...@@ -105,7 +105,7 @@ class AuthenticatedUser:
Return a value that is true if the user has the given roles on Return a value that is true if the user has the given roles on
the given object and return false otherwise. the given object and return false otherwise.
Permission - Always available Permission -- Always available
""" """
...@@ -115,7 +115,7 @@ class AuthenticatedUser: ...@@ -115,7 +115,7 @@ class AuthenticatedUser:
Returns a list of the roles the user has on the given object Returns a list of the roles the user has on the given object
(in the current context?) (in the current context?)
Permission - Always available Permission -- Always available
""" """
...@@ -125,7 +125,7 @@ class AuthenticatedUser: ...@@ -125,7 +125,7 @@ class AuthenticatedUser:
Get the ID of the user. The ID can be used, at least from Get the ID of the user. The ID can be used, at least from
Python, to get the user from the user's UserDatabase. Python, to get the user from the user's UserDatabase.
Permission - Python only Permission -- Python only
""" """
...@@ -136,7 +136,7 @@ class AuthenticatedUser: ...@@ -136,7 +136,7 @@ class AuthenticatedUser:
facility can be used to get the user database from the path facility can be used to get the user database from the path
returned by this method. returned by this method.
Permission - Python only Permission -- Python only
""" """
...@@ -140,35 +140,39 @@ class DTMLDocument: ...@@ -140,35 +140,39 @@ class DTMLDocument:
Passing in a namespace to a DTML Document is often referred to Passing in a namespace to a DTML Document is often referred to
as providing the Document with a *context*. as providing the Document with a *context*.
DTML Documents are called three ways: DTML Documents can be called three ways.
From DTML -- A DTML Document can be called from another DTML From DTML
Method or Document::
A DTML Document can be called from another DTML
<dtml-var standard_html_header> Method or Document::
<dtml-var aDTMLDocument>
<dtml-var standard_html_footer> <dtml-var standard_html_header>
<dtml-var aDTMLDocument>
In this example, the Document 'aDTMLDocument' is being called <dtml-var standard_html_footer>
from another DTML object by name. The calling method
passes the value 'this' as the client argument and the In this example, the Document 'aDTMLDocument' is being called
current DTML names pace as the REQUEST argument. The above from another DTML object by name. The calling method
is identical to this following usage in a DTML Python passes the value 'this' as the client argument and the
expression:: current DTML namespace as the REQUEST argument. The above
is identical to this following usage in a DTML Python
<dtml-var standard_html_header> expression::
<dtml-var "aDTMLDocument(_.None, _)">
<dtml-var standard_html_footer> <dtml-var standard_html_header>
<dtml-var "aDTMLDocument(_.None, _)">
From Python -- Products, External Methods, and PythonMethods <dtml-var standard_html_footer>
can call a DTML Document in the same way as calling a DTML
Document from a Python expression in DTML; as shown in the From Python
previous example.
Products, External Methods, and Scripts can call a DTML
By the Publisher -- When the URL of a DTML Document is fetched Document in the same way as calling a DTML Document from a
from Zope, the DTML Document is called by the publisher. Python expression in DTML; as shown in the previous example.
The REQUEST object is passes as the second argument to the
Document. 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' Permission -- 'View'
......
...@@ -141,35 +141,38 @@ class DTMLMethod: ...@@ -141,35 +141,38 @@ class DTMLMethod:
Passing in a namespace to a DTML Method is often referred to Passing in a namespace to a DTML Method is often referred to
as providing the Method with a *context*. as providing the Method with a *context*.
DTML Methods are called three ways: DTML Methods can be called three ways:
From DTML -- A DTML Method can be called from another DTML From DTML
Method or Document::
A DTML Method can be called from another DTML Method or
<dtml-var standard_html_header> Document::
<dtml-var aDTMLMethod>
<dtml-var standard_html_footer> <dtml-var standard_html_header>
<dtml-var aDTMLMethod>
In this example, the Method 'aDTMLMethod' is being called <dtml-var standard_html_footer>
from another DTML object by name. The calling method
passes the value 'this' as the client argument and the In this example, the Method 'aDTMLMethod' is being called
current DTML names pace as the REQUEST argument. The above from another DTML object by name. The calling method passes
is identical to this following usage in a DTML Python the value 'this' as the client argument and the current DTML
expression:: 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_header>
<dtml-var standard_html_footer> <dtml-var "aDTMLMethod(_.None, _)">
<dtml-var standard_html_footer>
From Python -- Products, External Methods, and PythonMethods
can call a DTML Method in the same way as calling a DTML From Python
Method from a Python expression in DTML; as shown in the
previous example. Products, External Methods, and Scripts can call a DTML
Method in the same way as calling a DTML Method from a
By the Publisher -- When the URL of a DTML Method is fetched Python expression in DTML; as shown in the previous example.
from Zope, the DTML Method is called by the publisher.
The REQUEST object is passes as the second argument to the By the Publisher
Method.
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' Permission -- 'View'
""" """
......
...@@ -101,7 +101,8 @@ class DateTime: ...@@ -101,7 +101,8 @@ class DateTime:
to many major timezones, as well as the ability to create a to many major timezones, as well as the ability to create a
DateTime object in the context of a given timezone. DateTime object in the context of a given timezone.
DateTime objects provide partial numerical behavior: DateTime objects provide partial
numerical behavior:
- Two date-time objects can be subtracted to obtain a time, - Two date-time objects can be subtracted to obtain a time,
in days between the two. in days between the two.
...@@ -132,8 +133,6 @@ class DateTime: ...@@ -132,8 +133,6 @@ class DateTime:
and numeric operations return a new DateTime object rather than and numeric operations return a new DateTime object rather than
modify the current object. modify the current object.
Return a new date-time object
A DateTime object always maintains its value as an absolute A DateTime object always maintains its value as an absolute
UTC time, and is represented in the context of some timezone UTC time, and is represented in the context of some timezone
based on the arguments used to create the object. A DateTime based on the arguments used to create the object. A DateTime
...@@ -142,8 +141,8 @@ class DateTime: ...@@ -142,8 +141,8 @@ class DateTime:
Note that in all cases the local machine timezone is used for Note that in all cases the local machine timezone is used for
representation if no timezone is specified. representation if no timezone is specified.
DateTimes may be created with from zero to seven arguments. DateTimes may be created with from zero to
seven arguments.
- If the function is called with no arguments, then the - If the function is called with no arguments, then the
current date/time is returned, represented in the current date/time is returned, represented in the
...@@ -189,17 +188,17 @@ class DateTime: ...@@ -189,17 +188,17 @@ class DateTime:
values. The year value must be a one-, two-, or values. The year value must be a one-, two-, or
four-digit integer. If a one- or two-digit year is four-digit integer. If a one- or two-digit year is
used, the year is assumed to be in the twentieth used, the year is assumed to be in the twentieth
century. The month may an integer, from 1 to 12, a century. The month may be an integer, from 1 to 12, a
month name, or a month abbreviation, where a period may month name, or a month abbreviation, where a period may
optionally follow the abbreviation. The day must be an optionally follow the abbreviation. The day must be an
integer from 1 to the number of days in the month. The integer from 1 to the number of days in the month. The
year, month, and day values may be separated by year, month, and day values may be separated by
periods, hyphens, forward, slashes, or spaces. Extra periods, hyphens, forward slashes, or spaces. Extra
spaces are permitted around the delimiters. Year, spaces are permitted around the delimiters. Year,
month, and day values may be given in any order as long month, and day values may be given in any order as long
as it is possible to distinguish the components. If all as it is possible to distinguish the components. If all
three components are numbers that are less than 13, three components are numbers that are less than 13,
then a a month-day-year ordering is assumed. then a month-day-year ordering is assumed.
The time component consists of hour, minute, and second The time component consists of hour, minute, and second
values separated by colons. The hour value must be an values separated by colons. The hour value must be an
...@@ -376,7 +375,7 @@ class DateTime: ...@@ -376,7 +375,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def greaterThan(self,t): def greaterThan(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
...@@ -388,7 +387,7 @@ class DateTime: ...@@ -388,7 +387,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def greaterThanEqualTo(self,t): def greaterThanEqualTo(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
...@@ -400,7 +399,7 @@ class DateTime: ...@@ -400,7 +399,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def equalTo(self,t): def equalTo(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
...@@ -412,7 +411,7 @@ class DateTime: ...@@ -412,7 +411,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def notEqualTo(self,t): def notEqualTo(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
...@@ -424,7 +423,7 @@ class DateTime: ...@@ -424,7 +423,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def lessThan(self,t): def lessThan(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
...@@ -436,7 +435,7 @@ class DateTime: ...@@ -436,7 +435,7 @@ class DateTime:
Permission -- Always available Permission -- Always available
""" """
def lessThanEqualTo(self,t): def lessThanEqualTo(t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
......
...@@ -98,35 +98,33 @@ class File: ...@@ -98,35 +98,33 @@ class File:
A File is a Zope object that contains file content. A File object A File is a Zope object that contains file content. A File object
can be used to upload or download file information with Zope. can be used to upload or download file information with Zope.
Examples: 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
Using a File object in Zope is easy. The most common usage is done by simply referencing the object from DTML::
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_header> <dtml-var standard_html_footer>
<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
A more complex example is presenting the File object for File object in a folder for the user to download::
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-var standard_html_header> <dtml-in "ObjectValues('File')">
<ul> <li><a href="<dtml-var absolute_url>"><dtml-var
<dtml-in "ObjectValues('File')"> id></a></li>
<li><a href="<dtml-var absolute_url>"><dtml-var </dtml-in>
id></a></li> </ul>
</dtml-in> <dtml-var standard_html_footer>
</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
In this example, the 'absolute_url' method and 'id' are used to the current Object Manager.
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.
Also see ObjectManager for details on the 'objectValues'
method.
""" """
__constructor__=manage_addFile __constructor__=manage_addFile
...@@ -160,3 +158,5 @@ class File: ...@@ -160,3 +158,5 @@ class File:
Permission -- 'View' Permission -- 'View'
""" """
...@@ -96,7 +96,7 @@ def manage_addImage(id, file, title='', precondition='', content_type=''): ...@@ -96,7 +96,7 @@ def manage_addImage(id, file, title='', precondition='', content_type=''):
class Image: class Image:
""" """
A Image is a Zope object that contains image content. A Image An Image is a Zope object that contains image content. An Image
object can be used to upload or download image information with object can be used to upload or download image information with
Zope. Zope.
...@@ -105,29 +105,27 @@ class Image: ...@@ -105,29 +105,27 @@ class Image:
uploaded. For image types that Zope does not understand, these uploaded. For image types that Zope does not understand, these
properties may be undefined. properties may be undefined.
Examples: 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::
Using a Image object in Zope is easy. The most common usage is <dtml-var standard_html_header>
to display the contents of an image object in a web page. This <dtml-var ImageObject>
is done by simply referencing the object from DTML:: <dtml-var standard_html_footer>
<dtml-var standard_html_header> This will generate an HTML IMG tag referencing the URL to the
<dtml-var ImageObject> Image. This is equivalent to::
<dtml-var standard_html_footer>
This will generate an HTML IMG tag referencing the URL to the <dtml-var standard_html_header>
Image. This is equivalent to:: <dtml-with ImageObject>
<img src="<dtml-var absolute_url>">
</dtml-with>
<dtml-var standard_html_footer>
<dtml-var standard_html_header> You can control the image display more precisely with the 'tag'
<dtml-with ImageObject> method. For example::
<img src="<dtml-var absolute_url>">
</dtml-with> <dtml-var "ImageObject.tag(border=5, align=left)">
<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)">
""" """
......
...@@ -88,26 +88,24 @@ class ObjectManager: ...@@ -88,26 +88,24 @@ class ObjectManager:
An ObjectManager contains other Zope objects. The contained An ObjectManager contains other Zope objects. The contained
objects are Object Manager Items. objects are Object Manager Items.
Creating Objects in an ObjectManager To create an object inside an object manager use 'manage_addProduct'::
To create an object inside an object manager use 'manage_addProduct':: self.manage_addProduct['OFSP'].manage_addFolder(id, title)
self.manage_addProduct['OFSP'].manage_addFolder(id, title) In DTML this would be::
In DTML this would be:: <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)">
<dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)"> These examples create a new Folder inside the current
ObjectManager.
These examples create a new Folder inside the current 'manage_addProduct' is a mapping that provides access to product
ObjectManager. constructor methods. It is indexed by product id.
'manage_addProduct' is a mapping that provides access to product Constructor methods are registered during product initialization
constructor methods. It is indexed by product id. and should be documented in the API docs for each addable
object.
Constructor methods are registered during product initialization """
and should be documented in the API docs for each addable
object.
"""
def objectIds(type=None): def objectIds(type=None):
""" """
...@@ -137,13 +135,13 @@ class ObjectManager: ...@@ -137,13 +135,13 @@ class ObjectManager:
""" """
This method returns a sequence of contained objects. This method returns a sequence of contained objects.
Like objectValues and objectIds, it accepts one argument, Like objectItems and objectIds, it accepts one argument,
either a string or a list to restrict the results to objects either a string or a list to restrict the results to objects
of a given meta_type or set of meta_types. of a given meta_type or set of meta_types.
Example:: Example::
<dtml-in "objectValues('Folder')"> <dtml-in expr="objectValues('Folder')">
<dtml-var icon> <dtml-var icon>
This is the icon for the: <dtml-var id> Folder<br>. This is the icon for the: <dtml-var id> Folder<br>.
<dtml-else> <dtml-else>
...@@ -151,7 +149,7 @@ class ObjectManager: ...@@ -151,7 +149,7 @@ class ObjectManager:
</dtml-in> </dtml-in>
The results were restricted to Folders by passing a The results were restricted to Folders by passing a
meta_type to 'objectItems' method. meta_type to 'objectValues' method.
Permission -- 'Access contents information' Permission -- 'Access contents information'
""" """
...@@ -160,6 +158,10 @@ class ObjectManager: ...@@ -160,6 +158,10 @@ class ObjectManager:
""" """
This method returns a sequence of (id, object) tuples. 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 Each tuple's first element is the id of an object contained in
the Object Manager, and the second element is the object the Object Manager, and the second element is the object
itself. itself.
......
...@@ -89,7 +89,8 @@ class ObjectManagerItem: ...@@ -89,7 +89,8 @@ class ObjectManagerItem:
Almost all Zope objects that can be managed through the web are Almost all Zope objects that can be managed through the web are
Object Manager Items. Object Manager Items.
Attributes ObjectMangerItems have these instance
attributes:
'title' -- The title of the object. 'title' -- The title of the object.
......
...@@ -168,7 +168,7 @@ class PropertySheet: ...@@ -168,7 +168,7 @@ class PropertySheet:
Returns a tuple of mappings, giving meta-data for properties. Returns a tuple of mappings, giving meta-data for properties.
Perimssion -- Python only Permssion -- Python only
""" """
...@@ -186,7 +186,8 @@ class PropertySheet: ...@@ -186,7 +186,8 @@ class PropertySheet:
Add a new property with the given 'id', 'value' and 'type'. Add a new property with the given 'id', 'value' and 'type'.
Property Types These are the
property types:
'boolean' -- 1 or 0. 'boolean' -- 1 or 0.
...@@ -216,12 +217,11 @@ class PropertySheet: ...@@ -216,12 +217,11 @@ class PropertySheet:
cannot be converted, a ValueError will be raised. cannot be converted, a ValueError will be raised.
The value given for 'selection' and 'multiple selection' The value given for 'selection' and 'multiple selection'
properites must be a variable name. The variable must also be properites may be an attribute or method name. The attribute
a sequence. or method must return a sequence values.
*If the given 'type' is not recognized, the 'value' and 'type' If the given 'type' is not recognized, the 'value' and 'type'
given are simply stored blindly by the object. This seems like given are simply stored blindly by the object.
bad behavior - it should probably raise an exception instead.*
If no value is passed in for 'REQUEST', the method will return If no value is passed in for 'REQUEST', the method will return
'None'. If a value is provided for 'REQUEST' (as it will when 'None'. If a value is provided for 'REQUEST' (as it will when
...@@ -259,7 +259,7 @@ class PropertySheet: ...@@ -259,7 +259,7 @@ class PropertySheet:
This method may be called via the web, from DTML or from This method may be called via the web, from DTML or from
Python code. Python code.
Permission - 'Manage Properties' Permission -- 'Manage Properties'
""" """
...@@ -275,19 +275,17 @@ class PropertySheet: ...@@ -275,19 +275,17 @@ class PropertySheet:
Some objects have "special" properties defined by product Some objects have "special" properties defined by product
authors that cannot be deleted. If one of these properties is authors that cannot be deleted. If one of these properties is
named in 'ids', an HTML error message is returned (this is named in 'ids', an HTML error message is returned.
lame and should be changed).
If no value is passed in for 'REQUEST', the method will return 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 None. If a value is provided for 'REQUEST' (as it will be when
called via the web), the property management form for the called via the web), the property management form for the
object will be rendered and returned. object will be rendered and returned.
This method may be called via the web, from DTML or from This method may be called via the web, from DTML or from
Python code. Python code.
Permission - 'Manage Properties' Permission -- 'Manage Properties'
""" """
......
...@@ -107,10 +107,10 @@ class PropertySheets: ...@@ -107,10 +107,10 @@ class PropertySheets:
def values(): def values():
""" """
Return a sequence of all of the PropertySheet objects for Return a sequence of all of the PropertySheet objects
in the collection. in the collection.
Permission - Python only Permission -- Python only
""" """
...@@ -120,7 +120,7 @@ class PropertySheets: ...@@ -120,7 +120,7 @@ class PropertySheets:
Return a sequence containing an '(id, object)' tuple for Return a sequence containing an '(id, object)' tuple for
each PropertySheet object in the collection. each PropertySheet object in the collection.
Permission - Python only Permission -- Python only
""" """
...@@ -130,7 +130,7 @@ class PropertySheets: ...@@ -130,7 +130,7 @@ class PropertySheets:
Return the PropertySheet identified by 'name', or the value Return the PropertySheet identified by 'name', or the value
given in 'default' if the named PropertySheet is not found. given in 'default' if the named PropertySheet is not found.
Permission - Python only Permission -- Python only
""" """
...@@ -123,53 +123,52 @@ class Request: ...@@ -123,53 +123,52 @@ class Request:
values will be looked up in the order: environment variables, values will be looked up in the order: environment variables,
other variables, form data, and then cookies. other variables, form data, and then cookies.
Special Variables These special variables are set in
the Request:
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.
'PARENTS' -- A list of the objects traversed to get to the 'REQUEST' -- The Request object.
published object. So, 'PARENTS[0]' would be the ancestor of
the published object.
'REQUEST' -- The Request object. 'RESPONSE' -- The Response object.
'RESPONSE' -- The Response object. 'PUBLISHED' -- The actual object published as a result of
url traversal.
'PUBLISHED' -- The actual object published as a result of 'URL' -- The URL of the Request without query string.
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.
*URLn* -- 'URL0' is the same as 'URL'. 'URL1' is the same as For example if URL='http://localhost/foo/bar', then
'URL0' with the last path element removed. 'URL2' is the same URL1='http://localhost/foo' and URL2='http://localhost'.
as 'URL1' with the last element removed. Etcetera.
For example if URL='http://localhost/foo/bar', then *URLPATHn* -- 'URLPATH0' is the path portion of 'URL',
URL1='http://localhost/foo' and URL2='http://localhost'. 'URLPATH1' is the path portion of 'URL1', and so on.
*URLPATHn* -- 'URLPATH0' is the path portion of 'URL', For example if URL='http://localhost/foo/bar', then
'URLPATH1' is the path portion of 'URL1', and so on. URLPATH1='/foo' and URLPATH2='/'.
For example if URL='http://localhost/foo/bar', then *BASEn* -- 'BASE0' is the URL up to but not including the Zope
URLPATH1='/foo' and URLPATH2='/'. 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.
*BASEn* -- 'BASE0' is the URL up to but not including the Zope For example if URL='http://localhost/Zope.cgi/foo/bar', then
application object. 'BASE1' is the URL of the Zope application BASE0='http://localhost', BASE1='http://localhost/Zope.cgi',
object. 'BASE2' is the URL of the Zope application object with and BASE2='http://localhost/Zope.cgi/foo'.
an additional path element added in the path to the published
object. Etcetera.
For example if URL='http://localhost/Zope.cgi/foo/bar', then *BASEPATHn* -- 'BASEPATH0' is the path portion of 'BASE0',
BASE0='http://localhost', BASE1='http://localhost/Zope.cgi', 'BASEPATH1' is the path portion of 'BASE1', and so on.
and BASE2='http://localhost/Zope.cgi/foo'. 'BASEPATH1' is the externally visible path to the root Zope
folder, equivalent to CGI's 'SCRIPT_NAME', but virtual-host aware.
*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 For example if URL='http://localhost/Zope.cgi/foo/bar', then
BASEPATH0='/', BASEPATH1='/Zope.cgi', and BASEPATH2='/Zope.cgi/foo'. BASEPATH0='/', BASEPATH1='/Zope.cgi', and BASEPATH2='/Zope.cgi/foo'.
""" """
...@@ -180,7 +179,7 @@ class Request: ...@@ -180,7 +179,7 @@ class Request:
Create a new name in the REQUEST object and assign it a value. Create a new name in the REQUEST object and assign it a value.
This name and value is stored in the 'Other' category. This name and value is stored in the 'Other' category.
Permission - Always available Permission -- Always available
""" """
...@@ -190,11 +189,12 @@ class Request: ...@@ -190,11 +189,12 @@ class Request:
Return the named HTTP header, or an optional default argument Return the named HTTP header, or an optional default argument
or None if the header is not found. Note that both original or None if the header is not found. Note that both original
and CGI-ified header names are recognized, and CGI header names without the leading 'HTTP_' are
e.g. 'Content-Type', 'CONTENT_TYPE' and 'HTTP_CONTENT_TYPE' recognized, for example, 'Content-Type', 'CONTENT_TYPE' and
should all return the Content-Type header, if available. 'HTTP_CONTENT_TYPE' should all return the Content-Type header,
if available.
Permission - Always available Permission -- Always available
""" """
...@@ -205,7 +205,7 @@ class Request: ...@@ -205,7 +205,7 @@ class Request:
Returns a true value if the REQUEST object contains key, Returns a true value if the REQUEST object contains key,
returns a false value otherwise. returns a false value otherwise.
Permission - Always available Permission -- Always available
""" """
...@@ -215,7 +215,7 @@ class Request: ...@@ -215,7 +215,7 @@ class Request:
Returns a sorted sequence of all keys in the REQUEST object. Returns a sorted sequence of all keys in the REQUEST object.
Permission - Always available Permission -- Always available
""" """
...@@ -225,7 +225,7 @@ class Request: ...@@ -225,7 +225,7 @@ class Request:
Returns a sequence of (key, value) tuples for all the keys in Returns a sequence of (key, value) tuples for all the keys in
the REQUEST object. the REQUEST object.
Permission - Always available Permission -- Always available
""" """
...@@ -235,7 +235,7 @@ class Request: ...@@ -235,7 +235,7 @@ class Request:
Returns a sequence of values for all the keys in the REQUEST Returns a sequence of values for all the keys in the REQUEST
object. object.
Permission - Always available Permission -- Always available
""" """
...@@ -247,7 +247,7 @@ class Request: ...@@ -247,7 +247,7 @@ class Request:
Provides virtual hosting support. Provides virtual hosting support.
Permission - Always available Permission -- Always available
""" """
...@@ -261,7 +261,7 @@ class Request: ...@@ -261,7 +261,7 @@ class Request:
Provides virtual hosting support. Intended to be called from Provides virtual hosting support. Intended to be called from
publishing traversal hooks. publishing traversal hooks.
Permission - Always available Permission -- Always available
""" """
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
def manage_addPythonScript(self, id, REQUEST=None): def manage_addPythonScript(id, REQUEST=None):
"""Add a Python script to a folder. """Add a Python script to a folder.
""" """
...@@ -100,14 +100,14 @@ class PythonScript: ...@@ -100,14 +100,14 @@ class PythonScript:
o Calling the script from a method object, such as a DTML Method. o Calling the script from a method object, such as a DTML Method.
Python scripts can contain a "safe" subset of the python language. Python Scripts can contain a "safe" subset of the python language.
Python Scripts must be safe because they can be potentially edited by Python Scripts must be safe because they can be potentially edited by
many different users through an insecure medium like the web. The many different users through an insecure medium like the web. The
following safety issues drive the need for secure Python Scripts: following safety issues drive the need for secure Python Scripts:
o Because many users can use Zope, a Python Script must make sure it o Because many users can use Zope, a Python Script must make sure it
does not allow a user to do something they are not allowed to do, does not allow a user to do something they are not allowed to do,
like delete an object they do not have permission to delete. like deleting an object they do not have permission to delete.
Because of this requirement, Python Scripts do many security checks Because of this requirement, Python Scripts do many security checks
in the course of their execution. in the course of their execution.
...@@ -134,20 +134,40 @@ class PythonScript: ...@@ -134,20 +134,40 @@ class PythonScript:
"exec" statement is not allowed in Python methods. "exec" statement is not allowed in Python methods.
o Because they may represent or cause security violations, some o Because they may represent or cause security violations, some
Python builtin functions are not allowed or are restricted. The Python builtin functions are not allowed. The following
following Python builtins are not allowed: Python builtins are not allowed:
o open, input, raw_input o open
o eval, execfile, compile o input
o type, coerce, intern o raw_input
o dir, globals, locals, vars o eval
o buffer, reduce o execfile
Other builtins are restricted in nature. The following builtins o compile
o type
o coerce
o intern
o dir
o globals
o locals
o vars
o buffer
o reduce
o Other builtins are restricted in nature. The following builtins
are restricted: are restricted:
range -- Due to possible memory denial of service attacks, the range -- Due to possible memory denial of service attacks, the
...@@ -156,16 +176,20 @@ class PythonScript: ...@@ -156,16 +176,20 @@ class PythonScript:
filter, map, tuple, list -- For the same reason, builtins filter, map, tuple, list -- For the same reason, builtins
that construct lists from sequences do not operate on strings. that construct lists from sequences do not operate on strings.
getattr, setattr, delattr -- Because these may enable Python getattr, setattr, delattr -- Because these may enable Python
code to circumvent Zope's security system, they are replaced with code to circumvent Zope's security system, they are replaced with
custom, security constrained versions. custom, security constrained versions.
o In order to be consistent with the Python expressions o In order to be consistent with the Python expressions
available to DTML, the builtin functions are augmented with a available to DTML, the builtin functions are augmented with a
small number of functions and a class: small number of functions and a class:
o test, namespace, render o test
o namespace
o render
o same_type o same_type
...@@ -177,7 +201,6 @@ class PythonScript: ...@@ -177,7 +201,6 @@ class PythonScript:
builtin name "printed" evaluates to the concatenation of all builtin name "printed" evaluates to the concatenation of all
text printed so far during the current execution of the text printed so far during the current execution of the
script. script.
""" """
__constructor__ = manage_addPythonScript __constructor__ = manage_addPythonScript
...@@ -243,7 +266,7 @@ class PythonScript: ...@@ -243,7 +266,7 @@ class PythonScript:
""" """
def ZScriptHTML_tryParams(self): def ZScriptHTML_tryParams():
""" """
Return a list of the required parameters with which to Return a list of the required parameters with which to
...@@ -252,7 +275,7 @@ class PythonScript: ...@@ -252,7 +275,7 @@ class PythonScript:
""" """
def read(self): def read():
""" """
Return the body of the Python Script, with a special comment Return the body of the Python Script, with a special comment
...@@ -261,7 +284,7 @@ class PythonScript: ...@@ -261,7 +284,7 @@ class PythonScript:
""" """
def write(self, text): def write(text):
""" """
Change the script by parsing the text argument into parts. Change the script by parsing the text argument into parts.
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
def manage_addVocabulary(self, id, title, globbing=None, REQUEST=None): def manage_addVocabulary(id, title, globbing=None, REQUEST=None):
""" """
Add a Vocabulary object to an ObjectManager. Add a Vocabulary object to an ObjectManager.
...@@ -105,7 +105,7 @@ class Vocabulary: ...@@ -105,7 +105,7 @@ class Vocabulary:
__constructor__=manage_addVocabulary __constructor__=manage_addVocabulary
def query(self, pattern): def query(pattern):
""" """
Query Vocabulary for words matching pattern. Query Vocabulary for words matching pattern.
...@@ -113,14 +113,14 @@ class Vocabulary: ...@@ -113,14 +113,14 @@ class Vocabulary:
""" """
def insert(self, word): def insert(word):
""" """
Insert a word in the Vocabulary. Insert a word in the Vocabulary.
""" """
def words(self): def words():
""" """
Return list of words. Return list of words.
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
def manage_addZCatalog(self, id, title, vocab_id=None): def manage_addZCatalog(id, title, vocab_id=None):
""" """
Add a ZCatalog object. Add a ZCatalog object.
...@@ -106,7 +106,8 @@ class ZCatalog: ...@@ -106,7 +106,8 @@ class ZCatalog:
objects. ZCatalog's can index either 'Field' values of object, objects. ZCatalog's can index either 'Field' values of object,
'Text' values, or 'KeyWord' values: 'Text' values, or 'KeyWord' values:
Indexes ZCatalogs have three types of
indexes:
Text -- Text indexes index textual content. The index can be Text -- Text indexes index textual content. The index can be
used to search for objects containing certain words. used to search for objects containing certain words.
...@@ -118,15 +119,13 @@ class ZCatalog: ...@@ -118,15 +119,13 @@ class ZCatalog:
can be used to search for objects that match one or more of the can be used to search for objects that match one or more of the
search terms. search terms.
Meta-data The ZCatalog can maintain a table of extra data about cataloged
objects. This information can be used on search result pages to
show information about a search result.
The ZCatalog can maintain a table of extra data about cataloged The meta-data table schema is used to build the schema for
objects. This information can be used on search result pages to ZCatalog Result objects. The objects have the same attributes
show information about a search result. as the column of the meta-data table.
The meta-data table schema is used to build the schema for
ZCatalog Result objects. The objects have the same attributes
as the column of the meta-data table.
ZCatalog does not store references to the objects themselves, but ZCatalog does not store references to the objects themselves, but
rather to a unique identifier that defines how to get to the rather to a unique identifier that defines how to get to the
...@@ -138,28 +137,28 @@ class ZCatalog: ...@@ -138,28 +137,28 @@ class ZCatalog:
__constructor__=manage_addZCatalog __constructor__=manage_addZCatalog
def catalog_object(self, obj, uid): def catalog_object(obj, uid):
""" """
Catalogs the object 'obj' with the unique identifier 'uid'. Catalogs the object 'obj' with the unique identifier 'uid'.
""" """
def uncatalog_object(self, uid): def uncatalog_object(uid):
""" """
Uncatalogs the object with the unique identifier 'uid'. Uncatalogs the object with the unique identifier 'uid'.
""" """
def uniqueValuesFor(self, name): def uniqueValuesFor(name):
""" """
returns the unique values for a given FieldIndex named 'name'. returns the unique values for a given FieldIndex named 'name'.
""" """
def getpath(self, rid): def getpath(rid):
""" """
Return the path to a cataloged object given a Return the path to a cataloged object given a
...@@ -168,14 +167,14 @@ class ZCatalog: ...@@ -168,14 +167,14 @@ class ZCatalog:
""" """
def getobject(self, rid, REQUEST=None): def getobject(rid, REQUEST=None):
""" """
Return a cataloged object given a 'data_record_id_' Return a cataloged object given a 'data_record_id_'
""" """
def schema(self): def schema():
""" """
Returns a sequence of names that correspond to columns in the Returns a sequence of names that correspond to columns in the
...@@ -183,21 +182,21 @@ class ZCatalog: ...@@ -183,21 +182,21 @@ class ZCatalog:
""" """
def indexes(self): def indexes():
""" """
Returns a sequence of names that correspond to indexes. Returns a sequence of names that correspond to indexes.
""" """
def index_objects(self): def index_objects():
""" """
Returns a sequence of actual index objects. Returns a sequence of actual index objects.
""" """
def searchResults(self, REQUEST=None, **kw): def searchResults(REQUEST=None, **kw):
""" """
Search the catalog. Search terms can be passed in the REQUEST Search the catalog. Search terms can be passed in the REQUEST
...@@ -209,7 +208,7 @@ class ZCatalog: ...@@ -209,7 +208,7 @@ class ZCatalog:
""" """
def __call__(self, REQUEST=None, **kw): def __call__(REQUEST=None, **kw):
""" """
Search the catalog, the same way as 'searchResults'. Search the catalog, the same way as 'searchResults'.
""" """
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
def manage_addZSQLMethod(self, id, title, def manage_addZSQLMethod(id, title,
connection_id, arguments, template): connection_id, arguments, template):
""" """
...@@ -107,47 +107,39 @@ class ZSQLMethod: ...@@ -107,47 +107,39 @@ class ZSQLMethod:
ZSQLMethods abstract SQL code in Zope. ZSQLMethods abstract SQL code in Zope.
They support three important abstractions: SQL Methods behave like methods of the folders they are
accessed in. In particular, they can be used from other
methods, like Documents, ExternalMethods, and even other SQL
Methods.
- Method Database methods support the Searchable Object Interface.
Search interface wizards can be used to build user
interfaces to them. They can be used in joins and
unions. They provide meta-data about their input parameters
and result data.
SQL Methods behave like methods of the folders they are For more information, see the searchable-object interface
accessed in. In particular, they can be used from other specification.
methods, like Documents, ExternalMethods, and even other SQL
Methods.
- Searchability Database methods support URL traversal to access and invoke
methods on individual record objects. For example, suppose you
had an 'employees' database method that took a single argument
'employee_id'. Suppose that employees had a 'service_record'
method (defined in a record class or acquired from a
folder). The 'service_record' method could be accessed with a
URL like::
Database methods support the Searchable Object Interface. employees/employee_id/1234/service_record
Search interface wizards can be used to build user
interfaces to them. They can be used in joins and
unions. They provide meta-data about their input parameters
and result data.
For more information, see the searchable-object interface Search results are returned as Record objects. The schema of
specification. a Record objects matches the schema of the table queried in
the search.
- Containment
Database methods support URL traversal to access and invoke
methods on individual record objects. For example, suppose you
had an 'employees' database method that took a single argument
'employee_id'. Suppose that employees had a 'service_record'
method (defined in a record class or acquired from a
folder). The 'service_record' method could be accessed with a
URL like::
employees/employee_id/1234/service_record
Search results are returned as Record objects. The schema of
a Record objects matches the schema of the table queried in
the search.
""" """
__constructor__=manage_addZSQLMethod __constructor__=manage_addZSQLMethod
def __call__(self, REQUEST=None, **kw): def __call__(REQUEST=None, **kw):
""" """
Call the ZSQLMethod. Call the ZSQLMethod.
...@@ -163,7 +155,7 @@ class ZSQLMethod: ...@@ -163,7 +155,7 @@ class ZSQLMethod:
""" """
def manage_edit(self,title,connection_id,arguments,template): def manage_edit(title,connection_id,arguments,template):
""" """
Change database method properties. Change database method properties.
...@@ -173,7 +165,7 @@ class ZSQLMethod: ...@@ -173,7 +165,7 @@ class ZSQLMethod:
above the current folder. The database should understand SQL. above the current folder. The database should understand SQL.
The 'arguments' argument is a string containing an arguments The 'arguments' argument is a string containing an arguments
specification, as would be given in the SQL method cration specification, as would be given in the SQL method creation
form. form.
The 'template' argument is a string containing the source for The 'template' argument is a string containing the source for
......
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