# HG changeset patch # User Thierry Florac # Date 1321789631 -3600 # Node ID 689eef034b00629272659758196900ac0c87df01 # Parent 2f9d956952cda0e491ced7db7fd0529efa7af636 Added 'fanstatic:' TALES expression diff -r 2f9d956952cd -r 689eef034b00 ztfy/utils/tal/configure.zcml --- a/ztfy/utils/tal/configure.zcml Tue Nov 01 18:29:31 2011 +0100 +++ b/ztfy/utils/tal/configure.zcml Sun Nov 20 12:47:11 2011 +0100 @@ -1,5 +1,6 @@ + + \ No newline at end of file diff -r 2f9d956952cd -r 689eef034b00 ztfy/utils/tal/fanstatic.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ztfy/utils/tal/fanstatic.py Sun Nov 20 12:47:11 2011 +0100 @@ -0,0 +1,38 @@ +### -*- coding: utf-8 -*- #################################################### +############################################################################## +# +# Copyright (c) 2008-2011 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## + +__docformat__ = "restructuredtext" + +# import standard packages + +# import Zope3 interfaces + +# import local interfaces + +# import Zope3 packages +from zope.tales.expressions import StringExpr + +# import local packages +from ztfy.utils.traversing import resolve + + +class FanstaticTalesExpression(StringExpr): + + def __call__(self, econtext): + lib, res = self._expr.split('#') + module = resolve(lib) + resource = getattr(module, res) + resource.need() + return ''