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 @@
def manage_addExternalMethod(self, id, title, module, function):
def manage_addExternalMethod(id, title, module, function):
"""
Add an external method to an
'ObjectManager'.
......@@ -124,8 +124,8 @@ class ExternalMethod:
'Extensions' subdirectory of a product directory.
Due to the way ExternalMethods are loaded, it is not *currently*
possible to use Python modules that reside in the 'Extensions'
directory. It is possible to load modules found in the
possible to import Python modules that reside in the 'Extensions'
directory. It is possible to import modules found in the
'lib/python' directory of the Zope installation, or in
packages that are in the 'lib/python' directory.
......@@ -133,7 +133,7 @@ class ExternalMethod:
__constructor__=manage_addExternalMethod
def manage_edit(self, title, module, function, REQUEST=None):
def manage_edit(title, module, function, REQUEST=None):
"""
Change the
External Method.
......@@ -148,7 +148,7 @@ class ExternalMethod:
"""
def __call__(self, *args, **kw):
def __call__(*args, **kw):
"""
Call the
......@@ -164,9 +164,11 @@ class ExternalMethod:
- The supplied number of arguments is one less than the
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
first argument.
"""
......@@ -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,
timeout=1.0):
"""
......@@ -97,18 +97,18 @@ class MailHost:
"""
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.
"""
__constructor__=manage_addMailHost
def send(self, messageText, mto=None, mfrom=None, subject=None,
def send(messageText, mto=None, mfrom=None, subject=None,
encode=None):
"""
Sends an email message.
The arguments are:
messageText -- The body of the mail message.
......@@ -118,7 +118,7 @@ class MailHost:
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
are 'base64', 'quoted-printable' and 'uuencode'.
......
......@@ -95,7 +95,7 @@ class AuthenticatedUser:
Return the name of a user
Permission - Always available
Permission -- Always available
"""
......@@ -105,7 +105,7 @@ class AuthenticatedUser:
Return a value that is true if the user has the given roles on
the given object and return false otherwise.
Permission - Always available
Permission -- Always available
"""
......@@ -115,7 +115,7 @@ class AuthenticatedUser:
Returns a list of the roles the user has on the given object
(in the current context?)
Permission - Always available
Permission -- Always available
"""
......@@ -125,7 +125,7 @@ class AuthenticatedUser:
Get the ID of the user. The ID can be used, at least from
Python, to get the user from the user's UserDatabase.
Permission - Python only
Permission -- Python only
"""
......@@ -136,7 +136,7 @@ class AuthenticatedUser:
facility can be used to get the user database from the path
returned by this method.
Permission - Python only
Permission -- Python only
"""
......@@ -140,9 +140,11 @@ class DTMLDocument:
Passing in a namespace to a DTML Document is often referred to
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
A DTML Document can be called from another DTML
Method or Document::
<dtml-var standard_html_header>
......@@ -152,7 +154,7 @@ class DTMLDocument:
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 names pace as the REQUEST argument. The above
current DTML namespace as the REQUEST argument. The above
is identical to this following usage in a DTML Python
expression::
......@@ -160,15 +162,17 @@ class DTMLDocument:
<dtml-var "aDTMLDocument(_.None, _)">
<dtml-var standard_html_footer>
From Python -- Products, External Methods, and PythonMethods
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.
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
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 passes as the second argument to the
Document.
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'
......
......@@ -141,35 +141,38 @@ class DTMLMethod:
Passing in a namespace to a DTML Method is often referred to
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
Method or Document::
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 names pace as the REQUEST argument. The above
is identical to this following usage in a DTML Python
expression::
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 PythonMethods
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.
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
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 passes as the second argument to the
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'
"""
......
......@@ -101,7 +101,8 @@ class DateTime:
to many major timezones, as well as the ability to create a
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,
in days between the two.
......@@ -132,8 +133,6 @@ class DateTime:
and numeric operations return a new DateTime object rather than
modify the current object.
Return a new date-time object
A DateTime object always maintains its value as an absolute
UTC time, and is represented in the context of some timezone
based on the arguments used to create the object. A DateTime
......@@ -142,8 +141,8 @@ class DateTime:
Note that in all cases the local machine timezone is used for
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
current date/time is returned, represented in the
......@@ -189,17 +188,17 @@ class DateTime:
values. The year value must be a one-, two-, or
four-digit integer. If a one- or two-digit year is
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
optionally follow the abbreviation. The day must be an
integer from 1 to the number of days in the month. The
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,
month, and day values may be given in any order as long
as it is possible to distinguish the components. If all
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
values separated by colons. The hour value must be an
......@@ -376,7 +375,7 @@ class DateTime:
Permission -- Always available
"""
def greaterThan(self,t):
def greaterThan(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......@@ -388,7 +387,7 @@ class DateTime:
Permission -- Always available
"""
def greaterThanEqualTo(self,t):
def greaterThanEqualTo(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......@@ -400,7 +399,7 @@ class DateTime:
Permission -- Always available
"""
def equalTo(self,t):
def equalTo(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......@@ -412,7 +411,7 @@ class DateTime:
Permission -- Always available
"""
def notEqualTo(self,t):
def notEqualTo(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......@@ -424,7 +423,7 @@ class DateTime:
Permission -- Always available
"""
def lessThan(self,t):
def lessThan(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......@@ -436,7 +435,7 @@ class DateTime:
Permission -- Always available
"""
def lessThanEqualTo(self,t):
def lessThanEqualTo(t):
"""
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the
......
......@@ -98,8 +98,6 @@ 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.
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
done by simply referencing the object from DTML::
......@@ -160,3 +158,5 @@ class File:
Permission -- 'View'
"""
......@@ -96,7 +96,7 @@ def manage_addImage(id, file, title='', precondition='', content_type=''):
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
Zope.
......@@ -105,8 +105,6 @@ class Image:
uploaded. For image types that Zope does not understand, these
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::
......
......@@ -88,8 +88,6 @@ class ObjectManager:
An ObjectManager contains other Zope objects. The contained
objects are Object Manager Items.
Creating Objects in an ObjectManager
To create an object inside an object manager use 'manage_addProduct'::
self.manage_addProduct['OFSP'].manage_addFolder(id, title)
......@@ -137,13 +135,13 @@ class ObjectManager:
"""
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
of a given meta_type or set of meta_types.
Example::
<dtml-in "objectValues('Folder')">
<dtml-in expr="objectValues('Folder')">
<dtml-var icon>
This is the icon for the: <dtml-var id> Folder<br>.
<dtml-else>
......@@ -151,7 +149,7 @@ class ObjectManager:
</dtml-in>
The results were restricted to Folders by passing a
meta_type to 'objectItems' method.
meta_type to 'objectValues' method.
Permission -- 'Access contents information'
"""
......@@ -160,6 +158,10 @@ class ObjectManager:
"""
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.
......
......@@ -89,7 +89,8 @@ class ObjectManagerItem:
Almost all Zope objects that can be managed through the web are
Object Manager Items.
Attributes
ObjectMangerItems have these instance
attributes:
'title' -- The title of the object.
......
......@@ -168,7 +168,7 @@ class PropertySheet:
Returns a tuple of mappings, giving meta-data for properties.
Perimssion -- Python only
Permssion -- Python only
"""
......@@ -186,7 +186,8 @@ class PropertySheet:
Add a new property with the given 'id', 'value' and 'type'.
Property Types
These are the
property types:
'boolean' -- 1 or 0.
......@@ -216,12 +217,11 @@ class PropertySheet:
cannot be converted, a ValueError will be raised.
The value given for 'selection' and 'multiple selection'
properites must be a variable name. The variable must also be
a sequence.
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. This seems like
bad behavior - it should probably raise an exception instead.*
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
......@@ -259,7 +259,7 @@ class PropertySheet:
This method may be called via the web, from DTML or from
Python code.
Permission - 'Manage Properties'
Permission -- 'Manage Properties'
"""
......@@ -275,19 +275,17 @@ class PropertySheet:
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 (this is
lame and should be changed).
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'
Permission -- 'Manage Properties'
"""
......
......@@ -107,10 +107,10 @@ class PropertySheets:
def values():
"""
Return a sequence of all of the PropertySheet objects for
Return a sequence of all of the PropertySheet objects
in the collection.
Permission - Python only
Permission -- Python only
"""
......@@ -120,7 +120,7 @@ class PropertySheets:
Return a sequence containing an '(id, object)' tuple for
each PropertySheet object in the collection.
Permission - Python only
Permission -- Python only
"""
......@@ -130,7 +130,7 @@ class PropertySheets:
Return the PropertySheet identified by 'name', or the value
given in 'default' if the named PropertySheet is not found.
Permission - Python only
Permission -- Python only
"""
......@@ -123,9 +123,8 @@ class Request:
values will be looked up in the order: environment variables,
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
......@@ -180,7 +179,7 @@ class Request:
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
Permission -- Always available
"""
......@@ -190,11 +189,12 @@ class Request:
Return the named HTTP header, or an optional default argument
or None if the header is not found. Note that both original
and CGI-ified header names are recognized,
e.g. 'Content-Type', 'CONTENT_TYPE' and 'HTTP_CONTENT_TYPE'
should all return the Content-Type header, if available.
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
Permission -- Always available
"""
......@@ -205,7 +205,7 @@ class Request:
Returns a true value if the REQUEST object contains key,
returns a false value otherwise.
Permission - Always available
Permission -- Always available
"""
......@@ -215,7 +215,7 @@ class Request:
Returns a sorted sequence of all keys in the REQUEST object.
Permission - Always available
Permission -- Always available
"""
......@@ -225,7 +225,7 @@ class Request:
Returns a sequence of (key, value) tuples for all the keys in
the REQUEST object.
Permission - Always available
Permission -- Always available
"""
......@@ -235,7 +235,7 @@ class Request:
Returns a sequence of values for all the keys in the REQUEST
object.
Permission - Always available
Permission -- Always available
"""
......@@ -247,7 +247,7 @@ class Request:
Provides virtual hosting support.
Permission - Always available
Permission -- Always available
"""
......@@ -261,7 +261,7 @@ class Request:
Provides virtual hosting support. Intended to be called from
publishing traversal hooks.
Permission - Always available
Permission -- Always available
"""
......
......@@ -83,7 +83,7 @@
#
##############################################################################
def manage_addPythonScript(self, id, REQUEST=None):
def manage_addPythonScript(id, REQUEST=None):
"""Add a Python script to a folder.
"""
......@@ -100,14 +100,14 @@ class PythonScript:
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
many different users through an insecure medium like the web. The
following safety issues drive the need for secure Python Scripts:
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,
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
in the course of their execution.
......@@ -134,20 +134,40 @@ class PythonScript:
"exec" statement is not allowed in Python methods.
o Because they may represent or cause security violations, some
Python builtin functions are not allowed or are restricted. The
following Python builtins are not allowed:
Python builtin functions are not allowed. The following
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:
range -- Due to possible memory denial of service attacks, the
......@@ -165,7 +185,11 @@ class PythonScript:
available to DTML, the builtin functions are augmented with a
small number of functions and a class:
o test, namespace, render
o test
o namespace
o render
o same_type
......@@ -177,7 +201,6 @@ class PythonScript:
builtin name "printed" evaluates to the concatenation of all
text printed so far during the current execution of the
script.
"""
__constructor__ = manage_addPythonScript
......@@ -243,7 +266,7 @@ class PythonScript:
"""
def ZScriptHTML_tryParams(self):
def ZScriptHTML_tryParams():
"""
Return a list of the required parameters with which to
......@@ -252,7 +275,7 @@ class PythonScript:
"""
def read(self):
def read():
"""
Return the body of the Python Script, with a special comment
......@@ -261,7 +284,7 @@ class PythonScript:
"""
def write(self, text):
def write(text):
"""
Change the script by parsing the text argument into parts.
......
......@@ -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.
......@@ -105,7 +105,7 @@ class Vocabulary:
__constructor__=manage_addVocabulary
def query(self, pattern):
def query(pattern):
"""
Query Vocabulary for words matching pattern.
......@@ -113,14 +113,14 @@ class Vocabulary:
"""
def insert(self, word):
def insert(word):
"""
Insert a word in the Vocabulary.
"""
def words(self):
def words():
"""
Return list of words.
......
......@@ -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.
......@@ -106,7 +106,8 @@ class ZCatalog:
objects. ZCatalog's can index either 'Field' values of object,
'Text' values, or 'KeyWord' values:
Indexes
ZCatalogs have three types of
indexes:
Text -- Text indexes index textual content. The index can be
used to search for objects containing certain words.
......@@ -118,8 +119,6 @@ class ZCatalog:
can be used to search for objects that match one or more of the
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.
......@@ -138,28 +137,28 @@ class ZCatalog:
__constructor__=manage_addZCatalog
def catalog_object(self, obj, uid):
def catalog_object(obj, 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'.
"""
def uniqueValuesFor(self, name):
def uniqueValuesFor(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
......@@ -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_'
"""
def schema(self):
def schema():
"""
Returns a sequence of names that correspond to columns in the
......@@ -183,21 +182,21 @@ class ZCatalog:
"""
def indexes(self):
def indexes():
"""
Returns a sequence of names that correspond to indexes.
"""
def index_objects(self):
def 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
......@@ -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'.
"""
......
......@@ -83,7 +83,7 @@
#
##############################################################################
def manage_addZSQLMethod(self, id, title,
def manage_addZSQLMethod(id, title,
connection_id, arguments, template):
"""
......@@ -107,17 +107,11 @@ class ZSQLMethod:
ZSQLMethods abstract SQL code in Zope.
They support three important abstractions:
- Method
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.
- Searchability
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
......@@ -127,8 +121,6 @@ class ZSQLMethod:
For more information, see the searchable-object interface
specification.
- 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
......@@ -147,7 +139,7 @@ class ZSQLMethod:
__constructor__=manage_addZSQLMethod
def __call__(self, REQUEST=None, **kw):
def __call__(REQUEST=None, **kw):
"""
Call the 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.
......@@ -173,7 +165,7 @@ class ZSQLMethod:
above the current folder. The database should understand SQL.
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.
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