예제 #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)
예제 #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)
예제 #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),
        },
    )
예제 #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
예제 #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),
        })
예제 #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