Fair enough, Tim. Thanks for answering!

El miércoles, 15 de abril de 2020, 18:29:24 (UTC-4), Tim Graham escribió:
>
> I don't see a strong argument for adding it. As far as I can tell, this 
> would require adding 'request' to the signature of SessionStore.__init___() 
> (so it could be stored as an attribute on SessionStore and thereby 
> available in create_model_instance()). Backwards compatibility would be 
> non-trivial and coupling the session store to the request seems unnecessary.
>
> On Wednesday, April 15, 2020 at 5:38:18 PM UTC-4, Lorenzo Peña wrote:
>>
>> Yes, of course. I am already working things around in order to get what I 
>> need.
>>
>> Now, the database backed SessionStore defines a method 
>> "create_model_instance(self, data)" which is called from 
>> "django.contrib.sessions.middleware.SessionMiddleware". Django docs invite 
>> to redefine this method in order to populate the custom session with the 
>> required data.
>>
>> My question is: would it be okay to formally ask that the request object, 
>> which is already available there, be passed to that method when called, 
>> like " create_model_instance(self, data, request=None)"?
>>
>> El miércoles, 15 de abril de 2020, 17:01:30 (UTC-4), Tim Graham escribió:
>>>
>>> Can't you copy whatever data you want from the request into the session 
>>> data (request.session.<whatever> = request.<whatever>) in a view, 
>>> middleware, or wherever? That seems like the proper separation of concerns.
>>>
>>> On Wednesday, April 15, 2020 at 11:50:13 AM UTC-4, Lorenzo Peña wrote:
>>>>
>>>> Now, in order to follow the path suggested in the Django documentation 
>>>> for overriding database backed sessions, some of the data one might need 
>>>> to 
>>>> store in the session model is coming from the request, and Django is not 
>>>> passing the request when instantiating the session store.
>>>>
>>>> Do you think there is a point in requesting that the request object (if 
>>>> available) is passed as an optional parameter when creating the session?
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f9c2222b-77a4-4b0a-8fb4-5befa8c69fa9%40googlegroups.com.

Reply via email to