[ZCM] [ZC] 2311/ 2 Wontfix "Make it possible to call modules in DTML files"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sat, 14 Apr 2007 02:24:08 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2311 Update (Wontfix) "Make it possible to call modules in DTML files"
Status Wontfix, Zope/feature low
To followup, visit:
http://www.zope.org/Collectors/Zope/2311
==============================================================
= Wontfix - Entry #2 by ajung on Apr 14, 2007 2:24 am
Status: Pending => Wontfix
We will not extend the functionality of DTML. DTML is dead and should only be used for ZSQL methods. Use ZPT in all other cases.
________________________________________
= Request - Entry #1 by madarche on Apr 13, 2007 8:25 am
Uploaded: "OneMoreUtilProduct.tar.gz"
- http://www.zope.org/Collectors/Zope/2311/OneMoreUtilProduct.tar.gz/view
In ZPT files one can call methods from modules.
For example :
<tal:block define="res python:modules['Products.OneMoreUtilProduct.integration'].isProductPresent('Products.CMFCore')">
<tal:block replace="res"/>
</tal:block>
In DTML files one cannot call methods from modules.
For example one cannot do :
p {
<dtml-if "modules['Products.OneMoreUtilProduct.integration'].isUserAgentGecko(REQUEST)">
-moz-border-radius: 4px;
</dtml-if>
}
Time 2007/04/13 14:13:52.544 GMT+2
User Name (User Id) admin (admin)
Request URL http://localhost:8084/portal/default.css
Exception Type NameError
Exception Value name 'modules' is not defined
Traceback (innermost last):
* Module ZPublisher.Publish, line 115, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 41, in call_object
* Module Products.CMFCore.FSDTMLMethod, line 132, in __call__
__traceback_info__: OneMoreUtilProduct/skins/util/default.css.dtml
* Module DocumentTemplate.DT_String, line 476, in __call__
* Module DocumentTemplate.DT_Util, line 196, in eval
__traceback_info__: modules
* Module <string>, line 1, in <expression>
NameError: name 'modules' is not defined
If it's possible in ZPT files, it should be possible in DTML files too. Because one cannot use ZPT files for all usages. For example one should use DTML files for writing CSS declarations.
I'm attaching the archive OneMoreUtilProduct.tar.gz containing a Zope Product to test module calling both in ZPT and DTML.
Thank you if you can fix this.
==============================================================