Re: 'request' object is always None in auth backend's authenticate()?
Dear Tim & All, i sent a pull request against master [1], but it would need backporting for the 'stable/1.11.x' branch (it doesn't apply cleanly). Should i send an other PR against 'stable/1.11.x' branch, or it's up to the maintainer to backport it? [https://github.com/django/django/pull/8029] Thanks, regards, Zoltan Gyarmati https://zgyarmati.de On 02/07/2017 08:03 AM, Zoltan Gyarmati wrote: > > Dear Tim & All, > > thanks for the hint, it works! I filed a ticket [1] and i'm also > preparing a PR. Should i send the PR against 'master' or the > 'stable/1.11.x' branch? > > [1] https://code.djangoproject.com/ticket/27815#ticket > > > Thanks, regards > > Zoltan Gyarmati > https://zgyarmati.de > On 02/06/2017 11:05 PM, Tim Graham wrote: >> That looks like an oversight in the class-based view conversion [0]. >> Probably LoginView() needs a get_form_kwargs() method. Would you like >> to create a ticket and provide a patch? >> >> [0] >> https://github.com/django/django/commit/78963495d0caadb77eb97ccf319ef0ba3b204fb5 >> >> On Monday, February 6, 2017 at 4:12:48 PM UTC-5, Zoltan Gyarmati wrote: >> >> Dear All, >> >> i'm developing a multi-tenant application where it would be >> extremely handy to have the request object in my custom >> authentication backend available, so i went ahead and started to >> use the /1.11a,/ version, which already has the commit: >> >> 4b9330c Fixed #25187 -- Made request available in authentication >> backends. >> >> I'm using the contrib.auth.views.LoginView view for my login >> form, nothing special here, it works properly except for using >> the 'request' object in my backend's authenticate() method. >> >> After some trials and debugging for me it seems that 'request' >> object couldn't make its way to my authenticate() method: while >> contrib.auth.views.LoginView still has its 'self.request' set, >> it's not passed to its form_class >> 'contrib.auth.forms.AuthenticationForm' (its self.request is >> None), so when the actual authenticate() method is called from >> the AuthenticationForm class at contrib/auth/forms.py #187, >> always None passed as parameter 'request'. >> >> As i'm rather new to the Django internals, i'm on uncharted >> territory here: is it possible that it's a bug in the >> implementation, or it's more like that i missed something obvious? >> >> Thanks in advance, regards >> >> -- >> Zoltan Gyarmati >> https://zgyarmati.de >> >> -- >> 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 >> <mailto:django-developers+unsubscr...@googlegroups.com>. >> To post to this group, send email to >> django-developers@googlegroups.com >> <mailto:django-developers@googlegroups.com>. >> Visit this group at https://groups.google.com/group/django-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-developers/00f764d0-95d4-4abb-a23e-5874f0286bb9%40googlegroups.com >> <https://groups.google.com/d/msgid/django-developers/00f764d0-95d4-4abb-a23e-5874f0286bb9%40googlegroups.com?utm_medium=email&utm_source=footer>. >> For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ae6827a3-3c93-ddb0-07f0-5b01bc95ce67%40gmail.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: OpenPGP digital signature
Re: 'request' object is always None in auth backend's authenticate()?
Dear Tim & All, thanks for the hint, it works! I filed a ticket [1] and i'm also preparing a PR. Should i send the PR against 'master' or the 'stable/1.11.x' branch? [1] https://code.djangoproject.com/ticket/27815#ticket Thanks, regards Zoltan Gyarmati https://zgyarmati.de On 02/06/2017 11:05 PM, Tim Graham wrote: > That looks like an oversight in the class-based view conversion [0]. > Probably LoginView() needs a get_form_kwargs() method. Would you like > to create a ticket and provide a patch? > > [0] > https://github.com/django/django/commit/78963495d0caadb77eb97ccf319ef0ba3b204fb5 > > On Monday, February 6, 2017 at 4:12:48 PM UTC-5, Zoltan Gyarmati wrote: > > Dear All, > > i'm developing a multi-tenant application where it would be > extremely handy to have the request object in my custom > authentication backend available, so i went ahead and started to > use the /1.11a,/ version, which already has the commit: > > 4b9330c Fixed #25187 -- Made request available in authentication > backends. > > I'm using the contrib.auth.views.LoginView view for my login form, > nothing special here, it works properly except for using the > 'request' object in my backend's authenticate() method. > > After some trials and debugging for me it seems that 'request' > object couldn't make its way to my authenticate() method: while > contrib.auth.views.LoginView still has its 'self.request' set, > it's not passed to its form_class > 'contrib.auth.forms.AuthenticationForm' (its self.request is > None), so when the actual authenticate() method is called from the > AuthenticationForm class at contrib/auth/forms.py #187, always > None passed as parameter 'request'. > > As i'm rather new to the Django internals, i'm on uncharted > territory here: is it possible that it's a bug in the > implementation, or it's more like that i missed something obvious? > > Thanks in advance, regards > > -- > Zoltan Gyarmati > https://zgyarmati.de > > -- > 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 > <mailto:django-developers+unsubscr...@googlegroups.com>. > To post to this group, send email to > django-developers@googlegroups.com > <mailto:django-developers@googlegroups.com>. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/00f764d0-95d4-4abb-a23e-5874f0286bb9%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/00f764d0-95d4-4abb-a23e-5874f0286bb9%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ccb7bddd-d7d4-d918-fac2-c568f84355f0%40gmail.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: OpenPGP digital signature
'request' object is always None in auth backend's authenticate()?
Dear All, i'm developing a multi-tenant application where it would be extremely handy to have the request object in my custom authentication backend available, so i went ahead and started to use the /1.11a,/ version, which already has the commit: 4b9330c Fixed #25187 -- Made request available in authentication backends. I'm using the contrib.auth.views.LoginView view for my login form, nothing special here, it works properly except for using the 'request' object in my backend's authenticate() method. After some trials and debugging for me it seems that 'request' object couldn't make its way to my authenticate() method: while contrib.auth.views.LoginView still has its 'self.request' set, it's not passed to its form_class 'contrib.auth.forms.AuthenticationForm' (its self.request is None), so when the actual authenticate() method is called from the AuthenticationForm class at contrib/auth/forms.py #187, always None passed as parameter 'request'. As i'm rather new to the Django internals, i'm on uncharted territory here: is it possible that it's a bug in the implementation, or it's more like that i missed something obvious? Thanks in advance, regards -- Zoltan Gyarmati https://zgyarmati.de -- 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 post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/05ee6d9a-71d7-ade5-9d51-9dd05a1e505a%40gmail.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: OpenPGP digital signature