Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
7ad0751c
Commit
7ad0751c
authored
May 23, 2013
by
Rafael Monnerat
👻
Committed by
Xiaowu Zhang
Feb 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert usage of Caching Methods
parent
c1a6fc48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
32 deletions
+28
-32
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml
...rp5_commerce_widget_library/WebSection_getProductList.xml
+17
-14
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml
...s/erp5_commerce_widget_library/WebSite_getProductList.xml
+10
-17
bt5/erp5_commerce/bt/revision
bt5/erp5_commerce/bt/revision
+1
-1
No files found.
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSection_getProductList.xml
View file @
7ad0751c
...
...
@@ -10,6 +10,12 @@
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
...
...
@@ -51,9 +57,13 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# the goal of this script is to get all the related product of this section\n
from Products.ERP5Type.Cache import CachingMethod
\n
\n
current_web_section = context.REQUEST.get(\'current_web_section\', context)\n
\n
# XXX Somehow Customize it Only list published products.\n
kw[\'validation_state\'] = \'published\'\n
\n
\n
if not kw.has_key(\'portal_type\'):\n
kw[\'portal_type\'] = \'Product\'\n
\t \n
...
...
@@ -69,20 +79,13 @@ if not kw.has_key(\'all_languages\'):\t\t \n
for key in [\'limit\',\'all_versions\',\'all_languages\']:\t\t \n
kw[key] = int(kw[key])\n
\n
\n
def getProductList(context_relative_url, limit, all_versions, all_languages):\n
# Gabriel: The condition was added to not break the paypal return\n
# after finish the payment. The verify_sign is checked because all\n
# data from paypal have this key\n
if kw.has_key(\'quantity\') and kw.has_key("verify_sign"):\n
del kw[\'quantity\']\n
# Gabriel: The condition was added to not break the paypal return\n
# after finish the payment. The verify_sign is checked because all\n
# data from paypal have this key\n
if kw.has_key(\'quantity\') and kw.has_key("verify_sign"):\n
del kw[\'quantity\']\n
\t\t \n
return current_web_section.getDocumentValueList(**kw)\n
\n
\n
return CachingMethod(getProductList,\n
id="WebSection_getProductList_ecommerce",\n
cache_factory=\'erp5_ui_short\')(current_web_section.getRelativeUrl(),kw[\'limit\'],kw[\'all_versions\'], kw[\'all_languages\'])\n
return current_web_section.getDocumentValueList(**kw)\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce_widget_library/WebSite_getProductList.xml
View file @
7ad0751c
...
...
@@ -54,30 +54,23 @@
# The goal of this script is to get all the products from all the visible Web Sections\n
# and it must select randomly which product must be displayed for a given context.\n
from
Products.ERP5Type.Cache import CachingMethod
\n
from
random import choice
\n
\n
if not kw.has_key(\'portal_type\'):\n
kw[\'portal_type\'] = \'Product\'\n
\n
def getProductList(limit, portal_type):\n
from random import choice\n
\n
web_site = context.getWebSiteValue() or context.REQUEST.get(\'current_web_site\')\n
web_site = context.getWebSiteValue() or context.REQUEST.get(\'current_web_site\')\n
\n
# Getting all the products from all the visible Web Section.\n
product_dict = {}\n
for web_section in web_site.WebSite_getMainSectionList():\n
for product in web_section.getDocumentValueList(all_versions=1, all_languages=1, **kw):\n
product_dict[product.uid] = product\n
# Getting all the products from all the visible Web Section.\n
product_dict = {}\n
for web_section in web_site.WebSite_getMainSectionList():\n
for product in web_section.getDocumentValueList(all_versions=1, all_languages=1, **kw):\n
product_dict[product.uid] = product\n
\n
if len(product_dict) >
limit:\n
return random.sample(product_dict.values(), limit)\n
if len(product_dict) >
limit:\n
return random.sample(product_dict.values(), limit)\n
\n
return product_dict.values()\n
\n
return CachingMethod(getProductList,\n
id="WebSite_getProductList_ecommerce",\n
cache_factory=\'erp5_ui_short\')(limit, kw[\'portal_type\'])\n
return product_dict.values()\n
]]>
</string>
</value>
...
...
bt5/erp5_commerce/bt/revision
View file @
7ad0751c
322
\ No newline at end of file
323
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment