An idea - request for comments

Martijn Faassen m.faassen at
Wed Aug 4 07:51:36 EDT 1999

Nigel Head <nhead at> wrote:
> Ian Clarke wrote:

>> I am presently working on a CGI based system in Python, and the
>> experience gave me an idea for a simple Python program, I would
>> appreciate any comments (such as "don't bother, it's been done" or
>> "sure, I have loads of spare time, I will do it and release it under the
>> GPL").

> I'm not going to say either of those! I have done it, although I'm not
> terribly happy with the results so far and it's on the back burner for
> the moment .... I need to figure out if it's still useful in a Zope
> world - which means I have to learn and understand Zope!

In the Zope world, the idea is to separate layout/HTML from programming
logic as much as possible so that both can be developed and maintained
independently. For HTML and such Zope has DTML. DTML is a simple language
of tags that can be embedded in HTML, so you can do for instance:
(Zope2 syntax)

<p>My web page</p>
<dtml-if foo>
<p>Foo too!</p>

You can also use Python expressions inside DTML, which is sometimes
very handy. These Python expressions are secure; they have to be so,
because you can change DTML from a web management interface, and a normal
Zope user shouldn't be able to screw up the server or the Zope database.

For instance you can loop over a sequence like this:

<dtml-in "[1, 2, 3, 4, 5]">
<li><dtml-var sequence-item></li>

Zope also allows you to extend it using Python. The disadvantage is that
currently can't happen through the web management interface -- a Zope
'external method' (in Python) can do anything at all to the Zope database
and is not restricted by security, so that it's not a good idea to let
it be editable through the web.

> Also I haven't yet dealt with putting the python into rexec for execution-
> but this is only needed if a web master wants to give their clients access
> to
> these facilities as opposed to doing things themselves.

There has been some vague idea floating around in the Zope community to
come up with a Python Method that *can* be edited through Zope's web
management interface. It should have the right security machinery, of course.
The Zope philosophy is to keep Python code and HTML separate as much as
possible, but even then a *programmer* will find Python methods very
useful, and in special cases it'll be useful to mix them all anyway.

So it might be nice if you folks figured out a way to include this kind
of functionality in Zope. That would at least be ideal for _me_, as I use
Zope. The tricky bit would be delving deep into Zope to make it all work. :)



More information about the Python-list mailing list