[Zope] - Next problem - looking for dtml file in the wrong place...

skip@calendar.com (Skip Montanaro) skip@calendar.com (Skip Montanaro)
Tue, 8 Dec 1998 14:39:47 -0500


I'm inching along.  Thanks to Michel Pelletier and Andy Kuchling, I now know
my calendar module is a Product and what most (all?) of the necessary
scaffolding is.  My Calendar class supports a show method:

    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 HTMLFile('cal', month=month, year=year, cal=cal)

When I access

    http://localhost:8080/Calendar/show?month:int=0&year:int=1998

I get the following traceback:

    Traceback (innermost last):
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/ZPublisher/Publish.py, line 861, in publish_module
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/ZPublisher/Publish.py, line 585, in publish
	(Info: /Calendar/show)
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/ZPublisher/Response.py, line 284, in setBody
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/DocumentTemplate/DT_HTML.py, line 217, in __str__
	(Object: /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/cal.dtml)
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/DocumentTemplate/DT_HTML.py, line 209, in quotedHTML
	(Object: /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/cal.dtml)
      File /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/DocumentTemplate/DT_String.py, line 532, in read_raw
	(Object: /home/dolphin/skip/src/Zope-1.9b1-src/lib/python/cal.dtml)
    IOError: (2, 'No such file or directory')

which suggests to me that my cal.dtml file is not where Zope expects to find
it.  All files in my Products/Calendar directory are in that directory:

    % ls -F lib/python/Products/Calendar/
    __init__.py            cal.dtml               vcal.gif
    __init__.pyc           cal.py
    addCalendar_form.dtml  cal.pyc

Why is it looking up two levels in the directory hierarchy for the DTML
file?  As far as I can tell, I'm using the same calling conventions for
HTMLFile objects as the MailHost and sample Products do.

Any suggestions this time?

Skip Montanaro	   | Mojam: "Uniting the World of Music" http://www.mojam.com/
skip@calendar.com  | Musi-Cal: http://concerts.calendar.com/
518-372-5583