[Zope] - Problem evaluating <!--#var URL0--> in DTML
Brian Lloyd
Brian@digicool.com
Mon, 25 Jan 1999 09:51:09 -0500
> I can't seem to access <!--#var URL0--> directly in my DTML
> file though
> <!--#var "REQUEST['URL0']"--> works just fine. I'm using the
> DocumentTemplate that came with Zope 1.9.0. I'm calling the document
> template instance with REQUEST as one of the parameters.
>
> Any suggestions?
>
> Thanks,
>
> Skip Montanaro
Skip,
Are you calling the template with REQUEST as the default
mapping parameter, or as another keyword param? This is the
only thing I can see that might be causing this (in Zope, the
REQUEST is passed as the mapping param, and <!--#var URL0-->
works).
Given a template's constructor:
def __init__(self, source_string='', mapping=None,
__name__='<string>', **vars):
...if you instantiated it using:
my_doc=TemplateClass(src, REQUEST, var1='', var2='')
then <!--#var URL0--> _should_ work. If, however, you were
to use:
my_doc=TemplateClass(src, some_other_mapping, REQUEST=REQUEST, ...)
or even:
my_doc=TemplateClass(src, REQUEST=REQUEST, ...)
then <!--#var URL0--> wouldn't work, because REQUEST isn't being
used as the default mapping for name lookup
(though <!--#var "REQUEST['URL0']"--> would work as expected).
Brian Lloyd brian@digicool.com
Software Engineer 540.371.6909
Digital Creations http://www.digicool.com