Back to index

plone3  3.1.7
macro_replacer.py
Go to the documentation of this file.
00001 # -*- coding: UTF-8 -*-
00002 
00003 from zope.interface import implements
00004 
00005 from plonekssview import PloneKSSView
00006 from interfaces import IPloneKSSView
00007 
00008 class MacroView(PloneKSSView):
00009 
00010     # --
00011     # Macro replacement actions
00012     # --
00013 
00014     implements(IPloneKSSView)
00015     
00016     def replaceInnerByMacro(self, selector, macropath):
00017         content = self.macroContent(macropath)
00018         self.getCommandSet('core').replaceInnerHTML(selector, content)
00019         return self.render()
00020 
00021     def replaceByMacro(self, selector, macropath):
00022         content = self.macroContent(macropath)
00023         self.getCommandSet('core').replaceHTML(selector, content)
00024         return self.render()
00025 
00026     def replaceMacro(self, selector, macropath):
00027         import warnings, textwrap
00028         warnings.warn(textwrap.dedent('''\
00029             The usage of the server action replaceMacro is deprecated''' 
00030         ), DeprecationWarning, 2)
00031         return self.replaceInnerByMacro(selector, macropath)