示例#1
0
def index():
    try:
        #TODO : make this way more robust
        institution = Institution.find_one(
            Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(institution._id)
        inst_dict.update({
            'home':
            False,
            'institution':
            True,
            'redirect_url':
            '/institutions/{}/'.format(institution._id)
        })

        return inst_dict
    except NoResultsFound:
        pass

    all_institutions = Institution.find().sort('name')
    dashboard_institutions = [{
        'id': inst._id,
        'name': inst.name,
        'logo_path': inst.logo_path_rounded_corners
    } for inst in all_institutions]

    return {'home': True, 'dashboard_institutions': dashboard_institutions}
示例#2
0
文件: views.py 项目: cslzchen/osf.io
def index():
    try:
        #TODO : make this way more robust
        institution = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(institution._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(institution._id)
        })

        return inst_dict
    except NoResultsFound:
        pass

    all_institutions = Institution.find().sort('name')
    dashboard_institutions = [
        {'id': inst._id, 'name': inst.name, 'logo_path': inst.logo_path_rounded_corners}
        for inst in all_institutions
    ]

    return {
        'home': True,
        'dashboard_institutions': dashboard_institutions
    }
示例#3
0
def index():
    try:
        # TODO : make this way more robust
        inst = Institution.find_one(Q("domains", "eq", request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({"home": False, "institution": True, "redirect_url": "/institutions/{}/".format(inst._id)})
        return inst_dict
    except NoResultsFound:
        pass
    return {"home": True}
示例#4
0
def index():
    try:
        #TODO : make this way more robust
        inst = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(inst._id)
        })
        return inst_dict
    except NoResultsFound:
        pass
    return {'home': True}
示例#5
0
文件: views.py 项目: fredtoh/osf.io
def index():
    try:
        #TODO : make this way more robust
        inst = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(inst._id)
        })
        return inst_dict
    except NoResultsFound:
        pass
    return {'home': True}