Пример #1
0
def hubMembersView(request, data_type, data_value):
    try :
        logged_in_user = get_current_user(request)
        if data_type == "id" :
            hubid = data_value
            hub = get_hub_by_id(request, hubid, logged_in_user)
        if hub == None:
            return assembleHubErrorResponse(request, "Sorry that Hub was not found")
        memberNames = hub.get_hub_member_names(request)
        members = [get_user_by_name(request, userName) for userName in memberNames]
        members = [username for username in members if username != False]
        details = render_to_response("partial_hub_profile_members.html",
                                    {
                                        "current_user": logged_in_user,
                                        "members": members,
                                        "request": request,
                                        "payload": {"hub": hub},
                                        "logged_in_user": logged_in_user.user_id
                                    },
                                    context_instance=RequestContext(request))
        return assembleHubResponse(request, logged_in_user, hub, details, 
                                hideMiniSpraycan = (not logged_in_user.is_logged_in))
    except :
        logger=logging.getLogger(__name__)
        return errorscreen(request,logger, sys)
Пример #2
0
def listCreated(request, user_name):
    try :
        thereturn = custompopup(request,'<p>Sorry, we were unable to display this page.</p>')
        loggedin, user, loggedin_user, follow, data = getUserVariables(request, user_name)
        logged_in_user = get_logged_in_user(request)
        request_user = get_user_by_name(request, user_name)
        if request_user != False :
            hubs = get_hubs_by_user(request, request_user)
            if len(hubs) == 0 :
                if loggedin and user_name == user['user_name'] :
                    thereturn = render_to_response('partial_user_nocreatedhubsmyself.html',locals(),context_instance=RequestContext(request))
                else :
                    thereturn = render_to_response('partial_user_nocreatedhubs.html',locals(),context_instance=RequestContext(request))
            else :
                response = {'data': {'hubs': hubs }}
                if loggedin :
                    from webapp.views.user import getUserHubs
                    response['data']['joinedhubs'] = getUserHubs(user['user_name'])
                    if user_name == user['user_name'] :
                        response['data']['createdhubs'] = [hub.hub_id for hub in response['data']['hubs']]
                thereturn = render_to_response('partial_user_createdhubs.html',locals(),context_instance=RequestContext(request))
        return thereturn
    except :
        logger=logging.getLogger(__name__)
        return errorscreen(request,logger, sys)
Пример #3
0
def hubMembersView(request, data_type, data_value):
    try:
        logged_in_user = get_current_user(request)
        if data_type == "id":
            hubid = data_value
            hub = get_hub_by_id(request, hubid, logged_in_user)
        if hub == None:
            return assembleHubErrorResponse(request,
                                            "Sorry that Hub was not found")
        memberNames = hub.get_hub_member_names(request)
        members = [
            get_user_by_name(request, userName) for userName in memberNames
        ]
        members = [username for username in members if username != False]
        details = render_to_response("partial_hub_profile_members.html", {
            "current_user": logged_in_user,
            "members": members,
            "request": request,
            "payload": {
                "hub": hub
            },
            "logged_in_user": logged_in_user.user_id
        },
                                     context_instance=RequestContext(request))
        return assembleHubResponse(
            request,
            logged_in_user,
            hub,
            details,
            hideMiniSpraycan=(not logged_in_user.is_logged_in))
    except:
        logger = logging.getLogger(__name__)
        return errorscreen(request, logger, sys)
Пример #4
0
def listCreated(request, user_name):
    try:
        thereturn = custompopup(
            request, '<p>Sorry, we were unable to display this page.</p>')
        loggedin, user, loggedin_user, follow, data = getUserVariables(
            request, user_name)
        logged_in_user = get_logged_in_user(request)
        request_user = get_user_by_name(request, user_name)
        if request_user != False:
            hubs = get_hubs_by_user(request, request_user)
            if len(hubs) == 0:
                if loggedin and user_name == user['user_name']:
                    thereturn = render_to_response(
                        'partial_user_nocreatedhubsmyself.html',
                        locals(),
                        context_instance=RequestContext(request))
                else:
                    thereturn = render_to_response(
                        'partial_user_nocreatedhubs.html',
                        locals(),
                        context_instance=RequestContext(request))
            else:
                response = {'data': {'hubs': hubs}}
                if loggedin:
                    from webapp.views.user import getUserHubs
                    response['data']['joinedhubs'] = getUserHubs(
                        user['user_name'])
                    if user_name == user['user_name']:
                        response['data']['createdhubs'] = [
                            hub.hub_id for hub in response['data']['hubs']
                        ]
                thereturn = render_to_response(
                    'partial_user_createdhubs.html',
                    locals(),
                    context_instance=RequestContext(request))
        return thereturn
    except:
        logger = logging.getLogger(__name__)
        return errorscreen(request, logger, sys)