I fix the problem causing the potemplate-admin test to fail.
When you have time, please take a look at this diff and tell me if there is anything I need to do to have this branch landed.
Many thanks!
Here is the diff.
=== modified file 'lib/lp/translations/browser/potemplate.py'
--- lib/lp/translations/browser/potemplate.py 2010-03-09 14:59:09 +0000
+++ lib/lp/translations/browser/potemplate.py 2010-03-09 15:44:38 +0000
@@ -550,10 +550,19 @@
# The referer header we want is only available before the view's
# form submits to itself. This field is a hidden input in the form.
referrer = self.request.form.get('next_url')
+
if referrer is None: referrer = self.request.getHeader('referer')
+ # If we don't have a referrer in the HTTP header, if referrer
+ # contains the template name or if referrer is outside of our
+ # website, getting the next_url is delayed until the
+ # form is submitted.
+ # It is not computed before the submission, since from this form
+ # the template name can be changed and if referrer url depends on
+ # it, renaming will make the referrer an invalid URL.
if (referrer is None
- or self.context.name in referrer):
+ or self.context.name in referrer
+ or not referrer.startswith(self.request.getApplicationURL())): # XXX: AdiRoiban 2010-02-32 bug=526998 # Since 'referer' can depend on the object name, and # since from this form we can rename the object
Hi,
I fix the problem causing the potemplate-admin test to fail.
When you have time, please take a look at this diff and tell me if there is anything I need to do to have this branch landed.
Many thanks!
Here is the diff. translations/ browser/ potemplate. py' translations/ browser/ potemplate. py 2010-03-09 14:59:09 +0000 translations/ browser/ potemplate. py 2010-03-09 15:44:38 +0000 form.get( 'next_url' )
referrer = self.request. getHeader( 'referer' ) startswith( self.request. getApplicationU RL())):
# XXX: AdiRoiban 2010-02-32 bug=526998
# Since 'referer' can depend on the object name, and
# since from this form we can rename the object
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -550,10 +550,19 @@
# The referer header we want is only available before the view's
# form submits to itself. This field is a hidden input in the form.
referrer = self.request.
+
if referrer is None:
+ # If we don't have a referrer in the HTTP header, if referrer
+ # contains the template name or if referrer is outside of our
+ # website, getting the next_url is delayed until the
+ # form is submitted.
+ # It is not computed before the submission, since from this form
+ # the template name can be changed and if referrer url depends on
+ # it, renaming will make the referrer an invalid URL.
if (referrer is None
- or self.context.name in referrer):
+ or self.context.name in referrer
+ or not referrer.