anthill.tal.macrorenderer-0.2.1


توضیحات

Rendering ZPT macros from python code made easy
ویژگی مقدار
سیستم عامل -
نام فایل anthill.tal.macrorenderer-0.2.1
نام anthill.tal.macrorenderer
نسخه کتابخانه 0.2.1
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Simon Pamies
ایمیل نویسنده s.pamies@banality.de
آدرس صفحه اصلی UNKNOWN
آدرس اینترنتی https://pypi.org/project/anthill.tal.macrorenderer/
مجوز GPL
Introduction ============ This package renders macros from a given page template using pure python. Sometime you may want to use page templates like code libraries where for each functionality you have one macro. Calling macros is no problem using ZPT use-macro but how do you call macros from pure python code and also pass parameters? Because there do not seems to be an obvious solution for this problem (especially the parameters part) this package was created. Render macro with name ``macroname`` from a given page template:: >>> from anthill.tal.macrorenderer import MacroRenderer >>> template = ViewPageTemplateFile('template.pt') >>> renderer = MacroRenderer(template, 'macroname') >>> print renderer(data={'option1' : 42}) Sometimes you get an exception about not enough context being provided to the renderer (or for prior versions a TypeError). A fix is easy: Simply add a ``context=self.context`` to the MacroRenderer call:: >>> renderer = MacroRenderer(template, 'macroname', context=self.context) Changelog ========= 0.2.1 (2009-08-24) ------------------ * Added fix for http://mail.zope.org/pipermail/zope3-dev/2007-April/022266.html because this can happen when calling macros with not enough context [spamsch] 0.2 (2009-08-24) ---------------- * Fix for missing context (TypeError exceptions) [spamsch] 0.1 (2009-08-08) ---------------- * Initial release


نحوه نصب


نصب پکیج whl anthill.tal.macrorenderer-0.2.1:

    pip install anthill.tal.macrorenderer-0.2.1.whl


نصب پکیج tar.gz anthill.tal.macrorenderer-0.2.1:

    pip install anthill.tal.macrorenderer-0.2.1.tar.gz