[Zope] The name of the current DTML-document

Chris McDonough chrism@zope.com
Thu, 20 Dec 2001 18:39:01 -0500


Bruce Eckel wrote:
> Is this a good way to get the name of the current DTML document?
> <dtml-var "_['URL'].split('/')[-1]">

If you mean DTML Document, a better way is:

    <dtml-var getId>

If you mean DMTL Method, a better way that usually works is:

     <dtml-var "this().getId()">

> Also, how would I print out all the fields for '_'?
> (always looking for a way to write code to figure out what I want
> to do...)

No generally easy way because of the nature of _ (it's a "multimapping" 
that can have indeterminate number of stacked mappings, and it doesn't 
have an items, keys, or values method).. if anybody has ideas, please 
pipe up. ;-)
-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"