On Tuesday 27 March 2007 10:28, Gilhad wrote: > > the default value is a callable, its not a value... I use exactly this > > and it work very well for me... > > I agree that there is duplicity (why specify a default if you override > > it in save() ), but that shouldn't matter > > The idea is, that new object 'Vykon' came prefilled, but in the admin > interface can be its 'user' changed to anything (or nothing). > If it is not filled before save, then use the current one, so it is filled > everytime, usually (but not necesarry) with auth. user. > > As I did some other experiments, it seems to me, that there are > TWO '_thread_locals' objects, one filled in 'process_request' (which > has 'user' attribute set) and another one in 'get_current_user' which does > not. > > The addresses are still the same pair, when I create more 'Vykon' objects. > For every call of 'process_request' is there one (and everytime the same) > and for every call of 'get_current_user' is another one (and everytime the > same). > > I just cannot understand it ...
Here is the list of what came to screen Validating models... Created _thread_locals <thread._local object at 0xb6d56890> 0 errors found. Django version 0.96-pre, using settings 'pichacky_proj.settings' Development server is running at http://192.168.254.22:8002/ Quit the server with CONTROL-C. Created _thread_locals <thread._local object at 0xb6ceda40> USER= <thread._local object at 0xb6ceda40> gilhad get_current_user= <thread._local object at 0xb6d56890> None [27/Mar/2007 10:32:20] "GET /admin/pichacky_app/vykon/add/ HTTP/1.1" 200 4852 USER= <thread._local object at 0xb6ceda40> gilhad [27/Mar/2007 10:32:21] "GET /admin/jsi18n/ HTTP/1.1" 200 801 USER= <thread._local object at 0xb6ceda40> gilhad get_current_user= <thread._local object at 0xb6d56890> None [27/Mar/2007 10:33:30] "GET /admin/pichacky_app/vykon/add/ HTTP/1.1" 200 4852 USER= <thread._local object at 0xb6ceda40> gilhad [27/Mar/2007 10:33:30] "GET /admin/jsi18n/ HTTP/1.1" 200 801 One instance (0xb6d56890) is created in 'Validating models...', the one is used in 'get_current_user' and does not have 'user' attribute Another instance (0xb6ceda40) is created after first request for page, and has 'user' correctly set (and keeps it between requests for pages, even when logout/login came) Looks like the middleware is initiated TWICE, first when referrenced in models, than again, when it came to the play via middleware I am using Django server, not Apache (because I am just writing and testing it) -- Zdravi Gilhad [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

