source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/skins/cache_setup/getImageAndFilePurgeUrls.py @ 3296

Last change on this file since 3296 was 3296, checked in by fenix, 13 years ago

Load Products.CacheSetup?-1.2.1 into vendor/Products.CacheSetup?/current.

  • Property svn:eol-style set to native
File size: 761 bytes
Line 
1## Script (Python) "getImageAndFilePurgeUrls"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=Get extra urls to purge for ATImage and ATFile downloads
9
10if not context.portal_type in ('Image', 'File'):
11    return []
12url_tool = context.portal_url
13obj_url = url_tool.getRelativeUrl(context)
14if context.portal_type == 'File':
15    suffixes = ['/download', '/at_download', '/at_download/file']
16elif context.portal_type == 'Image':
17    field = context.getField('image')
18    scalenames = field.getAvailableSizes(context)
19    suffixes = ['/image_' + s for s in scalenames] + [
20        '/download', '/at_download', '/at_download/image']
21return [obj_url + s for s in suffixes]
Note: See TracBrowser for help on using the repository browser.