[ZPT] CVS: Products/PageTemplates/help - tales-exists.stx:1.1 tales-no-call.stx:1.2 tales-not.stx:1.2 tales-path.stx:1.2 tales.stx:1.2

Amos Latteier amos@zope.com
Tue, 25 Sep 2001 14:13:31 -0400


Update of /cvs-repository/Products/PageTemplates/help
In directory cvs.zope.org:/tmp/cvs-serv22635

Modified Files:
	tales-no-call.stx tales-not.stx tales-path.stx tales.stx 
Added Files:
	tales-exists.stx 
Log Message:
progress on tales reference.

=== Added File Products/PageTemplates/help/tales-exists.stx ===
TALES Exists expressions

  Syntax

    Exists expression syntax::

      exists_expressions ::= 'exists:' path_expression

  Description

    Exists expressions test for the existence of paths.  An exists
    expression returns true when the path expressions following it
    expression returns a value. It is false when the path expression
    cannot locate an object.

  Examples

    Testing for the existence of a form variable::

      <p tal:condition="not:exists:request/form/number">
        Please enter a number between 0 and 5
      </p>

    Note that in this case you can't use the expression,
    "not:request/form/number", since that expression will be true if
    the 'number' variable exists and is zero.
    

=== Products/PageTemplates/help/tales-no-call.stx 1.1 => 1.2 ===
+TALES No-call expressions
 
   Syntax
 
-    XXX
+    No-call expression syntax::
+
+      nocall_expression ::= 'no-call:' expression
 
   Description
 
-    XXX
\ No newline at end of file
+    No-call expressions avoid rendering the results of another
+    expression.
+    
+    An ordinary path expression tries to render the object that it
+    fetches.  This means that if the object is a function, Script,
+    Method, or some other kind of executable thing, then expression
+    will evaluate to the result of calling the object.  This is
+    usually what you want, but not always.  For example, if you want
+    to put a DTML Document into a variable so that you can refer to
+    its properties, you can't use a normal path expression because it
+    will render the Document into a string.
+
+  Examples
+
+    Using no-call to get the properties of a document::
+
+      <span tal:define="doc nocall:here/aDoc"
+            tal:content="string:${doc/getId}: ${doc/title}">
+      Id: Title</span>
+
+    Using no-call expressions on a functions::
+
+      <p tal:define="join nocall:modules/string/join">
+
+    This example defines a variable 'join' which is bound to the
+    'string.join' function.


=== Products/PageTemplates/help/tales-not.stx 1.1 => 1.2 ===
   Syntax
 
-    XXX
+    Not expression syntax::
+
+      not_expression ::= 'not:' expression
 
   Description
 
@@ -28,3 +30,11 @@
 
     Zope considers all objects not specifically listed above as
     *false* (including negative numbers) to be *true*.
+
+  Examples
+
+    Testing a sequence::
+
+      <p tal:condition="not:here/objectIds">
+        There are no contained objects.
+      </p>


=== Products/PageTemplates/help/tales-path.stx 1.1 => 1.2 ===
     Path expression syntax::
 
-     PathExpr  ::= Path [ '|' Path ]*
-     Path      ::= variable [ '/' URL_Segment ]*
-     variable  ::= Name
+      PathExpr  ::= Path [ '|' Path ]*
+      Path      ::= variable [ '/' URL_Segment ]*
+      variable  ::= Name
 
   Description
 
@@ -55,7 +55,17 @@
 
   Examples
 
-    XXX
+    Inserting a cookie variable or a property::
+
+      <span tal:replace="request/cookies/pref | here/pref">
+        preference
+      </span>
+
+    Inserting the user name::
+
+      <p tal:content="user/getUserName">
+        User name
+      </p>
 
 
 


=== Products/PageTemplates/help/tales.stx 1.1 => 1.2 ===
     These are the TALES expression types supported by Zope:
 
-    * "no-call":tales-no-call.stx expression - don't call a value
+    * "exists":tales-exists.stx expressions - test existence of a value
+
+    * "no-call":tales-no-call.stx expressions - don't call a value
 
     * "not:tales-not.stx expressions - negate a value
   
@@ -49,41 +51,48 @@
 
   Built-in Names
 
-   These are the names that are built-in the TALES in Zope:
+    These are the names that are built-in the TALES in Zope:
 
-   - *nothing* - special singleton value used by TAL to represent 
-      a *non-value* (e.g. void, None, Nil, NULL).
+    - *nothing* - special singleton value used by TAL to represent 
+       a *non-value* (e.g. void, None, Nil, NULL).
 
-   - *default* - special singleton value used by TAL to specify that
-     existing text should not be replaced.
+    - *default* - special singleton value used by TAL to specify that
+      existing text should not be replaced. See the documentation for
+      individual TAL statements for details on how they interpret
+      *default*.
 
-   - *options* - the *keyword* arguments passed to the template.
+    - *options* - the *keyword* arguments passed to the template. These
+      are generally available when a template is called from Python,
+      rather than from the web.
 
-   - *repeat* - the 'repeat' variables (see RepeatVariable).
+    - *repeat* - the 'repeat' variables see the
+      "tal:repeat":tal-repeat.stx documentation.
 
-   - *attrs* - a dictionary containing the initial values of the
-     attributes of the current statement tag.
+    - *attrs* - a dictionary containing the initial values of the
+      attributes of the current statement tag.
 
-   - *CONTEXTS* - the list of standard names (this list).  This can be
-     used to access a builtin variable that has been hidden by a local
-     or global variable with the same name.
+    - *CONTEXTS* - the list of standard names (this list).  This can be
+      used to access a builtin variable that has been hidden by a local
+      or global variable with the same name.
 
-   - *root* - the system's top-most object.
+    - *root* - the system's top-most object. In Zope this corresponds
+      to the root folder.
 
-   - *here* - the object to which the template is being applied.
+    - *here* - the object to which the template is being applied.
 
-   - *container* - the template's container object.
+    - *container* - the template's container object. In Zope this is
+      the folder in which the template is located.
 
-   - *template* - the template itself.
+    - *template* - the template itself.
 
-   - *request* - the publishing request object.
+    - *request* - the publishing request object.
 
-   - *user* - the authenticated user object.
+    - *user* - the authenticated user object.
 
-   - *modules* - a collection through which all Python modules and
-     packages can be accessed.  Some or many of these may not be
-     usable in TALES, however, depending on the security policies
-     of the template's implementation.
+    - *modules* - a collection through which all Python modules and
+      packages can be accessed.  Some or many of these may not be
+      usable in TALES, however, depending on the security policies
+      of the template's implementation.
 
     Note the names 'root', 'here', 'container', 'template', 'request',
     'user', and 'modules' are optional names supported by Zope, but
@@ -93,7 +102,9 @@
 
     "TAL overview":tal.stx
 
-    "no-call":tales-no-call.stx expression
+    "exists":tales-exists.stx expressions
+
+    "no-call":tales-no-call.stx expressions
 
     "not:tales-not.stx expressions