[Zope3-Users] raise Redir(newurl) not working - can someone confirm this?

2008-04-19 Thread Hermann Himmelbauer
Hi,
In my application, namely for URL-Rewriting for session handling, I need to 
stop the current request and redirect to another url (including the session 
key).

For that reason, I issue the following statement:

from zope.publisher.interfaces import Redirect
raise Redirect('http://my.new.url')

Theoretically, this exception should be caught by the publisher and a redirect 
should be done, unfortunately not in my case:

-
Traceback (most recent call last):
  File /local/home/dusty/Zope-3.4.0c1/lib/python/zope/publisher/publish.py, 
line 130, in publish
obj = request.traverse(obj)

  File /home/dusty/prog/zope3-inst/lib/python/my_app/session.py, line 72, in 
getClientId
raise Redirect(redir_url)
Redirect: 
Location: 
/++session++VLdODjCYl90YmQwdNG6hvdiT11UZS3oly5kXonWYLHdGHloxvTshQs/favicon.ico
--

I don't know why this happens, *maybe* that's due to inclusion of some 3rd 
party packages, e.g. z3c.layer.pagelet?

To confirm this, I'd like to know if this scenario is only happening for me, 
so, can you please simply insert the above statement in some arbitrary view 
and tell me if it works?

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] raise Redir(newurl) not working - can someone confirm this?

2008-04-19 Thread Jim Fulton


On Apr 19, 2008, at 6:20 AM, Hermann Himmelbauer wrote:

Hi,
In my application, namely for URL-Rewriting for session handling, I  
need to
stop the current request and redirect to another url (including the  
session

key).

For that reason, I issue the following statement:

from zope.publisher.interfaces import Redirect
raise Redirect('http://my.new.url')

Theoretically, this exception should be caught by the publisher and  
a redirect

should be done, unfortunately not in my case:

-
Traceback (most recent call last):
 File /local/home/dusty/Zope-3.4.0c1/lib/python/zope/publisher/ 
publish.py,

line 130, in publish
   obj = request.traverse(obj)

 File /home/dusty/prog/zope3-inst/lib/python/my_app/session.py,  
line 72, in

getClientId
   raise Redirect(redir_url)
Redirect:
Location: /++session+ 
+VLdODjCYl90YmQwdNG6hvdiT11UZS3oly5kXonWYLHdGHloxvTshQs/favicon.ico

--

I don't know why this happens, *maybe* that's due to inclusion of  
some 3rd

party packages, e.g. z3c.layer.pagelet?

To confirm this, I'd like to know if this scenario is only happening  
for me,
so, can you please simply insert the above statement in some  
arbitrary view

and tell me if it works?



This may be a bug in Zope 3.  I suspect that there needs to be an  
error view or Redirect that actually does the redirect.


I think you are going to have to register a page for the redirect  
exception that calls response.redirect.


See zope.app.exception.browser for other examples of exception views.

Jim


--
Jim Fulton
Zope Corporation


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] raise Redir(newurl) not working - can someone confirm this?

2008-04-19 Thread Hermann Himmelbauer
Am Samstag, 19. April 2008 15:43 schrieb Jim Fulton:
 On Apr 19, 2008, at 6:20 AM, Hermann Himmelbauer wrote:
  To confirm this, I'd like to know if this scenario is only happening
  for me,
  so, can you please simply insert the above statement in some
  arbitrary view
  and tell me if it works?

 This may be a bug in Zope 3.  I suspect that there needs to be an
 error view or Redirect that actually does the redirect.

 I think you are going to have to register a page for the redirect
 exception that calls response.redirect.

 See zope.app.exception.browser for other examples of exception views.

Ah, yes, thanks. I managed to register a page for this exception, which is 
called in this case, however, what I don't know is how to extract the 
exception string (which is the URL I want to redirect to) in my view. Any 
suggestions?

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] raise Redir(newurl) not working - can someone confirm this?

2008-04-19 Thread Hermann Himmelbauer
Am Samstag, 19. April 2008 19:38 schrieb Hermann Himmelbauer:
 Am Samstag, 19. April 2008 15:43 schrieb Jim Fulton:
  On Apr 19, 2008, at 6:20 AM, Hermann Himmelbauer wrote:
   To confirm this, I'd like to know if this scenario is only happening
   for me,
   so, can you please simply insert the above statement in some
   arbitrary view
   and tell me if it works?
 
  This may be a bug in Zope 3.  I suspect that there needs to be an
  error view or Redirect that actually does the redirect.
 
  I think you are going to have to register a page for the redirect
  exception that calls response.redirect.
 
  See zope.app.exception.browser for other examples of exception views.

 Ah, yes, thanks. I managed to register a page for this exception, which is
 called in this case, however, what I don't know is how to extract the
 exception string (which is the URL I want to redirect to) in my view. Any
 suggestions?

Ah, ok, simple, got it by myself: The error is simply self.context in my view.

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users