Example #1
0
def user_profile(request, username):
    u = get_object_or_404(User, username=username)
    ctx = {
        'user_obj': u,
        'email_hash': hashlib.md5(u.email).hexdigest(),
        'user_can_commit': u.has_perm('auth.commit'),
        'clas': find_agreements(u),
        'stats': get_user_stats(u),
    }
    return render(request, "accounts/user_profile.html", ctx)
Example #2
0
def user_profile(request, username):
    u = get_object_or_404(User, username=username)
    ctx = {
        'user_obj': u,
        'email_hash': hashlib.md5(u.email).hexdigest(),
        'user_can_commit': u.has_perm('auth.commit'),
        'clas': find_agreements(u),
        'stats': get_user_stats(u),
    }
    return render(request, "accounts/user_profile.html", ctx)
Example #3
0
def user_profile(request, username):
    user = get_object_or_404(User, username=username)
    return render(
        request,
        "accounts/user_profile.html",
        {
            "user_obj": user,
            "email_hash": hashlib.md5(user.email.encode("ascii", "ignore")).hexdigest(),
            "user_can_commit": user.has_perm("auth.commit"),
            "clas": find_agreements(user),
            "stats": get_user_stats(user),
        },
    )
Example #4
0
def get_user_info(username):
    c = cache.get_cache("default")
    username = username.encode("ascii", "ignore")
    key = "trac_user_info:%s" % hashlib.md5(username).hexdigest()
    info = c.get(key)
    if info is None:
        try:
            u = User.objects.get(username=username)
        except User.DoesNotExist:
            info = {"core": False, "cla": False}
        else:
            info = {"core": u.has_perm("auth.commit"), "cla": bool(find_agreements(u))}
        c.set(key, info, 60 * 60)
    return info
Example #5
0
def user_profile(request, username):
    user = get_object_or_404(User, username=username)
    return render(
        request, "accounts/user_profile.html", {
            'user_obj':
            user,
            'email_hash':
            hashlib.md5(user.email.encode('ascii', 'ignore')).hexdigest(),
            'user_can_commit':
            user.has_perm('auth.commit'),
            'clas':
            find_agreements(user),
            'stats':
            get_user_stats(user),
        })
Example #6
0
def get_user_info(username):
    c = cache.get_cache('default')
    username = username.encode('ascii', 'ignore')
    key = 'trac_user_info:%s' % hashlib.md5(username).hexdigest()
    info = c.get(key)
    if info is None:
        try:
            u = User.objects.get(username=username)
        except User.DoesNotExist:
            info = {"core": False, "cla": False}
        else:
            info = {
                "core": u.has_perm('auth.commit'),
                "cla": bool(find_agreements(u))
            }
        c.set(key, info, 60 * 60)
    return info