[Zope] Advice Needed.

Tim Terlegård timte878 at student.liu.se
Wed Nov 26 03:40:59 EST 2003


> I'd basically like to be able to have Zope accept a URL
> something like this; http:\\MyZopeServer\IncomeStatement?rgn=80 
> and have it generate an Income Statement routine for region 80.

Make a Zope Page Template (zpt). It's possible with Python Scripts
too, but when you deal with lots of HTML zpt is much better.

Make a zpt with id IncomeStatement:
<html>
...
Region: <span tal:replace="request/rgn" />
...
</html>

This results in an HTML page that says "Region: 80" if you append
?rgn=80 to the URL.


> That sounds pretty simple doesn't it?  I can't seem to put the pieces
> together.  I was able to write a python module that takes the 
> organizationtype and number and writes an Income Statement to a 
> file in HTML.

In Python Scripts you build HTML using pure Python. Your page gets
the HTML that the script returns:

html_code = "<html><body>" + context.REQUEST.get('rgn', None) +
            "</body></html>"
return html_code

But zpt is much better for this.


> So, what's the best approach to take?  Should I try to do it with Page
> Templates and python scripts? Is that efficient? Is the product 
> approachbetter?

You can have templates and python scripts in products too. I you make
a site that will last for a while you certainly want a product on the
filesystem, but you can do that later when you get things going.

Tim
 



More information about the Zope mailing list