Пример #1
0
def friends(request, list_type='friends'):
    logging.info("djrs.view.friends")

    harness = getWebHarness()
    if harness.is_connected() is False:
        return HttpResponseRedirect(reverse('djrs_login'))

    template_vars = {}
    acceptable_types = ['all', 'friends', 'connected', 'self']
    if list_type not in acceptable_types:
        template_vars['error_message'] = 'Invalid Arguments Friends Listing'
        return render_to_response('djrs_error.dtml',
                                  template_vars,
                                  context_instance=RequestContext(request))

    try:
        (req_id, msg_id) = harness.request_peer_list(list_type)
        resp = harness.specific_response(req_id)
        if resp:
            (resp_id, resp_msg) = resp
            dict_msg = protobuf_to_dict(resp_msg)
            template_vars['friend_list'] = core_personlist(dict_msg['peers'])

    except Exception, e:
        logging.info("Unexpected Exception: %s" % (e))
Пример #2
0
def friend_details(request, friend_id):
    logging.info("djrs.view.friend_details")

    harness = getWebHarness()
    if harness.is_connected() is False:
        return HttpResponseRedirect(reverse('djrs_login'))

    template_vars = {}
    try:
        (req_id, msg_id) = harness.request_peer_details(friend_id)
        resp = harness.specific_response(req_id)
        if resp:
            (resp_id, resp_msg) = resp
            dict_msg = protobuf_to_dict(resp_msg)
            template_vars['friend_list'] = core_personlist(dict_msg['peers'])

    except Exception, e:
        logging.info("Unexpected Exception: %s" % (e))
Пример #3
0
def friend_details(request, friend_id):
    logging.info("djrs.view.friend_details")

    harness = getWebHarness()
    if harness.is_connected() is False:
        return HttpResponseRedirect(reverse("djrs_login"))

    template_vars = {}
    try:
        (req_id, msg_id) = harness.request_peer_details(friend_id)
        resp = harness.specific_response(req_id)
        if resp:
            (resp_id, resp_msg) = resp
            dict_msg = protobuf_to_dict(resp_msg)
            template_vars["friend_list"] = core_personlist(dict_msg["peers"])

    except Exception, e:
        logging.info("Unexpected Exception: %s" % (e))
Пример #4
0
def friends(request, list_type="friends"):
    logging.info("djrs.view.friends")

    harness = getWebHarness()
    if harness.is_connected() is False:
        return HttpResponseRedirect(reverse("djrs_login"))

    template_vars = {}
    acceptable_types = ["all", "friends", "connected", "self"]
    if list_type not in acceptable_types:
        template_vars["error_message"] = "Invalid Arguments Friends Listing"
        return render_to_response("djrs_error.dtml", template_vars, context_instance=RequestContext(request))

    try:
        (req_id, msg_id) = harness.request_peer_list(list_type)
        resp = harness.specific_response(req_id)
        if resp:
            (resp_id, resp_msg) = resp
            dict_msg = protobuf_to_dict(resp_msg)
            template_vars["friend_list"] = core_personlist(dict_msg["peers"])

    except Exception, e:
        logging.info("Unexpected Exception: %s" % (e))
Пример #5
0
def friends(request, list_type='friends'):
    logging.info("djrs.view.friends")

    harness = getWebHarness()
    if harness.is_connected() is False:
        return HttpResponseRedirect(reverse('djrs_login'))

    template_vars = {}
    acceptable_types = ['all', 'friends', 'connected', 'self']
    if list_type not in acceptable_types:
        template_vars['error_message'] = 'Invalid Arguments Friends Listing'
        return render_to_response('djrs_error.dtml', template_vars, context_instance=RequestContext(request))

    try:
        (req_id, msg_id) = harness.request_peer_list(list_type)
        resp = harness.specific_response(req_id)
        if resp:
            (resp_id, resp_msg) = resp
            dict_msg = protobuf_to_dict(resp_msg)
            if 'peers' in dict_msg:
                template_vars['friend_list'] = core_personlist(dict_msg['peers'])

    except Exception, e:
        logging.info("Unexpected Exception: %s" % (e))