Exemplo n.º 1
0
    def get(self, id=0, year=0, degree=0, department=0, n=1):
        school_id = self.get_argument('school_id', None)
        school_year = self.get_argument('school_year', 0)
        school_degree = self.get_argument('school_degree', 0)
        school_department = self.get_argument('school_department', 0)
        is_my = int(bool(self.get_argument('is_my', None) == 'on'))
        id = int(id)
        year = int(year)
        degree = int(degree)
        department = int(department)

        if school_id:
            if is_my:
                user_school_new(self.current_user, school_id, school_year,
                                school_degree, school_department)
            return self.redirect(
                SCHOOL_LINK %
                (school_id, school_year, school_degree, school_department))
        school_tuple = user_school_tuple(self.current_user_id)

        if not id and school_tuple:
            id, school_id, school_year, school_degree, school_department, txt = school_tuple[
                0]
            return self.redirect(
                SCHOOL_LINK %
                (school_id, school_year, school_degree, school_department))

        year = int(year)
        degree = int(degree)
        department = int(department)

        result = user_school_search(id, year, degree, department)
        result_len = len(result)

        if len(result) < 64 and id and any((year, degree, department)):
            school_count = user_school_count(id)
            if school_count <= result_len:
                school_count = 0
        else:
            school_count = 0

        self.render(school_data=(0, id, year, degree, department, ''),
                    _id=id,
                    school_tuple=school_tuple,
                    result=result,
                    year=year,
                    degree=degree,
                    department=department,
                    school_count=school_count)
Exemplo n.º 2
0
def save_school(self):
    current_user_id = self.current_user_id
    current_user = self.current_user
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)

    for i in zip(
            arguments['school_id'],
            arguments['school_year'],
            arguments['school_degree'],
            arguments['school_department'],
            arguments['txt'],
            arguments['id'],
    ):

        user_school_new(current_user, *i)
Exemplo n.º 3
0
def save_school(self):
    current_user_id = self.current_user_id
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)


    for i in zip(
        arguments['school_id'],
        arguments['school_year'],
        arguments['school_degree'],
        arguments['school_department'],
        arguments['txt'],
        arguments['id'],
    ):

        user_school_new(current_user_id, *i)
Exemplo n.º 4
0
def save_school(self):
    current_user_id = self.current_user_id
    current_user = self.current_user
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)

    for i in zip(
        arguments["school_id"],
        arguments["school_year"],
        arguments["school_degree"],
        arguments["school_department"],
        arguments["txt"],
        arguments["id"],
    ):

        user_school_new(current_user, *i)
Exemplo n.º 5
0
    def get(self, id=0, year=0, degree=0, department=0, n=1):
        school_id = self.get_argument("school_id", None)
        school_year = self.get_argument("school_year", 0)
        school_degree = self.get_argument("school_degree", 0)
        school_department = self.get_argument("school_department", 0)
        is_my = int(bool(self.get_argument("is_my", None) == "on"))
        id = int(id)
        year = int(year)
        degree = int(degree)
        department = int(department)

        if school_id:
            if is_my:
                user_school_new(self.current_user, school_id, school_year, school_degree, school_department)
            return self.redirect(SCHOOL_LINK % (school_id, school_year, school_degree, school_department))
        school_tuple = user_school_tuple(self.current_user_id)

        if not id and school_tuple:
            id, school_id, school_year, school_degree, school_department, txt = school_tuple[0]
            return self.redirect(SCHOOL_LINK % (school_id, school_year, school_degree, school_department))

        year = int(year)
        degree = int(degree)
        department = int(department)

        result = user_school_search(id, year, degree, department)
        result_len = len(result)

        if len(result) < 64 and id and any((year, degree, department)):
            school_count = user_school_count(id)
            if school_count <= result_len:
                school_count = 0
        else:
            school_count = 0

        self.render(
            school_data=(0, id, year, degree, department, ""),
            _id=id,
            school_tuple=school_tuple,
            result=result,
            year=year,
            degree=degree,
            department=department,
            school_count=school_count,
        )