Commit 470188fd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! erp5_web: introduce translatable path.

parent 1f649a49
......@@ -160,7 +160,7 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
query_string = self.REQUEST.get('QUERY_STRING', '')
if query_string:
translated_url += '?' + query_string
self.REQUEST.RESPONSE.redirect(translated_url, status=301)
self.REQUEST.RESPONSE.redirect(translated_url)
return document
def _getTranslatedPathDict(self):
......@@ -179,7 +179,7 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
checkValidId(self, translated_section_id, allow_dup=True)
key = (translated_section_id, language)
if key in translated_path_dict:
raise ValueError, '%r is used in several sections : %r' % (key, (translated_path_dict[key], section_id))
raise ValueError('%r is used in several sections : %r' % (key, (translated_path_dict[key], section_id)))
translated_path_dict[key] = section_id
if translated_path_dict != self._getTranslatedPathDict():
setattr(self, INTERNAL_TRANSLATED_PATH_DICT_NAME, translated_path_dict)
......
......@@ -1629,16 +1629,16 @@ Hé Hé Hé!""", page.asText().strip())
website_path = website.absolute_url_path()
# /fr/ccc/ is /aaa/
response = self.publish(website_path + '/fr/ccc/')
self.assertEqual(response.status, 200)
self.assertEqual(HTTP_OK, response.status)
self.assertIn('page1 in French', response.getBody())
# /fr/aaa/ is /bbb/
response = self.publish(website_path + '/fr/aaa/')
self.assertEqual(response.status, 200)
self.assertEqual(HTTP_OK, response.status)
self.assertIn('page2 in French', response.getBody())
# /fr/bbb/ should be redirected to /fr/aaa/
response = self.publish(website_path + '/fr/bbb/')
self.assertEqual(response.status, 301)
self.assertEqual(response.getHeader('Location'), website.absolute_url() + '/fr/aaa/')
self.assertEqual(MOVED_TEMPORARILY, response.status)
self.assertEqual(website.absolute_url() + '/fr/aaa/', response.getHeader('Location'))
class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment