def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): if form.has_key("options"): options = form["options"] else: raise CalendarError, "No option specified" if form.has_key("selection"): selection = form["selection"] else: raise CalendarError, "No selection specified" if form.has_key("description"): description = ConvertCRLFs(form["description"]) else: description = "" if form.has_key("modify"): OptionModule.Add(options, selection, description) print OptionsPage(options, "%s modified" % selection) elif form.has_key("delete"): OptionModule.Delete(options, selection) print OptionsPage(options, "%s deleted" % selection) elif form.has_key("cancel"): print OptionsPage(options) else: print LoginPage(script="ModifyOption.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetEditors(): new_event = Event() year, month, day = None, None, None if form.has_key("year"): date = form["year"] if form.has_key("month"): date += " " + form["month"] if form.has_key("day"): date += " " + form["day"] new_event.start = time.strptime(date, "%Y %m %d") else: new_event.start = time.strptime(date, "%Y %m") else: new_event.start = time.strptime(date, "%Y") new_event.end = new_event.start new_event.reservation["start"] = new_event.start new_event.reservation["end"] = new_event.end new_event.reservation["option"] = "Same as Event" new_event.pattern = "Once Only" print new_event.EditPage() else: print LoginPage(script="AddEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) year, month, day = (None, None, None) try: if form.has_key("day"): day = int(form["day"]) if form.has_key("month"): month = int(form["month"]) if form.has_key("year"): year = int(form["year"]) except ValueError: raise CalendarError, "Invalid date" if day: print DayView(year, month, day) elif month: print MonthView(year, month) elif year: print YearView(year) else: year, month, day = Today() print MonthView(year, month) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): if form.has_key("email"): e = Event(form["ID"]) emails = form["email"].split() for email in emails: if not IsEmail(email): raise CalendarError, "Invalid email address" if e.repeats: for repeat in e.repeats: for email in emails: Event(repeat).AddNotification(email) else: for email in emails: e.AddNotification(email) print e.EventView("Email added to the notification list") else: raise CalendarError, "No email address given" else: raise CalendarError, "No event specified" except CalendarError, errorText: if e: print e.EventView(errorText) else: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) year, month, day = (None, None, None) try: if form.has_key("day"): day = form["day"] if form.has_key("month"): month = form["month"] if form.has_key("year"): year = form["year"] t = ReadDate(year, month, day) year, month, day = t[0:3] except ValueError: raise CalendarError, "Invalid date" if form.has_key("dayview"): p = Page(year, month, day) p.PutEvents() p.Format() p.Format(private=True) print DayView(year, month, day) elif form.has_key("monthview"): p = Page(year, month) p.Format() p.Format(private=True) print MonthView(year, month) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): if form.has_key("ID"): primary_event = Event(form["ID"]) primary_event.status = "Approved" primary_event.AddLog("Event approved") primary_event.Store() if primary_event.repeats: for repeat in primary_event.repeats: repeat_event = Event(repeat) if repeat <> form["ID"]: repeat_event.AddLog("Event approved", save=False) repeat_event.status = "Approved" repeat_event.Store() primary_event.UpdatePages() print primary_event.EventView() else: raise CalendarError, "No event specified" else: print LoginPage(script="ApproveEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin": print AdminPage() else: print LoginPage(form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: print EditorsPage() else: print LoginPage(script="ViewEditors.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) type, status, layout = None, None, None if form.has_key("type"): type = form["type"] if not isinstance(type, list): type = [type] else: type = ["Event", "Special", "Banner", "Holiday"] if form.has_key("setup"): if form["setup"] == "setup": type = ["Setup"] if form.has_key("status"): status = form["status"] if not isinstance(status, list): status = [status] else: status = ["Approved"] if form.has_key("layout"): layout = form["layout"] organizer, location, resource, category = None, None, None, None if form.has_key("location"): if form["location"] <> "Location...": location = form["location"] if form.has_key("resource"): if form["resource"] <> "Resource...": resource = form["resource"] if form.has_key("category"): if form["category"] <> "Category...": category = form["category"] if form.has_key("organizer"): if form["organizer"] <> "Organizer...": organizer = form["organizer"] if form.has_key("startyear") and form.has_key("startmonth") and \ form.has_key("startday"): start = ReadDate(form["startyear"], form["startmonth"], form["startday"]) else: start = Today() if form.has_key("length"): try: length = int(form["length"]) except TypeError: raise CalendarError, "Invalid entry for number of days" else: length = 14 year, month, day = start[0:3] print ListPage(year, month, day, length, type, status, layout, organizer, location, resource, category) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): if IDexists(form["ID"]): e = Event(form["ID"]) if user: print e.LogPage() else: print LoginPage(script="ViewLog.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: if form.has_key("cancel"): print ContactsPage() elif form.has_key("delete"): if form.has_key("username"): c = Contact(form["username"]) c.Delete() message = "Contact deleted" else: message = "Contact not specified" print ContactsPage(message) elif form.has_key("firstname") and form.has_key("lastname"): name = "%s %s" % (form["firstname"], form["lastname"]) if name == form["username"]: c = Contact(name) else: c = Contact() c.user = name c.name = name c.firstname = form["firstname"] c.lastname = form["lastname"] oldContact = Contact(form["username"]) c.phone = oldContact.phone c.email = oldContact.email oldContact.Delete() message = "Contact details successfully updated" if form.has_key("email"): if IsEmail(form["email"]): c.email = form["email"] else: message = "Invalid email address" else: c.email = "" if form.has_key("phone"): c.phone = form["phone"] else: c.phone = "" c.Store() print ContactsPage(message) else: print ContactsPage("Name not fully specified") else: print LoginPage(script="ModifyContact.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetEditors(): if form.has_key("ID"): e = Event(form["ID"]) else: raise CalendarError, "Cannot edit non-existent event" print e.EditPage() else: print LoginPage(script="EditEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin": print AdminPage() elif user in GetEditors(): e = Editor(user) print e.EditorPage() return else: raise CalendarError, "Invalid user and/or password" except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): e = Event(form["ID"]) if form.has_key("cancel"): print e.EventView() return if user == "admin" or user in GetEditors(): name = Editor(user).name email = Editor(user).email mailto = calendarEmail bcc = e.notifyList bcc.append(email) subject = "%s Event Notification" % calendarAbbr if form.has_key("message"): message = "---------\n%s\n---------" % form["message"] else: message = "" text="""\ Title: %s Date: %s Time: %s to %s Location: %s %s %s Please visit the following URL to view further details: <%s/ViewEvent.py?ID=%s> If you wish to be removed from the notification list for this event, please contact the %s Administration."""\ % (e.title, FormatDate(e.start, day=True), FormatTime(e.start), FormatTime(e.end), e.location, StripHTML(ConvertBreaks(e.description)), message, cgiURL, e.ID, calendarAbbr) SendEmail(mailto, subject, text, bcc=bcc) message = \ "Requested information has been sent to the notification list" print e.EventView(message) else: print LoginPage(script="SendNotification.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): ID = form["ID"] if IDexists(ID): e = Event(ID) print e.MessagePage() else: raise CalendarError, "Event does not exist" else: raise CalendarError, "No calendar event specified" except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: if form.has_key("locations"): print OptionsPage("locations") elif form.has_key("resources"): print OptionsPage("resources") elif form.has_key("categories"): print OptionsPage("categories") else: raise CalendarError, "No viewing option specifed" else: print LoginPage(script="ViewOptions.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: if form.has_key("contact"): username = form["contact"] if username not in GetContacts(): raise CalendarError, "Invalid contact" c = Contact(username) print c.ContactPage() else: raise CalendarError, "No editor specified" else: print LoginPage(script="EditContact.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("username"): e = Editor(form["username"]) else: raise CalendarError, "No username specified" if user == e.user or user == "admin" or user in GetSupervisors(): if form.has_key("cancel"): print EditorsPage() elif form.has_key("delete"): if user == e.user: print e.EditorPage("Cannot delete yourself") else: e.Delete() print EditorsPage("Editor deleted") else: if form.has_key("firstname") and form.has_key("lastname"): e.firstname = form["firstname"] e.lastname = form["lastname"] e.name = "%s %s" % (e.firstname, e.lastname) message = "Editor details successfully updated" if form.has_key("email"): if IsEmail(form["email"]): e.email = form["email"] else: message = "Invalid email address" else: e.email = "" if form.has_key("phone"): e.phone = form["phone"] else: e.phone = "" if form.has_key("authority"): e.authority = form["authority"] e.Store() print e.EditorPage(message) else: print LoginPage(script="ModifyEditor.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetEditors(): if form.has_key("ID"): ID = form["ID"] if IDexists(ID): e = Event(ID) print e.RemovePage() else: raise CalendarError, "Event does not exist" else: raise CalendarError, "No calendar event specified" else: print LoginPage(script="RemoveEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): if form.has_key("location"): print OptionModule.EditPage("locations", form["location"]) elif form.has_key("resource"): print OptionModule.EditPage("resources", form["resource"]) elif form.has_key("category"): print OptionModule.EditPage("categories", form["category"]) else: raise CalendarError, "No valid option specified" else: print LoginPage("Not authorized to change calendar options", script="EditOption.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: if form.has_key("editor"): username = form["editor"] if username not in GetEditors(): raise CalendarError, "Invalid editor name" if user == username or user == "admin" \ or user in GetSupervisors(): e = Editor(username) print e.EditorPage() else: raise CalendarError, "No editor specified" else: print LoginPage(script="EditEditor.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): e = Event(form["ID"]) if form.has_key("cancel"): print e.EventView() else: if IsEmail(form["email"]): if form["name"]: byline = "by %s " % form["name"] else: byline = "" mailto = e.email subject = "[%s] %s" % (calendarAbbr, form["subject"]) text = """\ %s -------- The above message was sent %sfrom the web page of a %s calendar event. Title: %s Date: %s Time: %s to %s Location: %s Please visit the following URL to view further details: <%s/ViewEvent.py?ID=%s> """\ % (form["message"], byline, calendarAbbr, e.title, FormatDate(e.start, day=True), FormatTime(e.start), FormatTime(e.end), e.location, cgiURL, e.ID) SendEmail(mailto, subject, text, mailfrom=form["email"]) print e.EventView\ ("The message has been sent to the event organizer") else: print e.EventView("You must provide a valid email address") except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): if IDexists(form["ID"]): e = Event(form["ID"]) if user: print e.EventView() elif e.status == "Approved" and \ e.type <> "Private" and e.type <> "Setup": print e.EventView() else: print LoginPage(script="ViewEvent.py", form=form) else: raise CalendarError, "Event does not exist" else: raise CalendarError, "No event ID specified" except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): supervisor = True else: supervisor = False if user: if form.has_key("ID"): e = Event(form["ID"]) if form.has_key("cancel"): print e.EventView() return if e.status == "Approved" and not supervisor: message = "Not authorized to remove an approved event" print e.EventView(message) return if form.has_key("repeat") and form["repeat"] <> "single": if form["repeat"] == "future": repeats = filter(lambda ID: IDdate(ID) >= Today(), e.repeats) e.AddLog("Future repeated events removed") else: repeats = e.repeats e.AddLog("Repeated events removed") for ID in repeats: Event(ID).Remove() else: e.AddLog("Event removed") e.Remove() e.UpdatePages() y, m, d = e.start[0:3] print DayView(y, m, d, updated=True) else: print LoginPage(script="ConfirmRemoval.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetEditors(): if form.has_key("ID"): e = Event(form["ID"]) t = Event() t.Copy(e) t.status = "Requested" t.pattern = "Once Only" t.repeats = [] t.logs = [] t.notifyList = [] else: raise CalendarError, "Cannot copy non-existent event" print t.EditPage("Don't forget to change the date of this copy", copied=True) else: print LoginPage(script="CopyEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form, printHeader=False) e = Editor(form["username"]) if user == e.user or user == "admin" or user in GetSupervisors(): if form["newpassword"]: e.password = form["newpassword"].strip() if form["verification"]: if form["verification"].strip() == e.password: message = "Password successfully changed." e.Store() if user == e.user: print MakeCookie(user, e.password) else: message = \ "Password not changed as the two entries did not match." CGIprintHeader() print e.EditorPage(message) else: print LoginPage(script="ChangePassword.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): if form.has_key("options"): options = form["options"] else: raise CalendarError, "No option specified" if form.has_key("selection"): selection = form["selection"] if form.has_key("description"): description = ConvertCRLFs(form["description"]) else: description = None OptionModule.Add(options, selection, description) print OptionsPage(options, "%s added to the list" % selection) else: print OptionsPage(options, "No option specified") else: print LoginPage(script="AddOption.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user: if form.has_key("ID"): temporary_event = TemporaryEvent(form["ID"]) if form.has_key("cancel"): if temporary_event.start: y, m, d = temporary_event.start[0:3] else: y, m, d = Today() print DayView(y, m, d) if temporary_event.ID.find("tmp") >= 0: temporary_event.Remove() elif form.has_key("edit"): print temporary_event.EditPage() else: if hasattr(temporary_event, "oldID"): old = True oldID = temporary_event.oldID else: old = False primary_event = None if form.has_key("repeats"): IDs = [] for repeat in form["repeats"]: if IsValidID(repeat): ID = repeat else: ID = os.path.join( repeat, "%03d" % GetNextEvent(repeat)) IDs.append(ID) #Remove new set of repeats from other excluded repeats if old: old_repeats = Event(oldID).repeats if old_repeats: discards = filter(lambda ID: ID not in IDs, old_repeats) for ID in discards: old_event = Event(ID) old_event.repeats = discards old_event.AddLog( "Removed from repeat list of %s" % oldID, save=False) old_event.Store() #Now update the new set of repeats if old: primaryID = oldID logMessage = "Repeated events updated" else: primaryID = IDs[0] logMessage = "Repeated events created" for ID in IDs: new_event = Event(ID) new_event.Copy(temporary_event) new_event.start = CopyTime(ID, new_event.start) new_event.end = CopyTime(ID, new_event.end, end=True) new_event.reservation["start"] = \ CopyTime(ID, new_event.reservation["start"]) new_event.reservation["end"] = \ CopyTime(ID, new_event.reservation["end"], end=True) new_event.repeats = IDs if ID == primaryID: new_event.AddLog(logMessage) new_event.Store() primary_event = Event(primaryID) elif old: primary_event = Event(oldID) if hasattr(temporary_event, "pattern"): primary_event.ClearRepeats() if temporary_event.start[0:3] == \ primary_event.start[0:3]: primary_event.Copy(temporary_event) primary_event.repeats = [] primary_event.AddLog("Event updated") primary_event.Store() else: primary_event.Remove() primary_event.UpdatePages() primary_event = None if not primary_event: year, month, day = temporary_event.start[0:3] eventDir = DatePath(year, month, day) ID = os.path.join(eventDir, "%03d" % GetNextEvent(eventDir)) primary_event = Event(ID) primary_event.Copy(temporary_event) primary_event.created = Now() if old: primary_event.AddLog("Event date changed") else: primary_event.AddLog("Event created") primary_event.Store() temporary_event.Remove() primary_event.UpdatePages() print primary_event.EventView() CGIflush() else: raise CalendarError, "No event specified" else: print LoginPage(script="ConfirmEvent.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if form.has_key("ID"): e = Event(form["ID"]) if form.has_key("cancel"): print e.EventView() return if user in GetEditors(): name = Editor(user).name email = Editor(user).email if email: emailLink = "<%s>" % email else: emailLink = "" mailto = [] for supervisor in GetSupervisors(): mailto.append(Editor(supervisor).email) mailto.append(calendarEmail) subject = "%s Event Request" % calendarAbbr if form.has_key("message"): message = "Additional Message:\n%s" % form["message"] else: message = "" if form.has_key("prefix"): prefix = form["prefix"] else: prefix = "A change to" if e.status == "Approved": script = "EditEvent.py" else: script = "ViewEvent.py" text = """\ %s the following %s event has been requested: Title: %s Date: %s Time: %s to %s Location: %s Resource: %s Category: %s Requested by: %s %s Please visit the following URL to approve or modify the requested event: <%s/%s?ID=%s> %s """ % (prefix, calendarAbbr, e.title, FormatDate(e.start, day=True), FormatTime(e.reservation["start"]), FormatTime(e.reservation["end"]), ", ".join(e.locations), ", ".join(e.resources), ", ".join( e.categories), name, emailLink, cgiURL, script, e.ID, message) SendEmail(mailto, subject, text, cc=email) message = \ "Requested information has been sent to the %s Administration" \ % calendarAbbr print e.EventView(message) else: print LoginPage(script="SendRequest.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): supervisor = True else: supervisor = False if user is None: print LoginPage(script="ModifyEvent.py", form=form) return if form.has_key("ID"): ID = form["ID"] if not IDexists(ID): raise CalendarError, "No event to edit" if ID.find("tmp") >= 0: e = TemporaryEvent(ID) else: e = TemporaryEvent() e.Copy(Event(ID)) e.oldID = ID e.oldDate = e.start[0:3] else: e = TemporaryEvent() if form.has_key("title"): e.title = form["title"] if form.has_key("type"): e.type = form["type"] else: e.type = "Event" if form.has_key("description"): e.description = ConvertCRLFs(form["description"]) else: e.description = "" if form.has_key("location"): if form["location"] == "Location...": e.location = "" else: e.location = form["location"] try: if type == "Banner" or type == "Holiday": e.start = ReadTime(form["startyear"], form["startmonth"], form["startday"], 12, 0, "AM") e.end = e.start else: e.start = ReadTime(form["startyear"], form["startmonth"], form["startday"], form["starthour"], form["startminute"], form["startampm"].upper()) e.end = ReadTime(form["startyear"], form["startmonth"], form["startday"], form["endhour"], form["endminute"], form["endampm"].upper(), end=True) except KeyError: if not hasattr(e, "oldID"): raise CalendarError, "Invalid date/time entry" if form.has_key("cancel"): if e.start: y, m, d = e.start[0:3] else: y, m, d = Today() print DayView(y, m, d) return if form.has_key("name") and form["name"] <> "Name...": if form["name"] in GetEditors(name=True): c = GetEditor(form["name"]) else: c = Contact(form["name"]) e.organizer = c.name e.phone = c.phone e.email = c.email elif form.has_key("organizer"): e.organizer = form["organizer"] if form.has_key("phone") and form.has_key("email"): e.phone = form["phone"] e.email = form["email"] else: if e.organizer in GetEditors(name=True): c = GetEditor(e.organizer) elif e.organizer in GetContacts(): c = Contact(e.organizer) else: c = None if form.has_key("phone"): e.phone = form["phone"] elif c: e.phone = c.phone if form.has_key("email"): e.email = form["email"] elif c: e.email = c.email else: e.organizer = "" try: e.reservation["option"] = form["reserve"] if e.reservation["option"] == "Same as Event": e.reservation["start"] = e.start e.reservation["end"] = e.end elif e.reservation["option"] == "All Day": e.reservation["start"] = ReadTime(form["startyear"], form["startmonth"], form["startday"], "12", "00", "AM") e.reservation["end"] = ReadTime(form["startyear"], form["startmonth"], form["startday"], "12", "00", "AM", end=True) else: e.reservation["start"] = ReadTime(form["startyear"], form["startmonth"], form["startday"], form["resstarthour"], form["resstartminute"], form["resstartampm"].upper()) e.reservation["end"] = ReadTime(form["startyear"], form["startmonth"], form["startday"], form["resendhour"], form["resendminute"], form["resendampm"].upper(), end=True) if e.reservation["start"] > e.start: e.reservation["start"] = e.start if e.reservation["end"] < e.end: e.reservation["end"] = e.end except KeyError: if not hasattr(e, "oldID"): raise CalendarError, "Invalid reservation time" if form.has_key("locations"): if isinstance(form["locations"], list): e.locations = form["locations"] else: e.locations = [form["locations"]] if "Locations..." in e.locations: e.locations.remove("Locations...") else: e.locations = [] if e.location: try: e.locations.remove(e.location) except ValueError: pass e.locations.insert(0, e.location) if form.has_key("resources"): if isinstance(form["resources"], list): e.resources = form["resources"] else: e.resources = [form["resources"]] if "Resources..." in e.resources: e.resources.remove("Resources...") else: e.resources = [] if form.has_key("categories"): if isinstance(form["categories"], list): e.categories = form["categories"] else: e.categories = [form["categories"]] if "Categories..." in e.categories: e.categories.remove("Categories...") else: e.categories = [] if form.has_key("setup"): e.setup = ConvertCRLFs(form["setup"]) else: e.setup = "" if form.has_key("status"): e.status = form["status"] if form.has_key("editor"): e.editor = form["editor"] if form.has_key("pattern"): e.pattern = form["pattern"] if form["pattern"] <> "Once Only": e.number, e.final = None, None if form.has_key("number"): e.number = int(form["number"]) if form.has_key("endyear"): e.final = ReadDate(form["endyear"], form["endmonth"], form["endday"]) e.repeats = MakeRepeats(e.pattern, e.start, e.final, e.number) else: e.repeats = [] elif form.has_key("repeat"): if form["repeat"] == "single": e.repeats = [] e.pattern = "Once Only" elif form.has_key("repeats"): if isinstance(form["repeats"], list): e.repeats = form["repeats"] else: e.repeats = [form["repeats"]] if form["repeat"] == "future": e.repeats = filter(lambda ID:IDdate(ID)>=Today(), e.repeats) else: e.repeats = [] message = None if e.type <> "Banner" and e.type <> "Holiday" and e.end < e.start: message = "Warning: End of event precedes the start." elif e.type <> "Banner" and e.type <> "Holiday" and e.end == e.start: message = "Warning: Event has no duration." elif e.start < Now(): message = "Warning: This event is in the past." elif not e.title: message = "Warning: No title given for event." if hasattr(e, "oldDate"): if e.oldDate <> e.start[0:3] and e.repeats: message = \ "Warning: Changing the date will break the link with event repeats." e.repeats = [] e.pattern = "Once Only" e.Store() print e.EventView(message=message, updating=True) except CalendarError, errorText: print ErrorPage(errorText)