~petersanchez/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH django-impersonate] Fixing the handling of user models that have a UUID primary key

Adam Taylor <ataylor32@gmail.com>
Details
Message ID
<b536d2d35e1dac51f355.1743433992@ted>
Sender timestamp
1743433992
DKIM signature
missing
Download raw message
Patch: +5 -1
# HG changeset patch
# User Adam Taylor <ataylor32@gmail.com>
# Date 1743433368 0
#      Mon Mar 31 15:02:48 2025 +0000
# Node ID b536d2d35e1dac51f35580254f65a7ee30613138
# Parent  33cb8c77262a474869ab94bcb82c5446baf3c228
Fixing the handling of user models that have a UUID primary key

diff --git a/impersonate/views.py b/impersonate/views.py
--- a/impersonate/views.py
+++ b/impersonate/views.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging
from datetime import datetime, timezone
from uuid import UUID

from django.db.models import Q
from django.http import Http404
@@ -40,7 +41,10 @@
        logger.error(f'views/impersonate: Invalid value for uid given: {uid}')
        raise Http404('Invalid value given.')
    if check_allow_for_user(request, new_user):
        request.session['_impersonate'] = new_user.pk
        if isinstance(new_user.pk, UUID):
            request.session['_impersonate'] = str(new_user.pk)
        else:
            request.session['_impersonate'] = new_user.pk
        request.session['_impersonate_start'] = datetime.now(
            tz=timezone.utc
        ).timestamp()
Details
Message ID
<D8YSYUMHFJK4.9NIZZ3RURWX6@netlandish.com>
In-Reply-To
<b536d2d35e1dac51f355.1743433992@ted> (view parent)
Sender timestamp
1743844578
DKIM signature
missing
Download raw message
Applied. Thanks!
Reply to thread Export thread (mbox)