September 12th, 2001, 03:58 PM
writing pyhton scripts in zope
i am building a website in Zope, and learning as i go along. can somebody help demonstrate how to write custom functions (using Python scripts i guess) such as:
a function called DrawSpacer() that would handle variables for height and width, so that when
is called, the result is something like
<img src="/img/spacer.gif" height="50" width="20">
(after the page is parsed or course)? i have done this with ASP, but i cannot get it to work in Zope, yet i'm sure it can easily be done. this type of functionality would allow me to break up many parts of the site into reusable modules that draw certain aspects of the page; i just need a basic example to learn from.
September 13th, 2001, 02:34 PM
First off I don't use Zope but I do write python. But since not many people post here I thought some help is better than none.
If I where to write what you described it would look like this
def DrawSpacer(height, width):
print "<img src=\"/img/spacer.gif\" height=\"%d\" width=\"%d\">" % (height, width)
Then when you execute the function:
You should get what you want. Hope this helps.
September 18th, 2001, 05:28 AM
What you want is listed below:
print "<img src='/img/spacer.gif' height='%d'0 width='%d'>" % (height, width)