[Erp5-report] r26984 - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 14 16:10:37 CEST 2009


Author: kazuhiko
Date: Thu May 14 16:10:36 2009
New Revision: 26984

URL: http://svn.erp5.org?rev=26984&view=rev
Log:
we use web_site_module/site_id/section_id/page_reference as the url of the default document.

Modified:
    erp5/trunk/products/ERP5/Document/WebSection.py
    erp5/trunk/products/ERP5/tests/testERP5Web.py

Modified: erp5/trunk/products/ERP5/Document/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/WebSection.py?rev=26984&r1=26983&r2=26984&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py [utf8] Thu May 14 16:10:36 2009
@@ -188,13 +188,13 @@
               if getDefaultDocumentValue() is not None:
                 # force user to login as specified in Web Section
                 raise Unauthorized
-          if document is not None:
+          if document is not None and document.getReference() is not None:
+            # we use web_site_module/site_id/section_id/page_reference
+            # as the url of the default document.
             self.REQUEST.set('current_web_document', document)
             self.REQUEST.set('is_web_section_default_document', 1)
             document = aq_base(document.asContext(
-                id=self.getId(), # A quick hack to force URL to point to self
-                  # XXX - A better solution here consists of using PermanentURL
-                  # to find out under which id the document should be published
+                id=document.getReference(),
                 original_container=document.getParentValue(),
                 original_id=document.getId(),
                 editable_absolute_url=document.absolute_url()))

Modified: erp5/trunk/products/ERP5/tests/testERP5Web.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Web.py?rev=26984&r1=26983&r2=26984&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] Thu May 14 16:10:36 2009
@@ -355,7 +355,7 @@
     from Products.ERP5.Document.Document import Document
     base_list = re.findall(Document.base_parser, str(html_page))
     base_url = base_list[0]
-    self.assertEqual(base_url, "%s/%s/" % (websection.absolute_url(), websection.getId()))
+    self.assertEqual(base_url, "%s/%s/" % (websection.absolute_url(), web_page_en.getReference()))
     
   def test_06b_DefaultDocumentForWebSite(self, quiet=quiet, run=run_all_test):
     """
@@ -398,7 +398,7 @@
     from Products.ERP5.Document.Document import Document
     base_list = re.findall(Document.base_parser, str(html_page))
     base_url = base_list[0]
-    self.assertEqual(base_url, "%s/%s/" % (website.absolute_url(), website.getId()))
+    self.assertEqual(base_url, "%s/%s/" % (website.absolute_url(), web_page_en.getReference()))
 
   def test_07_WebSection_getDocumentValueList(self, quiet=quiet, run=run_all_test):
     """ Check getting getDocumentValueList from Web Section.




More information about the Erp5-report mailing list