[Zope] Newbie question

Chris McDonough chrism@digicool.com
Fri, 03 Aug 2001 09:37:30 -0400


When you call something from DTML, the "namespace" is searched for the
name you're trying to access (in your cases, getSize and dow).  The
rules for this namespace search are byzantine, and even I don't know
them.  The intent, however, is for you to *not* have to know them
(though this fails miserably sometimes).

While getSize is an attribute of most Zope objects (and can usually be
acquired as well), it's generally found easily in the namespace. 
However, IIRC, 'dow' is a method of ZopeTime objects, so youd either
need to put "dow" into the namespace explicitly:

<dtml-with "ZopeTime()">
  <dtml-var dow>
</dtml-with>

Or call it directly on an instance:

<dtml-var "ZopeTime().dow()">

HTH,

- C


David Lambert wrote:
> 
> I am currently browsing the API Reference section of the Zope book and am
> trying simple examples. I am puzzled as to how various methods may be
> accessed from dtml. For instance the line:
> 
> <dtml-var expr="getSize()"> works fine, but:
> 
> <dtml-var expr="dow()"> (which I would have expected to return the day of
> week) gives an error
> 
> Obviously I am confused. Could somebody try and put me on the right tracks!
> 
> TIA
> 
> Dave.
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"