Thanks a lot for the replies.
Since the request is simply a dictionary, can you not append that attribute to it?
The view hasn't been called yet at that point in the middleware stack, so I don't think it would have had an opportunity to modify the request dictionary:
https://docs.djangoproject.com/en/1.6/topics/http/middleware/#hooks-and-application-order
But I think your suggestion would probably work great to grab the attribute in the `process_response()` or `process_template_response()` middleware hooks.
On Saturday, December 28, 2013 8:19:22 AM UTC-5, thinkin...@gmail.com wrote:
Hey,Try along these lines:def process_view(self, request, view_func, view_args, view_kwargs):view = get_class(view_func.__module__, view_func.__name__) view.my_attribute
Heh, yeah, this seems to be the only way. I was kind of headed in this direction but I'm fairly new to Django/python, and to programming in general. Is this safe/efficient? I guess this just involves importing the view class once per request -- doesn't seem like a big deal but would love some feedback.
Thanks again!
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/846d2681-022e-4bc2-abaa-12bb279b1b60%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment