Пример #1
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)
        self.person = app['persons']['person'] = Person('person')

        # set up schoolyear
        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004'] = SchoolYear("2004",
                                                       date(2004, 9, 1),
                                                       date(2004, 12, 31))

        # set up the timetable schema
        days = ['A', 'B', 'C']
        schema = self.createSchema(days, ['1', '2', '3', '4'],
                                   ['1', '2', '3', '4'], ['1', '2', '3', '4'])
        schema.timezone = 'Europe/London'
        template = SchooldayTemplate()
        template.add(SchooldaySlot(time(8, 0), timedelta(hours=1)))
        template.add(SchooldaySlot(time(10, 15), timedelta(hours=1)))
        template.add(SchooldaySlot(time(11, 30), timedelta(hours=1)))
        template.add(SchooldaySlot(time(12, 30), timedelta(hours=2)))
        schema.model = SequentialDaysTimetableModel(days, {None: template})

        ITimetableSchemaContainer(app)['default'] = schema

        # set up terms
        from schooltool.term.term import Term
        terms = ITermContainer(app)
        terms['term'] = term = Term("Some term", date(2004, 9, 1),
                                    date(2004, 12, 31))
        term.add(date(2004, 11, 5))
Пример #2
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)
        self.person = app['persons']['person'] = Person('person')

        # set up schoolyear
        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004'] = SchoolYear("2004", date(2004, 9, 1), date(2004, 12, 31))

        # set up the timetable schema
        days = ['A', 'B', 'C']
        schema = self.createSchema(days,
                                   ['1', '2', '3', '4'],
                                   ['1', '2', '3', '4'],
                                   ['1', '2', '3', '4'])
        schema.timezone = 'Europe/London'
        template = SchooldayTemplate()
        template.add(SchooldaySlot(time(8, 0), timedelta(hours=1)))
        template.add(SchooldaySlot(time(10, 15), timedelta(hours=1)))
        template.add(SchooldaySlot(time(11, 30), timedelta(hours=1)))
        template.add(SchooldaySlot(time(12, 30), timedelta(hours=2)))
        schema.model = SequentialDaysTimetableModel(days, {None: template})

        ITimetableSchemaContainer(app)['default'] = schema

        # set up terms
        from schooltool.term.term import Term
        terms = ITermContainer(app)
        terms['term'] = term = Term("Some term", date(2004, 9, 1),
                                    date(2004, 12, 31))
        term.add(date(2004, 11, 5))
Пример #3
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)

        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004-2005'] = SchoolYear(
            "2004-2005", date(2004, 9, 1), date(2005, 8, 1))

        from schooltool.term.term import Term
        self.term1 = Term('Sample', date(2004, 9, 1), date(2004, 12, 20))
        self.term1.schooldays = [
            ('A', time(9, 0), timedelta(minutes=115)),
            ('B', time(11, 0), timedelta(minutes=115)),
            ('C', time(13, 0), timedelta(minutes=115)),
            ('D', time(15, 0), timedelta(minutes=115)),
        ]
        self.term2 = Term('Sample', date(2005, 1, 1), date(2005, 6, 1))
        self.term2.schooldays = []
        terms = ITermContainer(app)
        terms['2004-fall'] = self.term1
        terms['2005-spring'] = self.term2

        class TimetableModelStub:
            def periodsInDay(this, schooldays, ttschema, date):
                if date not in schooldays:
                    raise "This date is not in the current term!"
                if ttschema == self.tt:
                    return schooldays.schooldays
                else:
                    return []

        tt = TimetableSchema([])
        tt.model = TimetableModelStub()
        tt.timezone = 'Europe/London'
        self.tt = tt
        ttschemas = ITimetableSchemaContainer(app)
        ttschemas['default'] = tt
        self.app = app
Пример #4
0
    def setUp(self):
        layeredTestSetup()
        app = ISchoolToolApplication(None)

        from schooltool.schoolyear.schoolyear import SchoolYear
        from schooltool.schoolyear.interfaces import ISchoolYearContainer
        ISchoolYearContainer(app)['2004-2005'] = SchoolYear("2004-2005", date(2004, 9, 1), date(2005, 8, 1))

        from schooltool.term.term import Term
        self.term1 = Term('Sample', date(2004, 9, 1), date(2004, 12, 20))
        self.term1.schooldays = [('A', time(9,0), timedelta(minutes=115)),
                                 ('B', time(11,0), timedelta(minutes=115)),
                                 ('C', time(13,0), timedelta(minutes=115)),
                                 ('D', time(15,0), timedelta(minutes=115)),]
        self.term2 = Term('Sample', date(2005, 1, 1), date(2005, 6, 1))
        self.term2.schooldays = []
        terms = ITermContainer(app)
        terms['2004-fall'] = self.term1
        terms['2005-spring'] = self.term2

        class TimetableModelStub:
            def periodsInDay(this, schooldays, ttschema, date):
                if date not in schooldays:
                    raise "This date is not in the current term!"
                if ttschema == self.tt:
                    return schooldays.schooldays
                else:
                    return []

        tt = TimetableSchema([])
        tt.model = TimetableModelStub()
        tt.timezone = 'Europe/London'
        self.tt = tt
        ttschemas = ITimetableSchemaContainer(app)
        ttschemas['default'] = tt
        self.app = app