[Zope] - How do I publish this object?
skip@calendar.com (Skip Montanaro)
skip@calendar.com (Skip Montanaro)
Tue, 8 Dec 1998 07:47:45 -0500
I believe this was asked yesterday, but I don't recall seeing an answer
posted yet, so I'll ask again, in case it wasn't noticed by those with
enough Zope Zen.
While I was in the shower last night (what is it about the shower with this
group?) it dawned on me that what I don't get about Zope is how to publish
an object in much the same way I would have done using Bobo.
As an example, appended is a small module, cal.py, which uses the Unix cal
command to generate an ASCII calendar. How would I make that available
through Zope? Seeing how that is done would be a big step forward for me.
Thx,
Skip Montanaro | Mojam: "Uniting the World of Music" http://www.mojam.com/
skip@calendar.com | Musi-Cal: http://concerts.calendar.com/
518-372-5583
"""
dumb Calendar module
"""
import os
class Calendar:
"""calendar class"""
def show(self, year, month=0):
"""return plain ASCII calendar
month == 0 ==> display calendar for entire year
"""
if year < 1 or year > 9999:
raise ValueError, ("year out of range: %d" % year)
if month < 0 or month > 12:
raise ValueError, ("month out of range: %d" % month)
if month:
cal = os.popen("cal %s %s" % (month, year)).read()
else:
cal = os.popen("cal %s" % year).read()
return cal