[Zope] mixing python and DTML is hellish!

Garry Steedman gs@styrax.com
Fri, 1 Mar 2002 06:22:53 +0000


roy,

im only addressing a smallish part of your mail, which does convey, 
to me at least, a sense that you have things a bit back to front!

i tend to agree that mixing python and DTML is hellish, from an 
aesthetic point of view if nothing else! to be fair, it was never 
intended for this purpose...

my experience is that its too easy to keep cramming logic into DTML 
where you should really be putting it into python. i always feel bad 
doing it (a couple of hundred 20-30K dtml methods = an unmaintainable 
mix of presentation & logic), but i keep doing it because its 
quicker... and easy...

the way forward is not trying to cram more logic into DTML, but less. 
python really is your friend! (though i guess its hard for people who 
came to python via zope, rather than zope via python - i should know, 
im one of them)

better still, give zope page templates (zpt) a swirl: i find its a 
lot easier to avoid the nastier excesses i find myself perpetrating 
with DTML and it just feels like a better match for the task...

the zope book has a couple of new chapters and a new appendix on zpt 
which is a good place to start...

if you have more pressing, specific problems the list is usually a 
good place to look for help...

hth,

garry


On 28 Feb 2002, at 23:39, Roy Mathew wrote:

From:           	Roy Mathew <roy@anoobe.com>
To:             	zope@zope.org
Send reply to:  	roymath@yahoo.com
Subject:        	[Zope] mixing python and DTML is hellish!
Date sent:      	Thu, 28 Feb 2002 23:39:54 -0500

> 
> Folks,
> 
> I have been trying out Zope, and am now getting beyond the trivial.  I
> do have a question about python vs DTML.
> 
> What I am finding is that mixing and matching python scripts and DTML
> (methods and documents) is rather hellish/confusing. For example:
> 
>  o descending into python and then back up to DTML is hard, when you
>    are trying to use acquisition. The python code does not understand
>    contexts and acquisition in quite the same way as DTML.
> 
>  o I am trying to use the SQL Session object from within a python
>    script, and am having all kinds of difficulty. 
> 
> I am starting to believe that it is cleaner (although not as powerful)
> to use DTML exclusively (and python only for that which is impossible
> in DTML). This' kind of saddens me as the "Zope Book" suggests that
> python is highly interchangeable with, and more powerful than DTML.
> 
> Am I totally off base? Is there some valuable reading that I have
> missed? How do experienced ZOPErs view this issue?
> 
> Roy.
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


+-------------------------------------------+
  Garry Steedman      mailto:gs@styrax.com  
  Styrax Associates  http://www.styrax.com/ 

  "The Good Man has no shape."            
+-------------------------------------------+