[Erp5-report] r32175 fabien - in /erp5/trunk/bt5/erp5_web: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 2 14:03:21 CET 2010


Author: fabien
Date: Tue Feb  2 14:03:20 2010
New Revision: 32175

URL: http://svn.erp5.org?rev=32175&view=rev
Log:
2010-02-02 fabien
* remove WebSection_getPermanentURLForView which was bad (see bug #1507) and use getPermanentUrl() from WebSection.py.
* WebSection_getPermanentUrl script is not used anymore (and should never be used, it should be called only by getPermanentUrl() from WebSection.py). Now by default, getPermanentUrl(document) always return a link to html content. If you want to get a link to a file (ie. openoffice document, pdf document, ...) you should explicitly specify it :
getPermanentUrl(document, view=False)

Reviewed by Kazuhiko

Modified:
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getSiteMapTree.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/breadcrumb.xml
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/section_content_render.xml
    erp5/trunk/bt5/erp5_web/bt/change_log
    erp5/trunk/bt5/erp5_web/bt/revision

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getPermanentURL.xml [utf8] Tue Feb  2 14:03:20 2010
@@ -81,6 +81,9 @@
 \n
  The document parameter is required.\n
 \n
+ If view is True, the url returned point to html content and can be opened in\n
+ a browser (ie. + \'/view\' for ooo documents)\n
+\n
  More sophisticated behaviours are possible.\n
 \n
  SUGGESTIONS:\n
@@ -91,9 +94,14 @@
  - change the behaviour of WebSection_getPermanentURL\n
    for documents which are not published.\n
 """\n
+html_portal_type_list = (\'Web Site\', \'Web Section\', \'Web Page\')\n
+portal_type = document.getPortalType()\n
+\n
 # If no reference is defined, no way to build a permanent URL.\n
 reference = document.getReference()\n
 if not reference:\n
+  if view and portal_type not in html_portal_type_list:\n
+    return \'%s/view\' % document.absolute_url()\n
   return document.absolute_url()\n
 \n
 # Return absolute URL if this is not an appropriate portal_type\n
@@ -101,15 +109,21 @@
 valid_portal_type_list = portal.getPortalDocumentTypeList()\n
 portal_type = document.getPortalType()\n
 if portal_type not in valid_portal_type_list:\n
+  if view and portal_type not in html_portal_type_list:\n
+    return \'%s/view\' % document.absolute_url()\n
   return document.absolute_url()\n
 \n
 # Return absolute URL if this is not a \'live\' document\n
 validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
                     \'shared\', \'shared_alive\', \'public\', \'validated\')\n
 if document.getValidationState() not in validation_state:\n
+  if view and portal_type not in html_portal_type_list:\n
+    return \'%s/view\' % document.absolute_url()\n
   return document.absolute_url()\n
 \n
 # Return the URL\n
+if view and portal_type not in html_portal_type_list:\n
+  return \'%s/%s/view\' % (context.absolute_url(), reference)\n
 return "%s/%s" % (context.absolute_url(), reference)\n
 </string> </value>
         </item>
@@ -121,7 +135,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>document</string> </value>
+            <value> <string>document, view=True</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -141,19 +155,21 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
                             <string>document</string>
+                            <string>view</string>
+                            <string>html_portal_type_list</string>
                             <string>_getattr_</string>
+                            <string>portal_type</string>
                             <string>reference</string>
                             <string>context</string>
                             <string>portal</string>
                             <string>valid_portal_type_list</string>
-                            <string>portal_type</string>
                             <string>validation_state</string>
                           </tuple>
                         </value>
@@ -166,7 +182,9 @@
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <int>1</int>
+              </tuple>
             </value>
         </item>
         <item>

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getSiteMapTree.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getSiteMapTree.xml?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getSiteMapTree.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getSiteMapTree.xml [utf8] Tue Feb  2 14:03:20 2010
@@ -117,7 +117,7 @@
       if default_document is not None and default_document.getPhysicalPath() == document.getPhysicalPath():\n
         continue\n
       result.append({\n
-                      \'url\'      : section.WebSection_getPermanentURLForView(document),\n
+                      \'url\'      : section.getPermanentURL(document),\n
                       \'level\'    : level,\n
                       \'section\'  : None,\n
                       \'document\' : document,\n

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewContentListAsRSS/listbox_link.xml [utf8] Tue Feb  2 14:03:20 2010
@@ -273,7 +273,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:cell.WebSection_getPermanentURLForView(cell)</string> </value>
+            <value> <string>python:cell.getPermanentURL(cell)</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/breadcrumb.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/breadcrumb.xml?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/breadcrumb.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/breadcrumb.xml [utf8] Tue Feb  2 14:03:20 2010
@@ -49,7 +49,7 @@
       tal:condition="remaining_items">\n
     <li tal:define="current_item    python: remaining_items[0];\n
                     remaining_items python: remaining_items[1:]">\n
-      <a tal:attributes="href  python: \'%s/view\' % current_item[1].getPermanentURL(current_item[1]);\n
+      <a tal:attributes="href  python: current_item[1].getPermanentURL(current_item[1]);\n
                          class python: len(remaining_items) == 0 and \'selected\' or \'\'"\n
           tal:content="python: current_item[0]"/>\n
       <tal:block metal:use-macro="here/breadcrumb/macros/renderBreadcrumbItem"/>\n

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/section_content_render.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/section_content_render.xml?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/section_content_render.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/section_content_render.xml [utf8] Tue Feb  2 14:03:20 2010
@@ -46,7 +46,7 @@
 </tal:block>\n
 \n
 <ul tal:repeat="document python:here.getDocumentValueList()">\n
-  <li><a tal:attributes="href python:here.WebSection_getPermanentURLForView(document)"\n
+  <li><a tal:attributes="href python:here.getPermanentUrl(document)"\n
          tal:content="python: document.getProperty(\'translated_short_title\', None)\n
                               or document.getTranslatedTitleOrId()"/></li>\n
 </ul>\n

Modified: erp5/trunk/bt5/erp5_web/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/change_log?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/bt/change_log [utf8] Tue Feb  2 14:03:20 2010
@@ -1,3 +1,8 @@
+2010-02-02 fabien
+* remove WebSection_getPermanentURLForView which was bad (see bug #1507) and use getPermanentUrl() from WebSection.py.
+* WebSection_getPermanentUrl script is not used anymore (and should never be used, it should be called only by getPermanentUrl() from WebSection.py). Now by default, getPermanentUrl(document) always return a link to html content. If you want to get a link to a file (ie. openoffice document, pdf document, ...) you should explicitly specify it :
+getPermanentUrl(document, view=False)
+
 2010-01-22 nicolas
 * Update configuration of Caching Policy Manager to fill Last-Modified Header with modification_date.
 * Web Site and Web Section are not using Caching Policy Manager

Modified: erp5/trunk/bt5/erp5_web/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/revision?rev=32175&r1=32174&r2=32175&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/bt/revision [utf8] Tue Feb  2 14:03:20 2010
@@ -1,1 +1,1 @@
-904
+905




More information about the Erp5-report mailing list