예제 #1
0
    def get_namespace(self, resource, context):
        # Show current timetables only if previously set in metadata
        if resource.has_property('timetables'):
            timetables = resource.get_value('timetables')
            timetables_ns = [
                {'index': index,
                 'startname': '%s_start' % index,
                 'endname': '%s_end' % index,
                 'start': Time.encode(start),
                 'end': Time.encode(end)}
                for index, (start, end) in enumerate(timetables) ]
        else:
            timetables_ns = []

        # Ok
        return {'timetables': timetables_ns}
예제 #2
0
    def get_namespace(self, resource, context):
        # Show current timetables only if previously set in metadata
        if resource.has_property('timetables'):
            timetables = resource.get_value('timetables')
            timetables_ns = [{
                'index': index,
                'startname': '%s_start' % index,
                'endname': '%s_end' % index,
                'start': Time.encode(start),
                'end': Time.encode(end)
            } for index, (start, end) in enumerate(timetables)]
        else:
            timetables_ns = []

        # Ok
        return {'timetables': timetables_ns}
예제 #3
0
    def get_timetables_grid_ns(self, resource, start_date):
        """Build namespace to give as grid to gridlayout factory.
        """
        timetables = resource.get_timetables()

        ns_timetables = []
        for start, end in timetables:
            for value in (start, end):
                value = Time.encode(value)
                if value not in ns_timetables:
                    ns_timetables.append(value)
        return ns_timetables
예제 #4
0
    def get_timetables_grid_ns(self, resource, start_date):
        """Build namespace to give as grid to gridlayout factory.
        """
        timetables = resource.get_timetables()

        ns_timetables = []
        for start, end in timetables:
            for value in (start, end):
                value = Time.encode(value)
                if value not in ns_timetables:
                    ns_timetables.append(value)
        return ns_timetables