[Zope-dev] Calling HTMLFiles
Morten W. Petersen
morten@esol.no
18 Jan 2001 16:34:31 +0100
Hi,
I'm having difficulties calling an HTML file from python..
Here's the code:
[...]
from events import conflicting_events
calendar_event_add_redirect = HTMLFile('calendar_event_add_redirect',
globals())
manage_add_calendar_event_form = HTMLFile('calendar_event_add', globals())
conflicting_events_dialogue = HTMLFile('calendar_event_conflicting_events_dialogue', globals())
# These two expand into seconds
expand_hour = lambda x: x * 60 * 60
expand_minute = lambda x: x * 60
def manage_add_calendar_event(self, title='', note='',
alarm=0, start=0, end=0,
priority=0, status=0,
REQUEST=None, RESPONSE=None):
"Add an instance of the calendar_event class."
new_id = str(self.get_unique_id())
if REQUEST:
alarm = expand_hour(REQUEST['alarm_hour']) + \
expand_minute(REQUEST['alarm_minute'])
start = expand_hour(REQUEST['start_hour']) + \
expand_minute(REQUEST['start_minute'])
end = expand_hour(REQUEST['end_hour']) + \
expand_minute(REQUEST['end_minute'])
title = REQUEST['title']
note = REQUEST['note']
priority = REQUEST['priority']
status = REQUEST['status']
conflicting_events_ = self.check_timespan(
self.getParentNode().getParentNode().id,
self.getParentNode().id, self.id,
start, end)
if conflicting_events_:
return conflicting_events_dialogue(self, REQUEST)
[...]
Now, if there are any conflicting events, the HTMLFile is returned, with
some parameters passed along.
What I'm wondering about is how can I pass the variables defined
in the REQUEST so that they can be looked up with dtml-code in
the conflicting_events_dialogue?
And doing it without raising KeyErrors on DTMLMethod that are
called from within the conflicting_events_dialogue?
Thanks.
-Morten