[Zope] Re: [Zope-DB] off - Have Zope a querystring parse routine ? (plus others)

Dieter Maurer dieter at handshake.de
Fri Jun 25 14:54:10 EDT 2004


fowlertrainer at anonym.hu wrote at 2004-6-24 12:13 +0200:
> ..
>Sorry, but zope at zope.org is not send mails to me, and I cannot login to 
>it, and it cannot send a pwd reminder to me...

The Zope mailing lists are up again...
Redirected to "zope at zope.org"

>1.)
>I want to use query-string, and post datas in combined dictionary.
>I have a page that I must access with special query string,  but it have
>post datas.
>
>The simple way is to redefine the post action, not the use of hidden
>parameters:
>
>action="/?pid=113"
>
>But if I post that page, the pid is not in request, or request.form,
>because it is in query string, and Zope is use that post datas, not the
>query string.
>
>So query string is unparsed, and if I want to get the params, I need to
>parse items, and place in querydict dictionary.
>My parse routine (what a pity) not handle the non-us, or other special
>characters.
>
>How to I do it simply ?

It is very difficult to decode what you want to do...

Use a hidden variable if this is possible at all.

If it is not (what I really doubt), then Python's
"cgi" module contains methods to decode the query string.

>2.)
>How to I avoid in Zope that request.form items are appear in request ?
>It is a possible way to inject variables in request from out...

I am surprised about your wishes...

  Why (in hell) should "request.get" not return elements from "request.form"?

Should you really need it, then use an External Method
that removes what you do not like from "request.other" (that's
where "request.get" really looks at).

>3.)
>I there a way in Zope to get some often used routines simply ?
>(Aliases ?)
>
>Now I need to repeat in every pyscript:
>
>rq=context.REQUEST
>...
>
>or
>CreateCombo=context.routines.html.CreateCombo
>combotext=CreateCombo(name,id,items,......)

You have to pay a price for "explicit is better than implicit"...

That said: When you care enough, then you can make your life
easier -- by *MODIFYING* Zope code.

For example, you can add a new "binding" for PythonScripts
that make "request" available as an additional bound name
(beside "context", "container", ...). I think, this would
be a good thing...

And you can add additional functions to the "builtins" for
PythonScripts. To learn how you do this, you can look
at my "hasattr_unaquired" patch in the Zope collector.

But, neither Python nor Zope's Python Scripts support
macros. All you have are functions...


-- 
Dieter


More information about the Zope mailing list