[Zope] dtml-var in URL

Chris Withers chrisw@nipltd.com
Tue, 01 Oct 2002 15:16:43 +0100


Jens Vagelpohl wrote:
> this is still not failsafe in case you ever decide to do other things 
> with query strings. this is failsafe and will always work::
> 
> <dtml-if "REQUEST.get('print', '')">
>   show print view
> <dtml-else>
>   show normal view
> </dtml-if>

Unfortunately, this won't work with Stephan's exact example ;-)

>> When I send an URL with:
>> www.site.com/someobject?print

...this will always be false in you example.

The problem (I'd argue it's a bug, search the archives from about a year and a 
half ago for more discussion) is that whatever bit of whatever archane 
publishing thing (I think it's Medusa in this case) turns the query string into 
the REQUEST.form mapping ignores any query variables that don't have values (as 
in the example Stephan provided ;-)

I'd love to see whatever is causing this bug to cause:
www.site.com/someobject?print
...to be mapped into REQUEST as:
REQUEST.form['print']=None

What do others think?

In the meantime, the only way Stephan will get this to work is to butcher 
QUERY_STRING manually (dodgy, as Jens points out) or use ?print=1 instead.

cheers,

Chris