def get(self): if is_status_down(): render_gehol_down(self, "You asked an iCalendar file for a particular professor.") else: parsed = urlparse.urlparse(self.request.uri) staff_member_id = parsed.path.split("/")[4].rstrip(".ics") term = parsed.path.split("/")[3] logging.info("------") if term in ("q1", "q2", "january_exams", "june_exams", "september_exams"): try: logging.info("*** rendering staff/" + term) cal = self.calendar_fetch_funcs[term](staff_member_id) except DownloadError, e: logging.error("Could not fetch page before deadline") render_deadline_exceeded_page(self) cal = None if cal: ical_data = convert_professor_calendar_to_ical_string(cal) professor_name = cal.header_data["teacher_name"] ical_filename = "ULB - " + term.upper() + " - " + professor_name.encode("iso-8859-1") self.response.headers["Content-Type"] = "text/calendar; charset=utf-8" self.response.headers["Content-disposition"] = "attachment; filename=%s.ics" % ical_filename self.response.out.write(ical_data) else: render_professor_notfound_page(self, resource_type="iCal file") else:
def get(self): parsed = urlparse.urlparse(self.request.uri) staff_member_id = parsed.path.split("/")[2] if is_status_down(): render_gehol_down(self, "You asked the schedule for a particular student profile.") else: if is_staff_member_id_valid(staff_member_id): logging.debug("staff member '%s' id is valid" % staff_member_id) try: cal = get_professor_q1_calendar(staff_member_id) except DownloadError, e: logging.error("Could not fetch page before deadline") render_deadline_exceeded_page(self) return if cal: self._render_calendar_summary(cal, staff_member_id) else: logging.debug("did not receive a calendar") self._render_not_found_page() else:
def get(self): parsed = urlparse.urlparse(self.request.uri) course_mnemo = parsed.path.split("/")[3].rstrip(".ics") if is_course_mnemo_valid(course_mnemo): if is_status_down(): self._render_gehol_down_page(course_mnemo) else: try: cal = get_calendar(course_mnemo, conf.Q2_WEEKSPAN) except DownloadError,e: logging.error("Could not fetch page before deadline") render_deadline_exceeded_page(self) return if cal: ical_content = convert_course_calendar_to_ical(cal) self.response.headers['Content-Type'] = "text/calendar; charset=utf-8" self.response.headers['Content-disposition'] = "attachment; filename=%s.ics" % course_mnemo self.response.out.write(ical_content) else: self._render_not_found_page(course_mnemo)
def get(self): parsed = urlparse.urlparse(self.request.uri) course_mnemo = self._get_course_mnemo(parsed.path) if is_course_mnemo_valid(course_mnemo): if is_status_down(): self._render_gehol_down_page(course_mnemo) else: try: cal = get_calendar(course_mnemo, conf.Q2_WEEKSPAN) except DownloadError,e: logging.error("Could not fetch page before deadline") render_deadline_exceeded_page(self) cal = None if cal: self._render_calendar_summary(cal, course_mnemo) self._save_successful_request(course_mnemo) else: self._render_not_found_page(course_mnemo)
def get(self): parsed = urlparse.urlparse(self.request.uri) group_id = parsed.path.split("/")[3] if is_status_down(): render_gehol_down(self, "You asked for the QRCode page of a particular student profile.") else: if is_studentset_groupid_valid(group_id): logging.info("group '%s' id is valid" % group_id) try: cal = get_student_q1_calendar(group_id) except DownloadError,e: logging.info("Could not fetch remote calendar before deadline") render_deadline_exceeded_page(self) return if cal: self._render_qrcode_page(cal, group_id) else: logging.info("did not receive a calendar") self._render_not_found_page() else:
def get(self): parsed = urlparse.urlparse(self.request.uri) group_id = parsed.path.split("/")[3] group_id = "%23" + group_id if is_status_down(): render_gehol_down(self, "You asked the schedule for a particular student profile.") else: if is_studentset_groupid_valid(group_id): logging.info("group '%s' id is valid" % group_id) try: cal = get_student_q1_calendar(group_id) except DownloadError,e: logging.error("Could not fetch page before deadline") render_deadline_exceeded_page(self) cal = None if cal: self._render_calendar_summary(cal, group_id) else: logging.info("did not receive a calendar") self._render_not_found_page() else: