[Zope] Repeated (growing) URL elements....

Dennis Allison allison at sumeru.stanford.EDU
Mon Sep 8 10:30:09 EDT 2003


Check the archives -- there are many threads about this issue.
I think it all boils down to always using absolute URLs.  You can 
pass back parameters with a redirect, BTW,  using the usual mechanism 
<url>?<name>=value&name=value formulation.

On Mon, 8 Sep 2003, Celula Research wrote:

> Zopistas:
> 
> If there is a simple form named "Form_1" and created within
> the web ZMI in a DTMLDocument object, like:
> 
> <dtml-if mensaje_error>
>  <dtml-var mensaje_error>
> </dtml-if>
> <form action="product/validate_Form_1" method="post">
>   <input type="text" name="account">
>   <input type="submit" name="submit" value="Enter >">
> </form>
> 
> I have also built a Zope product which works fine, it is
> instantiated in the same Folder as "Form_1" with the id "product" 
> and it provides the method "validate_Form_1" which is something quite
> simple to validate errors:
> 
> def validate_Form_1(self,REQUEST,RESPONSE):
>         "Code to validate form1"
>         if not REQUEST.account:
>            self.REQUEST['msg_error']="Account code is required"
>         elif len(self.REQUEST['account']) < 1:
>            self.REQUEST['msg_error']="Account lenght < 1 "
>         elif len(self.REQUEST['account']) > 6:
>            self.REQUEST['msg_error']="Account lenght > 6"
>         REQUEST=self.REQUEST
>         return self.Form_1(REQUEST)
> 
> My problem is, everytime the Form_1 is returned from the
> validate_Form_1, the URL in the browser starts growing like:
> 
> http://localhost:8080/Folder/Form_1  <--- Initial call, works OK
> http://localhost:8080/Folder/product/Form_1  <---First validation
> http://localhost:8080/Folder/product/product/Form_1 <----2nd pass.
> and so on....
> 
> I want the .../product/product/... not to start growing with every pass
> through the product's methods. I want the return, to print in the
> browser's URL the actual path to the Form_1, if possible, without the
> "product" ....
> 
> What would be the way of doing that? 
> 
> I have tried RESPONSE.redirect instead of just "return
> self.Form_1(REQUEST)" with absolute_url() and using things like
> REQUEST['HTTP_REFERER'] but in those cases I am not able to pass any
> parameters back (REQUEST)
> 
> Your assistance, comments and suggestions are greatly
> appreciated...Thanks in advance
> 
> Edward.
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 




More information about the Zope mailing list