source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/patch_five.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: 984 bytes
Line 
1"""
2When using Plone 2.5, we've got to patch Five separately as the page
3template patches in patch_cmf are overridden by Five's patches of the
4same code.
5"""
6from Products.CacheSetup.config import log, PLONE25
7import Products.CacheSetup.patch_cmf as patch_cmf
8
9def run():
10    if not PLONE25:
11        # we don't need to do this w/ Z2.10, which uses Z3 PT engine
12        return
13   
14    log('Applying Five patches...')
15    from Products.Five.browser.ReuseUtils import rebindFunction
16    from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile \
17         as Z2PTF
18    from Products.Five.browser.TrustedExpression import getEngine
19
20    # CacheFu expects to find the original method on the class as
21    # __CacheSetup_PageTemplate_<METHOD_NAME>
22    orig_method = getattr(Z2PTF, 'pt_render')
23    Z2PTF.__CacheSetup_PageTemplate_pt_render__ = orig_method
24
25    new_pt_render = rebindFunction(patch_cmf.PT_pt_render, getEngine=getEngine)
26    Z2PTF.pt_render = new_pt_render
Note: See TracBrowser for help on using the repository browser.