I started out using DTML. I have since switched to page templates. Now the only place I use DTML is in ZSQL methods. The Zope Book states the advantages of ZPT clearly http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx So far I've never run in to anything I did in DTML that I could not do in ZPT. If I were you I'd learn just enough DTML to use ZSQL methods and concentrate on ZPT. For me the biggest advantage of ZPT is keeping the programming logic out of the html. Andy Yates ________________________________ From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Ian Nunn Sent: Tuesday, December 07, 2004 8:24 AM To: Zope Subject: [Zope] DTML vs ZTP I'm a third of the way through the Zope Book and understand the difference as it is written. As you can appreciate, in learning a new technology, what is missing is the experience that would guide your focus. What I would like is an idea of how real world developers use these in the following senses. Do you use one exclusively (in conjunction with Python)? Do you use primarily one or the other? Do you use both roughly equally? Are there classes of applications where you have found one is preferred? Your advice would be welcome. Best Regards Ian Nunn School of Computer Science Carleton University, Ottawa, ON, CA
I have realized my website on a dev computer and it work well but now when i try to put my website on the Production computer i have the error : context is not defined. the both have the same Zope version. Can anybody help me ? I can't find the difference between both server configuration. Thx Baptiste
--On Dienstag, 7. Dezember 2004 16:36 Uhr +0100 baptiste Ancey <baptiste.ancey@derivexperts.com> wrote:
I have realized my website on a dev computer and it work well but now when i try to put my website on the Production computer i have the error : context is not defined. the both have the same Zope version.
Please provide a full description what you have done + a full traceback. -aj
====================================== Description ====================================== on the server A : Mandrake 10.1 Zope-2.7.0-rc2-2mdk Python 2.3.4 on the server B: Mandrake 9.2 Zope-2.7.0b1-2mdk Python 2.3 It work fine on the server A but when I export from A to import in B: I've got the following error. ====================================== FULL TRACEBACK ====================================== Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Shared.DC.Scripts.Bindings, line 252, in __call__ Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec Module Products.PageTemplates.ZopePageTemplate, line 220, in _exec Module Products.PageTemplates.PageTemplate, line 95, in pt_render - <ZopePageTemplate at /New/dmz/market/marketer/index_html> Module TAL.TALInterpreter, line 200, in __call__ Module TAL.TALInterpreter, line 244, in interpret Module TAL.TALInterpreter, line 672, in do_useMacro Module TAL.TALInterpreter, line 244, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module Products.PageTemplates.TALES, line 220, in evaluate - URL: /New/dmz/template_private - Line 19, Column 5 - Expression: <PythonExpr context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false'> - Names: {'container': <Folder instance at 419a9dd0>, 'default': <Products.PageTemplates.TALES.Default instance at 0x40c49bec>, 'here': <Folder instance at 419a9dd0>, 'loop': <SafeMapping instance at 40fde6f0>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x40c49ccc>, 'nothing': None, 'options': {'args': ()}, 'repeat': <SafeMapping instance at 40fde6f0>, 'request': <HTTPRequest, URL=http://www.derivexperts.com/New/dmz/market/marketer/index_html>, 'root': <Application instance at 40f91e00>, 'template': <ZopePageTemplate at /New/dmz/market/marketer/index_html>, 'traverse_subpath': [], 'user': francis} Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__ - __traceback_info__: context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false' Module Python expression "context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false'", line 1, in <expression> NameError: name 'context' is not defined Thx for your help. On Tuesday 07 Dec 2004 17:11, Andreas Jung wrote:
--On Dienstag, 7. Dezember 2004 16:36 Uhr +0100 baptiste Ancey
<baptiste.ancey@derivexperts.com> wrote:
I have realized my website on a dev computer and it work well but now when i try to put my website on the Production computer i have the error
: context is not defined.
the both have the same Zope version.
Please provide a full description what you have done + a full traceback.
-aj
-- Derivexperts Paris Cyber Village 101-103 Boulevard Mac Donald 75019 Paris 01 44 89 47 49
First step: upgrade to the *latest* 2.7.X release. 2.7.0-pre-something are rather old and buggy. Then try again and report back. -aj --On Dienstag, 7. Dezember 2004 17:37 Uhr +0100 baptiste Ancey <baptiste.ancey@derivexperts.com> wrote:
====================================== Description ====================================== on the server A : Mandrake 10.1 Zope-2.7.0-rc2-2mdk Python 2.3.4
on the server B: Mandrake 9.2 Zope-2.7.0b1-2mdk Python 2.3
It work fine on the server A but when I export from A to import in B: I've got the following error.
====================================== FULL TRACEBACK ====================================== Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Shared.DC.Scripts.Bindings, line 252, in __call__ Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec Module Products.PageTemplates.ZopePageTemplate, line 220, in _exec Module Products.PageTemplates.PageTemplate, line 95, in pt_render - <ZopePageTemplate at /New/dmz/market/marketer/index_html> Module TAL.TALInterpreter, line 200, in __call__ Module TAL.TALInterpreter, line 244, in interpret Module TAL.TALInterpreter, line 672, in do_useMacro Module TAL.TALInterpreter, line 244, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module Products.PageTemplates.TALES, line 220, in evaluate - URL: /New/dmz/template_private - Line 19, Column 5 - Expression: <PythonExpr context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false'> - Names: {'container': <Folder instance at 419a9dd0>, 'default': <Products.PageTemplates.TALES.Default instance at 0x40c49bec>, 'here': <Folder instance at 419a9dd0>, 'loop': <SafeMapping instance at 40fde6f0>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x40c49ccc>, 'nothing': None, 'options': {'args': ()}, 'repeat': <SafeMapping instance at 40fde6f0>, 'request': <HTTPRequest, URL=http://www.derivexperts.com/New/dmz/market/marketer/index_html>, 'root': <Application instance at 40f91e00>, 'template': <ZopePageTemplate at /New/dmz/market/marketer/index_html>, 'traverse_subpath': [], 'user': francis} Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__ - __traceback_info__: context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false' Module Python expression "context.check_folder(user.getUserName(), container.REQUEST.URL1) == 'false'", line 1, in <expression> NameError: name 'context' is not defined
Thx for your help.
On Tuesday 07 Dec 2004 17:11, Andreas Jung wrote:
--On Dienstag, 7. Dezember 2004 16:36 Uhr +0100 baptiste Ancey
<baptiste.ancey@derivexperts.com> wrote:
I have realized my website on a dev computer and it work well but now when i try to put my website on the Production computer i have the error
: context is not defined.
the both have the same Zope version.
Please provide a full description what you have done + a full traceback.
-aj
-- Derivexperts Paris Cyber Village 101-103 Boulevard Mac Donald 75019 Paris 01 44 89 47 49
Hi baptiste,
[...] error message NameError: name 'context' is not defined I got it once when coding a product to be compatible with 2.7.2 and 2.6.4. It worked on the newest version, but not on the old one. Then I realized that some where in zope 2.7.x the context attribute where added to make it compatible with zope 3.x. On the older versions you may use "here", which is also compatible with 2.7.x, but I guess it will dissapear somewhere.
Regards, Josef
On Tue, Dec 07, 2004 at 05:37:53PM +0100, baptiste Ancey wrote:
====================================== Description ====================================== on the server A : Mandrake 10.1 Zope-2.7.0-rc2-2mdk Python 2.3.4
on the server B: Mandrake 9.2 Zope-2.7.0b1-2mdk Python 2.3
It work fine on the server A but when I export from A to import in B: I've got the following error.
(snip) You do NOT have the same version of zope on both systems. That is the source of your problem. (Heck, you don't even have a stable release. Stop running old betas and release candidates! There is no reason to run these once the final releases are out.) Your page templates are relying on a feature that was added in Zope 2.7.0 beta 3, and this is documented in doc/CHANGES.txt: Zope 2.7.0b3 ... - Added the name "context" as a synonym for "here" in page templates, since "context" is better understood. This unifies the convention in templates, scripts, and Zope 3. -- Paul Winkler http://www.slinkp.com
baptiste Ancey wrote at 2004-12-7 17:37 +0100:
====================================== Description ====================================== on the server A : Mandrake 10.1 Zope-2.7.0-rc2-2mdk Python 2.3.4
on the server B: Mandrake 9.2 Zope-2.7.0b1-2mdk Python 2.3
It work fine on the server A but when I export from A to import in B: I've got the following error.
There was a major effort to tighten security between Zope 2.7.0bx and Zope 2.7.0rc1". And, as often with increased security, many applications stopped to work. Some of the bugs introduced in this step have later been eliminated again. Upgrading to newer Zope versions may help you. However, it may be necessary to adapt your scripts a bit. -- Dieter
Andy Yates wrote:
I started out using DTML. I have since switched to page templates.
Same storie, as most of Zopistas around the globe i believe...
So far I’ve never run in to anything I did in DTML that I could not do in ZPT.
Well, this might sound unbelievable... I was making an hierarchical announcement board system and needed to produce RSS for the active announcements in each board. I got my data from a ZSQL Method, but the data were non-ASCII [Greek, ISO-8859-7], and because i like being strict when it comes to standards, i wanted to produce UTF8 from this ISO-8859-7 text. The whole system was built using ZPT, so i really strived to do it with ZPT... after 2.5 hours of pure despiration, i concluded it was too complex and too buggy, so i did it in DTML.... got it working almost perfectly after 1h, even though i hadn't used DTML for some time! I really couldn't believe it, because ZPT is XML and is supposed to easily produce HTML and XML structures... In the general case though, i believe that DTML is to complex to read, and not designer-friendly. I have programmers builting login, even with bash scripting, and the templating is changed by the graphic designers.... a great advantages. Looking at older DTML code i've done, it looks dirty and complex, while ZPT is clear and elegant... Sorry for the e-mail size ;) Vangelis
Dne úterý, 7. prosince 2004 15:59 Andy Yates napsal(a):
So far I've never run in to anything I did in DTML that I could not do in ZPT. If I were you I'd learn just enough DTML to use ZSQL methods and concentrate on ZPT. For me the biggest advantage of ZPT is keeping the programming logic out of the html.
hmmm... As an example of keeping separation design from page logic could be Plone? Do you try to redesign plone to your own absolutelly different non-plonish design? Ha! It is very hard work, better to write whole templates from the scratch. So separation of logic from content is only theoretical premise for academic discussions (like memory effect at NiCd/NiMh accu) isolated from real complex pages. Finally, DTML is about 4-times faster than ZPT, code is much more clean to review and you quickly see what code are doing. -- Jaroslav Lukesh ----------------------------------------------------------- This e-mail can not contain any viruses because I use Linux
Jens Vagelpohl wrote:
Finally, DTML is about 4-times faster than ZPT, code is much more clean to review and you quickly see what code are doing.
Says who..?
I'm one who claims just that. /Johan -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
On Dec 13, 2004, at 10:45, Johan Carlsson wrote:
Jens Vagelpohl wrote:
Finally, DTML is about 4-times faster than ZPT, code is much more clean to review and you quickly see what code are doing. Says who..?
I'm one who claims just that.
I'd love to see the empirical research to back up that statement. I get the impression that "anecdotal evidence" is being confused with reproducible tested evidence. jens
Hi, On Mon, 2004-12-13 at 10:21 +0100, Jaroslav Lukesh wrote:
Dne úterý, 7. prosince 2004 15:59 Andy Yates napsal(a):
So far I've never run in to anything I did in DTML that I could not do in ZPT. If I were you I'd learn just enough DTML to use ZSQL methods and concentrate on ZPT. For me the biggest advantage of ZPT is keeping the programming logic out of the html.
hmmm... As an example of keeping separation design from page logic could be Plone? Do you try to redesign plone to your own absolutelly different non-plonish design? Ha! It is very hard work, better to write whole templates from the scratch.
Well, this is because Plone is a very bad example of ZPT use. Still you can abuse ZPT - while you can somewhat cleanly use DTML - either case you need a sophisticated API to your application and dont write code in the presentation layer. If you are so far, you see its a bit more convient to use ZPT then to worry about where the h*** some variable got aquired. <dtml-in linklist> <a href="<dtml-var url>"> ... </a> </dtml-in> (whats url? attribute? object? loop variable? request variable? Cookie?) <a tal:repeat="link here/linklist" tal:attributes="href link/url"> ... </a> Well, for me, the latter looks more understandable. Regards Tino
Tino Wildenhain wrote:
Well, this is because Plone is a very bad example of ZPT use. Still you can abuse ZPT - while you can somewhat cleanly use DTML - either case you need a sophisticated API to your application and dont write code in the presentation layer. If you are so far, you see its a bit more convient to use ZPT then to worry about where the h*** some variable got aquired.
<dtml-in linklist> <a href="<dtml-var url>"> ... </a> </dtml-in>
(whats url? attribute? object? loop variable? request variable? Cookie?)
<a tal:repeat="link here/linklist" tal:attributes="href link/url"> ... </a>
Well, for me, the latter looks more understandable.
I agree that the implicit acquisition of variables is an ugly thing, but in practis I never had any problems with it. I don't agree on the later TAL exempel looking more understandable than the DTML. To me the DTML looks more like programming code which is something that I find easier to understand and read. But I also understand that this is a matter of coding style and taste. There is simply not a question of what's right or wrong. (So IMHO there's no point in turning this in to a religious issue ;-) The problem for me is that Zope developement lately has only been focused on TAL. That's why I fell that I need to raise my voise in favor for DTML, which after alote of of fighting with TAL and METAL is my choise. In my role as an consultant I have found that I do profit more from using DTML than TAL. That's also partly because I use Easy Publisher, which was designed with DTML as primary markup language. -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
On Mon, 2004-12-13 at 11:15 +0100, Johan Carlsson wrote:
Tino Wildenhain wrote:
Well, this is because Plone is a very bad example of ZPT use. Still you can abuse ZPT - while you can somewhat cleanly use DTML - either case you need a sophisticated API to your application and dont write code in the presentation layer. If you are so far, you see its a bit more convient to use ZPT then to worry about where the h*** some variable got aquired.
<dtml-in linklist> <a href="<dtml-var url>"> ... </a> </dtml-in>
(whats url? attribute? object? loop variable? request variable? Cookie?)
<a tal:repeat="link here/linklist" tal:attributes="href link/url"> ... </a>
Well, for me, the latter looks more understandable.
I agree that the implicit acquisition of variables is an ugly thing, but in practis I never had any problems with it.
I know DTML. And therefore you must lie or dont do much with Zope :-)
I don't agree on the later TAL exempel looking more understandable than the DTML. To me the DTML looks more like programming code which is something that I find easier to understand and read.
But I also understand that this is a matter of coding style and taste. There is simply not a question of what's right or wrong. (So IMHO there's no point in turning this in to a religious issue ;-)
The problem for me is that Zope developement lately has only been focused on TAL. That's why I fell that I need to raise my voise in favor for DTML, which after alote of of fighting with TAL and METAL is my choise.
In my role as an consultant I have found that I do profit more from using DTML than TAL. That's also partly because I use Easy Publisher, which was designed with DTML as primary markup language.
Well, this explains a lot. I once saw the code of EP and... I guess everybody has own ideas on how code must work and look like :-) Regards Tino
Dne pondělí, 13. prosince 2004 10:52 Tino Wildenhain napsal(a):
hmmm... As an example of keeping separation design from page logic could be Plone? Do you try to redesign plone to your own absolutelly different non-plonish design? Ha! It is very hard work, better to write whole templates from the scratch.
Well, this is because Plone is a very bad example of ZPT use. Still you can abuse ZPT - while you can somewhat cleanly use DTML - either case you need a sophisticated API to your application and dont write code in the presentation layer. If you are so far, you see its a bit more convient to use ZPT then to worry about where the h*** some variable got aquired.
<dtml-in linklist> <a href="<dtml-var url>"> ... </a> </dtml-in>
It could be overriden by better use of names, so for example when I use SQL method: <dtml-in linklist_ZSQL ><a href="<dtml-var linklist_url>">...</a
</dtml-in>
S you know exactly what you have.
(whats url? attribute? object? loop variable? request variable? Cookie?)
<a tal:repeat="link here/linklist" tal:attributes="href link/url"> ... </a>
Well, for me, the latter looks more understandable.
Yes, it is very good example, but it need to have good knowledge of ZPT, while dtml looks more like normal programming language. So dtml is more understable for eg. code auditors, your chief etc. For imagine - I have huge book about DSP programming, and here are none concrete piece of code for any DSP chip, all sample codes are presented as simple Basic programs, so you does not need to have knowledge of DSP assembler first. -- Jaroslav Lukesh ----------------------------------------------------------- This e-mail can not contain any viruses because I use Linux
Jaroslav Lukesh wrote:
.... code is much more clean to review and you quickly see what code are doing.
Haha!! :-P You are just used to DTML reviewing.... ZPT is *much* more clean to review..... speaking from my own experience on both zope templating tools...
participants (11)
-
Andreas Jung -
Andy Yates -
baptiste Ancey -
Dieter Maurer -
Jaroslav Lukesh -
Jens Vagelpohl -
Johan Carlsson -
Josef Meile -
Paul Winkler -
Tino Wildenhain -
Vangelis Mihalopoulos