Beispiel #1
0
def setup_admin():
    """Setup super admin account."""
    log.info("Creating super admin account...")

    # Prompt for the username, defaults to the system user
    default_username = getpass.getuser()
    username = raw_input("Super admin username [%s]: " % default_username)
    if len(username) == 0:
        username = default_username

    # Prompt for the password
    password = getpass.getpass("Password: "******"Confirm password: "******"Passwords do not match!")
        sys.exit()

    # Add super user do the database
    user = AuthUser(username, password)
    Session.add(user)
    Session.commit()

    log.info("Created super admin account.")

    return user
Beispiel #2
0
def setup_admin():
    """Setup super admin account."""
    log.info("Creating super admin account...")

    # Prompt for the username, defaults to the system user
    default_username = getpass.getuser()
    username = raw_input("Super admin username [%s]: " % default_username)
    if len(username) == 0:
        username = default_username

    # Prompt for the password
    password = getpass.getpass("Password: "******"Confirm password: "******"Passwords do not match!")
        sys.exit()

    # Add super user do the database
    user = AuthUser(username, password)
    Session.add(user)
    Session.commit()

    log.info("Created super admin account.")

    return user
Beispiel #3
0
 def process_lesson(self, sub, room, part=None):
     sub = self.subjects[sub]
     teacher = None
     room = room == 'h' and 100 or int(room)
     l = Lesson(self.schedule, self.group, part, sub,
             teacher, self.day_number, self.order, room)
     Session.add(l)
     return l
Beispiel #4
0
 def process_lesson(self, sub, room, part=None):
     sub = self.subjects[sub]
     teacher = None
     room = room == 'h' and 100 or int(room)
     l = Lesson(self.schedule, self.group, part, sub, teacher,
                self.day_number, self.order, room)
     Session.add(l)
     return l
Beispiel #5
0
def parse_numbers(path):
    """
    Parse lucky numbers file.

    :param path: Path to parsable subjects file.

    """
    log.info("Parsing lucky numbers...")

    lucky_numbers_file = codecs.open(path, 'r', 'utf-8')
    for number in LuckyNumberParser(lucky_numbers_file):
        Session.add(number)
    Session.commit()

    log.info("Lucky numbers parsed and committed.")
Beispiel #6
0
def parse_numbers(path):
    """
    Parse lucky numbers file.

    :param path: Path to parsable subjects file.

    """
    log.info("Parsing lucky numbers...")

    lucky_numbers_file = codecs.open(path, 'r', 'utf-8')
    for number in LuckyNumberParser(lucky_numbers_file):
        Session.add(number)
    Session.commit()

    log.info("Lucky numbers parsed and committed.")
Beispiel #7
0
def parse_subjects(path):
    """
    Parse subjects file.

    :param path: Path to parsable subjects file.

    """
    log.info("Parsing subjects...")

    subjects = {}
    for subject in SubjectsParser(path):
        subjects[subject.short] = subject
        Session.add(subject)

    Session.commit()

    log.info("Subjects parsed and committed.")

    return subjects
Beispiel #8
0
def parse_subjects(path):
    """
    Parse subjects file.

    :param path: Path to parsable subjects file.

    """
    log.info("Parsing subjects...")

    subjects = {}
    for subject in SubjectsParser(path):
        subjects[subject.short] = subject
        Session.add(subject)

    Session.commit()

    log.info("Subjects parsed and committed.")

    return subjects
Beispiel #9
0
def parse_teachers(path):
    """
    Parse teachers file.

    :param path: Path to the parsable teachers file.

    """
    log.info("Parsing teachers...")

    teachers = {}
    teachers_file = codecs.open(path, 'r', 'utf-8')
    for teacher in TeachersParser(teachers_file):
        teachers[teacher.last_name] = teacher
        Session.add(teacher)

    Session.commit()

    log.info("Teachers parsed and committed.")

    return teachers
Beispiel #10
0
def parse_teachers(path):
    """
    Parse teachers file.

    :param path: Path to the parsable teachers file.

    """
    log.info("Parsing teachers...")

    teachers = {}
    teachers_file = codecs.open(path, 'r', 'utf-8')
    for teacher in TeachersParser(teachers_file):
        teachers[teacher.last_name] = teacher
        Session.add(teacher)

    Session.commit()

    log.info("Teachers parsed and committed.")

    return teachers