When a variable name is used in a DTML tag, such as a dtml-var tag or an expr attribute expression, that name must be resolved. Table See Simplest-case steps for looking up names shows the steps taken to look up data in the simplest case.
When a document template is called from Python, the mapping object and keyword arguments supplied when calling the document template are searched, with keyword arguments taking precedence over the mapping object. |
|
When a document templates is called from Python, attributes, including inherited and acquired attributes, of the client passed in the call to the document template are searched. |
|
If DTML is used in a Zope DTML Method or Document and the variable name is document_id or document_title , then the id or title of the document is used. |
|
Attributes of the folder containing the DTML are searched. Attributes include objects in the contents of the folder, properties of the folder, and other attributes defined by Zope6, such as ZopeTime7 . Folder attributes include the attributes of folders containing the folder, with contained folders taking precedence over containing folders. |
|
Search Zope-defined Web-request data (table See Zope-defined Web request variables). |
|
Search variables named URLn , where n is a digit. URL0 is the Request URL without a query string. URL1 is the same as URL0 except that the last name in the URL is removed. URL2 is the same as URL0 except that the last two names are removed, and so on. For example, if the request URL is http://digicool.com/A/B , then URL0 , URL1 , and URL2 are respectively, http://digicool.com/A/B , http://digicool.com/A and http://digicool.com . URL3 is undefined. |
|
Search CGI-defined Web-request variables. See table See CGI-defined Web request variables for a description of CGI-defined variables. |
|
Search HTTP Headers. A variable name associated with a HTTP header consist of the HTTP header name, converted to upper case, with the Prefix, HTTP_ . For example, a HTTP Referer header, if present, can be accessed using the variable name HTTP_REFERER . |
|
Search variables named BASEn , where n is a digit. BASE0 is the prefix of the request URL up to, but not including, the name of the Zope installation or module published by ZPublisher. BASE1 is the request URL up to and including the name of the Zope installation or module published by ZPublisher. BASE2 is the request URL up to the name following the name of the Zope installation or module published by ZPublisher, and so on. For example, assume that a Zope installation or module published by ZPublisher has the URL: http://digicool.com/Demos/Plutonia and that a request URL is http://digicool.com/Demos/Plutonia/Marketing. BASE0 is http://digicool.com/Demos, BASE1 is http://digicool.com/Demos/Plutonia and BASE2 is http://digicool.com/Demos/Plutonia/Marketing. BASE3 is undefined. |
There are two situations in which the search rules for the simplest case are modified. If a Zope object or Python document template is called within a DTML expr attribute expression, then additional variables may be passed in. Variables passed in take precedence over all variables described in Table 6.
An object that represents an authenticated user. When inserted into a DTML document, the value is the user name. This object currently provides no public attributes. Note that this variable may not be defined in Documents that are not protected by security information. |
|
The path to the object containing the user database folder which contained the definition for the authenticated user. |
|
A sequence of ancestors of the object that was accessed in the current request. For example, if the accessed object is a Document, then PARENTS[0] is the folder containing the document, PARENTS[1] is the folder containing the folder containing the document, and so on. |
|
An object that represents the current request. This object may be used in an expr expression to look up request data, including variables described in this table, CGI-defined variables (table See CGI-defined Web request variables), form variables, cookies, and HTTP headers. In addition, expr expressions may use request attributes defined in table See Attributes of the REQUEST variable. |
|
An object that represents the response to the current request. This object is primarily useful in expr expressions using attributes defined in table See Attributes of the RESPONSE variable. |
|
The URL used to invoke the request without the query string, if any. |
If a HTTP Cookie was included in the request, then this attribute is a dictionary8 containing the cookie data. This allows cookie data to be looked up, even if a cookie name is the same as a form variable or an object attribute name. |
|
If a request was initiated by submitting a form, then the form attribute is a dictionarya containing the form data. This allows form data to be looked up, even if a form name is the same as an object attribute name. |
|
Some DTML tags define additional variables. Variables defined by DTML tags take precedence over variables described in table 6. If tags are nested, variables defined in nested tags take precedence over variables defined in tags that are nested in.
Names may not begin with an underscore, except in the special case of the _variable used in an expr attribute expression.
If a variable lookup yields an object that has security information, then access to the variable is allowed only if the user on whose behalf the DTML is being rendered is allowed to access the object.
Previous Chapter | Next Chapter | Up | Next Section | Contents