Zope and Persistence

bruno modulix onurb at xiludom.gro
Mon Oct 24 10:43:33 CEST 2005

ryankaskel at gmail.com wrote:
> I don't know if this is the appropriate place to post a Zope question

Nope. You'd better use the zope mailing-list for this.

> but I figure many here are familiar with it. I'm confused about the
> role of the ZMI when it comes to development.

As it's name implies, the ZMI is a *management* interface. Real Zope
developpement is better made with filesystem "Products" (Zope components).

> I want to write a simple
> script that logs page hits. 

That's a typical case of reinventig the square wheel. Ever looked at
<you-zope-instance-folder-here>/log/Z2.log ? It's an apache-like access
log. And there are a whole lot of tools for building stats from apache
access logs.

> I wrote it in what was called a Script
> (Python) resource in the ZMI. When I access the page it gives an error
> saying that this file cannot import Persistence, etc. 

Why would you import Persistence in a Python Script ? This is already a
persistent object.

> This makes sense
> but where would I put this script 

Whereever seems to fit - this depends on your application.

> and how would I invoke it? 

Like any other Zope object.

> It is only
> supposed to store an integer in Data.fs. Thanks.

This is another problem, and I think you'd better start with the zope book.

But for you current use case, first have a look at Zope's access log.

bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"

More information about the Python-list mailing list