[Erp5-report] r39984 nicolas - in /erp5/trunk/bt5/erp5_trade: SkinTemplateItem/portal_skins...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Nov 5 18:07:48 CET 2010
Author: nicolas
Date: Fri Nov 5 18:07:48 2010
New Revision: 39984
URL: http://svn.erp5.org?rev=39984&view=rev
Log:
avoid acquisition lookups:
* Get tools from portal
* Call getPortalXXXTypeList from portal itself
Modified:
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.xml
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml
erp5/trunk/bt5/erp5_trade/bt/revision
Modified: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.xml?rev=39984&r1=39983&r2=39984&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getResourceItemList.xml [utf8] Fri Nov 5 18:07:48 2010
@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
@@ -54,16 +51,16 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n
+portal = context.getPortalObject()\n
\n
-\n
-if context.getPortalType() in context.getPortalSaleTypeList():\n
+if context.getPortalType() in portal.getPortalSaleTypeList():\n
use_list = context.portal_preferences.getPreferredSaleUseList()\n
-elif context.getPortalType() in context.getPortalPurchaseTypeList():\n
- use_list = context.portal_preferences.getPreferredPurchaseUseList()\n
+elif context.getPortalType() in portal.getPortalPurchaseTypeList():\n
+ use_list = portal.portal_preferences.getPreferredPurchaseUseList()\n
else:\n
- use_list = context.portal_preferences.getPreferredPurchaseUseList() + context.portal_preferences.getPreferredSaleUseList()\n
+ use_list = portal.portal_preferences.getPreferredPurchaseUseList() + portal.portal_preferences.getPreferredSaleUseList()\n
\n
-if len(use_list) == 0:\n
+if not use_list:\n
return []\n
\n
sql_kw = {}\n
@@ -162,14 +159,15 @@ return getResourceItemList(sql_kw)\n
<string>CachingMethod</string>
<string>_getattr_</string>
<string>context</string>
+ <string>portal</string>
<string>use_list</string>
- <string>len</string>
<string>sql_kw</string>
<string>resource_title</string>
<string>AttributeError</string>
<string>None</string>
<string>reference</string>
<string>_write_</string>
+ <string>len</string>
<string>getResourceItemList</string>
<string>append</string>
<string>$append0</string>
Modified: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml?rev=39984&r1=39983&r2=39984&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml [utf8] Fri Nov 5 18:07:48 2010
@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
@@ -60,28 +57,29 @@
"""\n
from Products.ERP5Type.Message import translateString\n
from Products.ERP5Type.Log import log\n
+portal = context.getPortalObject()\n
\n
# Retrieve line and cell portal type\n
line_portal_type_list = [x for x in context.getTypeInfo().getTypeAllowedContentTypeList() \\\n
- if x in context.getPortalMovementTypeList()]\n
+ if x in portal.getPortalMovementTypeList()]\n
line_portal_type = line_portal_type_list[0]\n
-cell_portal_type_list = [x for x in context.portal_types[line_portal_type].getTypeAllowedContentTypeList() \\\n
- if x in context.getPortalMovementTypeList()]\n
+cell_portal_type_list = [x for x in portal.portal_types[line_portal_type].getTypeAllowedContentTypeList() \\\n
+ if x in portal.getPortalMovementTypeList()]\n
cell_portal_type = cell_portal_type_list[0]\n
\n
per_resource_line_dict = {}\n
\n
for line in listbox:\n
# Only create line if user has selected a resource\n
- if line.has_key(\'listbox_key\') and (line.get(\'resource_relative_url\', None) not in ("", None) \\\n
+ if \'listbox_key\' in line and (line.get(\'resource_relative_url\', None) not in ("", None) \\\n
or line.get(\'source\', None) not in ("", None)):\n
line_id = line[\'listbox_key\']\n
\n
if line.get(\'resource_relative_url\', None) not in ("", None):\n
- product = context.getPortalObject().restrictedTraverse(line["resource_relative_url"])\n
+ product = portal.restrictedTraverse(line["resource_relative_url"])\n
\n
if line.get(\'source\', None) not in ("", None):\n
- source_document = context.getPortalObject().restrictedTraverse(line[\'source\'])\n
+ source_document = portal.restrictedTraverse(line[\'source\'])\n
product = source_document.getResourceValue()\n
else:\n
source_document = None\n
@@ -94,7 +92,7 @@ for line in listbox:\n
# if there was no document line already defined\n
# for the document, add a new document line\n
\n
- # We check if havn\'t already create a line for the same resource\n
+ # We check if haven\'t already create a line for the same resource\n
key = "%s" %(product.getRelativeUrl(),)\n
trade_document_line = per_resource_line_dict.get(key, None)\n
if trade_document_line is None:\n
@@ -169,11 +167,12 @@ return context.Base_redirect(kw[\'form_i
<string>translateString</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
- <string>_getattr_</string>
- <string>context</string>
<string>x</string>
<string>line_portal_type_list</string>
<string>_getitem_</string>
Modified: erp5/trunk/bt5/erp5_trade/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/revision?rev=39984&r1=39983&r2=39984&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/bt/revision [utf8] Fri Nov 5 18:07:48 2010
@@ -1 +1 @@
-1014
\ No newline at end of file
+1015
\ No newline at end of file
More information about the Erp5-report
mailing list