Monday, January 2, 2012

Re: How to get current session user in models.py?

@Andy: I agree it may be convoluted a bit indeed.. but your
alternative a) is not an option - I would not do it if I did not
needed it, wouldn't I ;-)
b) requires interface changes, sometimes it's even messier.. changing
the signatures means you need make sure all the callers would accept
that change , c) local threading way posted by you is not as straight
forward as it looks - I'd say it's very similar in complexity to
mine.. you still need to explicitly call 'activate' somewhere(view
method) to populate local thread storage while in my case you 'only'
inspect the call stack - the change is limited to a single block of
code.. All in all - I never claimed the way I solved it's perfect - it
just works fine for me and wanted to share it with others.

Thanks for your comment! I really appreciate it :-)

Cheerio,
Waldek

On Jan 2, 7:49 pm, Andy McKay <a...@clearwind.ca> wrote:
> Inspecting your stack to find the user seems a pretty convoluted way to do
> it.
>
> You could either a) not access users in your models b) explicitly pass the
> user around or c) just place your user into a local threading and retrieve
> it anywhere else for example:https://github.com/andymckay/arecibo/blob/master/listener/lib/usersto...
> any other methods for doing that.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate