Ejemplo n.º 1
0
    def get_students_filter(self, **kwargs):
        l = list(self.student_info_controller.keys())
        for key in self.student_info_controller.keys():
            this = self.get_student(key)
            if not this:
                continue
            if this.compare_kwargs(**kwargs):
                yield this

def check_is_in_preferred_list(this):
    return this.compare_kwargs(num=35263)

if __name__ == "__main__":

    students = Students()
    print('Full Name,User Name,Email\n')
    for student_key in students.get_student_keys():
        student = students.get_student(student_key)
        sf = NS()
        sf.take_dict(student)
        if student.grade == 5:
            print(sf('{first} {last},{username},{email}'))
    #students.courses_output()
    #print("Here are the ones with ???:")
    #students.output_filter(check_is_in_preferred_list)
    #students.teachers_output()
    #students.courses_output()
    #students.students_output()


        if not student:
            continue
        homerooms[student.homeroom][ (student.lastfirst, student)].append(activity_name)
        activities[activity_name].append(student)
        postfix[activity_name].append(student.email)

    homerooms_sorted = list(homerooms.keys())
    homerooms_sorted.sort(key=put_in_order)
    for homeroom in homerooms_sorted:
        print('\n' + homeroom)
        students_sorted = list(homerooms[homeroom].keys())
        students_sorted.sort(key=lambda x: x[0])
        for item in students_sorted:
            lastfirst, student = item
            s = NS()
            s.take_dict(student)
            s.activities = ", ".join( homerooms[homeroom][(lastfirst, student)] )
            print(s('{lastfirst}{COLON}{SPACE}{activities}'))

    activities_sorted = list(activities.keys())
    activities_sorted.sort()
    for activity in activities_sorted:
        print('\n' + activity)
        for student in activities[activity]:
            s = NS()
            s.take_dict(student)
            print(s('{lastfirst}{TAB}{homeroom}'))

    # DO THE ACTIVITY EMAILS
    sf.path = config_get_section_attribute('DIRECTORIES', 'path_to_postfix')
    sf.base = 'activities'