request.user not pickable anymore

14 views
Skip to first unread message

Torsten Bronger

unread,
Sep 16, 2011, 12:44:17 PM9/16/11
to django...@googlegroups.com
Hall�chen!

Since <https://code.djangoproject.com/changeset/16305>, request.user
is a SimpleLazyObject. This means that

def my_simple_test_view(request):
import pickle
pickle.dumps(request.user)

fails. Since we put objects in the cache which contain
request.user, we saw a traceback when updating our SVN Django
recently.

I added a function

def unlazy_object(lazy_object):
if lazy_object._wrapped is None:
lazy_object._setup()
return lazy_object._wrapped

user = unlazy_object(request.user)

This works. But is this the way to go? Is it possible to make
SimpleLazyObject pickable in the first place?

Tsch�,
Torsten.

--
Torsten Bronger Jabber ID: torsten...@jabber.rwth-aachen.de
or http://bronger-jmp.appspot.com

Tim Shaffer

unread,
Sep 16, 2011, 2:48:13 PM9/16/11
to django...@googlegroups.com
Looks like there might already be a ticket open to fix this:

Torsten Bronger

unread,
Sep 16, 2011, 4:05:31 PM9/16/11
to django...@googlegroups.com
Hall�chen!

Tim Shaffer writes:

> Looks like there might already be a ticket open to fix this:
>
> https://code.djangoproject.com/ticket/16563

Wow, thank you! Since 1.3 is not affected and 1.4 won't be
probably, this means that we don't have to do anything.

Łukasz Rekucki

unread,
Sep 16, 2011, 5:01:25 PM9/16/11
to django...@googlegroups.com
On 16 September 2011 22:05, Torsten Bronger

<bro...@physik.rwth-aachen.de> wrote:
> this means that we don't have to do anything.

Not really. To 1.4 not be affected, someone needs to write a patch for
that ticket. This can be you ;)

--
Łukasz Rekucki

Torsten Bronger

unread,
Sep 17, 2011, 5:14:35 AM9/17/11
to django...@googlegroups.com
Hallöchen!

Łukasz Rekucki writes:

> On 16 September 2011 22:05, Torsten Bronger
> <bro...@physik.rwth-aachen.de> wrote:
>
>> this means that we don't have to do anything.
>
> Not really. To 1.4 not be affected, someone needs to write a patch
> for that ticket.

Of course you are right. I was only refering to "Milestone 1.4" and
"Release blocker" which means that it has high priority.

Tschö,

Reply all
Reply to author
Forward
0 new messages