[Zope] - Testing for query variable existance in dhtml
Jim Fulton
jim@digicool.com
Fri, 15 Jan 1999 12:24:15 +0000
Brad Clements wrote:
>
> I have a document that is called with or without a query value.
>
> http://myhost/mydocument?list=thislist
>
> or
>
> http://myhost/mydocument
>
> What's the best way to determine if list is defined in the request? I tried
>
> <!--#if REQUEST.has_key(list)-->
>
> That didn't work, either with or without quotes
Did you you try:
<!--#if "REQUEST.has_key('list')"-->
In all of the examples you've given, you've
ommitted quotes for 'list'. If you use list in
an expression without quotes, you are trying to get the
value of list. In most of your examples, you *really*
want the string (ie name) list.
> Also, whats the correct way to determine if list points to a valid object, I
> tried this.
>
> <!--#with REQUEST-->
> <!--#if _.has_key(list)-->
> <!--#var _.getitem(list,1)-->
You are missing a lot of quotes.
>
> This seems to work if list is pointing to a valid object, but I get "Sorry,
> Zope is offline" error if list is an invalid object name.
I'm not sure what you mean by valid.
If you want to test if the name has a definition, then just use:
<!--#if list-->
> What I really want to know is if list names something IN the current
> Folder that contains the current document..
>
> Any suggestions?
<!--#if list--><!--#unless "REQUEST.has_key('list')"-->
...
<!--#/unless--><!--#/if-->
Jim
--
Jim Fulton mailto:jim@digicool.com
Technical Director (540) 371-6909 Python Powered!
Digital Creations http://www.digicool.com http://www.python.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.