Commit becf18ed authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_web: Cache the search for image url for the Hosting Subscription

parent 3e34de19
...@@ -50,18 +50,26 @@ ...@@ -50,18 +50,26 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>subscription_item = context\n <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
subscription_item = context\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
release = portal.portal_catalog.getResultValue(\n
portal_type="Software Release",\n
url_string=subscription_item.getUrlString(),\n
)\n
if release is not None:\n
software_product = release.getAggregateValue()\n
return \'%s/index_html\' % software_product.getDefaultImageAbsoluteUrl()\n
\n \n
return \'\'\n def getCachedDefaultImage(url_string):\n
release = portal.portal_catalog.getResultValue(\n
portal_type="Software Release",\n
url_string=url_string,\n
)\n
if release is not None:\n
software_product = release.getAggregateValue()\n
return \'%s/index_html\' % software_product.getDefaultImageAbsoluteUrl()\n
\n
return \'\'\n
\n
return CachingMethod(getCachedDefaultImage, \n
(\'HostingSubscription_getDefaultImageAbsoluteUrl_cached\',),\n
cache_factory=\'erp5_ui_long\')(subscription_item.getUrlString())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment