[Erp5-report] r21485 - in /erp5/trunk/bt5/erp5_web: SkinTemplateItem/portal_skins/erp5_web/...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jun 11 03:29:36 CEST 2008
Author: yo
Date: Wed Jun 11 03:29:36 2008
New Revision: 21485
URL: http://svn.erp5.org?rev=21485&view=rev
Log:
2008-06-11 yo
* Make the scripts for retrieving documents more consistent.
Modified:
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.xml
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.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_getDefaultDocumentValue.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.xml?rev=21485&r1=21484&r2=21485&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDefaultDocumentValue.xml Wed Jun 11 03:29:36 2008
@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
- <tuple>
- <string>Products.PythonScripts.PythonScript</string>
- <string>PythonScript</string>
- </tuple>
- <none/>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ <tuple/>
</tuple>
</pickle>
<pickle>
@@ -109,8 +106,8 @@
# to some extend. This list takes into account some common\n
# state IDs used in ERP5.\n
return context.getDocumentValue(name=reference_list,\n
- validation_state=[\'released\', \'published\', \'shared\',\n
- \'public\', \'validated\', ])\n
+ validation_state=(\'released\', \'released_alive\', \'published\', \'published_alive\',\n
+ \'shared\', \'shared_alive\', \'public\', \'validated\'))\n
</string> </value>
</item>
<item>
Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml?rev=21485&r1=21484&r2=21485&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml Wed Jun 11 03:29:36 2008
@@ -90,18 +90,21 @@
# The list of portal types here should be large enough to include\n
# all portal_types defined in the various sections so that\n
# href tags which point to a document by reference can still work.\n
-valid_portal_type_list = [\'Web Page\', ]\n
+valid_portal_type_list = portal.getPortalDocumentTypeList()\n
\n
# Find the applicable language\n
-if kw.has_key(\'language\'):\n
- language = kw[\'language\']\n
- del kw[\'language\']\n
-else:\n
+if language is None:\n
language = portal.Localizer.get_selected_language()\n
+\n
+if validation_state is None:\n
+ validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
+ \'shared\', \'shared_alive\', \'public\', \'validated\')\n
\n
# Search the catalog for all documents matching the reference\n
# this will only return documents which are accessible by the user\n
-web_page_list = portal_catalog(reference=name, portal_type=valid_portal_type_list,\n
+web_page_list = portal_catalog(reference=name,\n
+ portal_type=valid_portal_type_list,\n
+ validation_state=validation_state,\n
language=language,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
@@ -109,7 +112,9 @@
\n
if len(web_page_list) == 0 and language != \'en\':\n
# Search again with English as a fallback.\n
- web_page_list = portal_catalog(reference=name, portal_type=valid_portal_type_list,\n
+ web_page_list = portal_catalog(reference=name,\n
+ portal_type=valid_portal_type_list,\n
+ validation_state=validation_state,\n
language=\'en\',\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
@@ -117,7 +122,9 @@
\n
if len(web_page_list) == 0:\n
# Search again without the language\n
- web_page_list = portal_catalog(reference=name, portal_type=\'Web Page\', \n
+ web_page_list = portal_catalog(reference=name,\n
+ portal_type=valid_portal_type_list,\n
+ validation_state=validation_state,\n
order_by=[(\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
**kw)\n
@@ -154,7 +161,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>name, portal=None, **kw</string> </value>
+ <value> <string>name, portal=None, language=None, validation_state=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -174,7 +181,7 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>2</int> </value>
+ <value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
@@ -182,19 +189,19 @@
<tuple>
<string>name</string>
<string>portal</string>
+ <string>language</string>
+ <string>validation_state</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_catalog</string>
<string>valid_portal_type_list</string>
- <string>_getitem_</string>
- <string>language</string>
- <string>_write_</string>
<string>_apply_</string>
<string>web_page_list</string>
<string>len</string>
<string>web_page</string>
+ <string>_getitem_</string>
</tuple>
</value>
</item>
@@ -208,6 +215,8 @@
<value>
<tuple>
<none/>
+ <none/>
+ <none/>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml?rev=21485&r1=21484&r2=21485&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml Wed Jun 11 03:29:36 2008
@@ -112,22 +112,39 @@
\n
- Display only the latest version and the appropriate language.\n
"""\n
-portal_catalog = container.portal_catalog\n
-\n
-# First find the Web Section or Web Site we belong to\n
-current_section = context.getWebSectionValue()\n
-\n
-# Build the list of parameters\n
-if not kw.has_key(\'validation_state\'):\n
- kw[\'validation_state\'] = [\'draft\', \'submitted\', \'shared\',\n
- \'released\', \'published\', \'restricted\']\n
-if not kw.has_key(\'sort_on\'):\n
- kw[\'sort_on\'] = [(\'int_index\', \'descending\')]\n
-if not kw.has_key(\'group_by\'):\n
- kw[\'group_by\'] = (\'reference\',)\n
-\n
-# Return the list of matching documents for the given states\n
-return current_section.searchResults(**kw)\n
+from zExceptions import Unauthorized\n
+\n
+try:\n
+ portal = container.getPortalObject()\n
+ portal_catalog = portal.portal_catalog\n
+\n
+ # First find the Web Section or Web Site we belong to\n
+ current_section = context.getWebSectionValue()\n
+\n
+ # Build the list of parameters\n
+ valid_portal_type_list = portal.getPortalDocumentTypeList()\n
+\n
+ if language is None:\n
+ language = portal.Localizer.get_selected_language()\n
+\n
+ if validation_state is None:\n
+ validation_state = (\'released\', \'released_alive\', \'published\', \'published_alive\',\n
+ \'shared\', \'shared_alive\', \'public\', \'validated\')\n
+ if sort_on is None:\n
+ sort_on = [(\'int_index\', \'descending\')]\n
+\n
+ if group_by is None:\n
+ group_by = (\'reference\',)\n
+\n
+ # Return the list of matching documents for the given states\n
+ return current_section.searchResults(portal_type=valid_portal_type_list,\n
+ language=language,\n
+ validation_state=validation_state,\n
+ sort_on=sort_on,\n
+ group_by=group_by,\n
+ **kw)\n
+except Unauthorized:\n
+ return []\n
</string> </value>
</item>
<item>
@@ -150,7 +167,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>**kw</string> </value>
+ <value> <string>language=None, validation_state=None, sort_on=None, group_by=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -170,19 +187,27 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>0</int> </value>
+ <value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>language</string>
+ <string>validation_state</string>
+ <string>sort_on</string>
+ <string>group_by</string>
<string>kw</string>
+ <string>zExceptions</string>
+ <string>Unauthorized</string>
<string>_getattr_</string>
<string>container</string>
+ <string>portal</string>
<string>portal_catalog</string>
<string>context</string>
<string>current_section</string>
- <string>_write_</string>
+ <string>valid_portal_type_list</string>
+ <string>None</string>
<string>_apply_</string>
</tuple>
</value>
@@ -195,7 +220,12 @@
<item>
<key> <string>func_defaults</string> </key>
<value>
- <none/>
+ <tuple>
+ <none/>
+ <none/>
+ <none/>
+ <none/>
+ </tuple>
</value>
</item>
<item>
Modified: erp5/trunk/bt5/erp5_web/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/change_log?rev=21485&r1=21484&r2=21485&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/change_log (original)
+++ erp5/trunk/bt5/erp5_web/bt/change_log Wed Jun 11 03:29:36 2008
@@ -1,3 +1,6 @@
+2008-06-11 yo
+* Make the scripts for retrieving documents more consistent.
+
2008-06-10 yo
* Add a field for text content substitutions.
Modified: erp5/trunk/bt5/erp5_web/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/bt/revision?rev=21485&r1=21484&r2=21485&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/bt/revision (original)
+++ erp5/trunk/bt5/erp5_web/bt/revision Wed Jun 11 03:29:36 2008
@@ -1,1 +1,1 @@
-640
+641
More information about the Erp5-report
mailing list