def get(self, term, name, step, isPost=False):
        fromStep = sint(self.request.get('from'), -1)

        syllabus = Syllabus.from_name(self.user_key, term, name)
        if syllabus is None:
            self.abort(404)

        self.handle(isPost, term, name, fromStep, sint(step), syllabus)
    def get(self, term, name):
        syllabus = Syllabus.from_name(self.user_key, term, name)
        if syllabus is None:
            self.abort(404)

        self.send_page(
            DELETE_TEMP, {
                'type': 'syllabus',
                'term': syllabus.term,
                'name': syllabus.name,
                'title': syllabus.extended_name,
                'details': 'Once deleted, the syllabus cannot be recovered.',
            })
示例#3
0
    def get(self, instructor, term, name):
        user = User.get_by_auth_id(instructor)
        syll = Syllabus.from_name(user.key, term, name)

        if syll is None or not syll.active:
            self.abort(404)
        else:
            sdict = syll.get_dict()
            sdict['standalone'] = True
            sdict['owner'] = user
            sdict['list_url'] = uri_for('public-term',
                                        instructor=instructor,
                                        term=term)
            self.send_page(TEMPLATE, sdict)
    def handle(self, isPost, fterm, fname):
        error = ""
        old = Syllabus.from_name(self.user_key, fterm, fname)
        sem = self.request.get("sem")
        year = self.request.get("year")
        name = self.request.get("name")

        if isPost:
            sid = Syllabus.build_id_ext(sem, year, name)

            if sint(year) < 2000:
                error = "Year must be 2000 or later."
            elif len(name) < 1:
                error = "Name must be at least 1 character long."
            elif Syllabus.from_id(self.user_key, sid):
                error = "Syllabus with this term and name already exists."
            else:
                syll = Syllabus.create(self.user_key, sid, old=old)
                self.redirect(uri_for('edit-syllabus',
                                      term=syll.term,
                                      name=syll.name,
                                      step=1),
                              abort=True)

        if len(sem) == 0:
            sem = Calendar.current_sem()
        if len(year) == 0:
            year = Calendar.current_year()

        self.send_page(CREATE_TEMP, {
            'error': error,
            'old': old,
            'sem': sem,
            'year': year,
            'name': name,
        })
示例#5
0
 def test_system_1(self):
     # Create the user, no need to simulate logging in
     success, user = User.create_user("test", password_raw="test")
     self.assertEqual(success, True, "Unable to create user \"test\".")
     
     # Create the syllabus
         #term = Term.build_term("F", "2015")
     syllabus = Syllabus.create(user.key, "F15/test")
     
     # Modify the syllabus as if you were manually setting TAs, textbooks, etc.
     "Blah Blah do stuff here"
     
     # Test the dictionary created by the syllabus
     di = syllabus.get_dict()
     self.assertIsNotNone(di['term']) # For basically all of the different keys of the dictionary
     
     """ List of all the dictionary keys for your convenience
示例#6
0
    def get(self, instructor, term):
        user = User.get_by_auth_id(instructor)

        if user is None:
            self.abort(404)

        syllabi = Syllabus.query_user_term_active(user.key, term).fetch()
        office_term = user.instructor.get_office_user_term(user.key, term)
        office_times = office_term.times if office_term is not None else []

        if len(office_times) == 0 and len(syllabi) == 0:
            self.abort(404)

        self.send_page(
            TEMPLATE, {
                'heading':
                "<span>Course List - " + user.instructor.name + "</span>",
                'syllabi': syllabi,
                'calendar': self.generate_calendar(office_times, syllabi),
            })
 def post(self, term, name):
     if self.request.get("result") == "Yes":
         Syllabus.remove_by_name(self.user_key, term, name)
     self.redirect(uri_for("manage-home"))
示例#8
0
 def get(self):
     self.send_page(HOME_TEMP, {
         'syllabi': Syllabus.query_user(self.user_key).fetch(),
     })