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

Celula Research fb at celula.com
Mon Sep 8 11:41:49 EDT 2003


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.




More information about the Zope mailing list