|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Unauthorized, but only on the upgraded Grok projectI created a project with
grok = 1.0a4 and it works well. Now I have deployed the same project with a fresh grok = 1.0b2 and I am getting [Unauthorized]. When I am trying to log in through my custom login view. I can reach the login view but [Unauthorized] seems to be thrown when I post my login data. I read the comment on <grant permission="zope.View" principal="zope.Anybody" /> but I am under the impression that this isn't related to my problem. I am not getting any entries in access.log, and obviously no errors, so I don't really know how to track down this problem. Especially since it works fine in my development setup. I can't reach any other views of my app except the login view. This is the login code. class Login(grok.View): grok.context(ProtonCMS) title = 'Logga in' referer = None def update(self, login_submit=None, login=None): # XXX: need to display some kind of feedback when the login fails self.the_url, self.the_args = self.get_url_and_args() if (not IUnauthenticatedPrincipal.providedBy(self.request.principal) and login_submit is not None): destination = self.request.get('referer') if not destination: destination = self.url(grok.getSite()) + '/default/ workflow' else: destination = unquote(destination) self.redirect(destination) else: if self.the_args.has_key('camefrom'): self.referer = self.the_args['camefrom'] Any ideas? Mvh Sebastian _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok projectI only get the error when I do a successful login if that is any help.
The offending code causing [Unauthorised] should be: > if (not IUnauthenticatedPrincipal.providedBy(self.request.principal) > and login_submit is not None): > destination = self.request.get('referer') > if not destination: > destination = self.url(grok.getSite()) + '/default/ > workflow' > else: > destination = unquote(destination) > self.redirect(destination) Mvh Sebastian On 4 okt 2009, at 13.40, Sebastian Ware wrote: > I created a project with > > grok = 1.0a4 > > and it works well. Now I have deployed the same project with a fresh > > grok = 1.0b2 > > and I am getting [Unauthorized]. When I am trying to log in through my > custom login view. I can reach the login view but [Unauthorized] seems > to be thrown when I post my login data. I read the comment on > <grant permission="zope.View" principal="zope.Anybody" /> > but I am under the impression that this isn't related to my problem. > > I am not getting any entries in access.log, and obviously no errors, > so I don't really know how to track down this problem. Especially > since it works fine in my development setup. > > I can't reach any other views of my app except the login view. This is > the login code. > > class Login(grok.View): > grok.context(ProtonCMS) > title = 'Logga in' > > referer = None > > def update(self, login_submit=None, login=None): > # XXX: need to display some kind of feedback when the login > fails > self.the_url, self.the_args = self.get_url_and_args() > if (not > IUnauthenticatedPrincipal.providedBy(self.request.principal) > and login_submit is not None): > destination = self.request.get('referer') > if not destination: > destination = self.url(grok.getSite()) + '/default/ > workflow' > else: > destination = unquote(destination) > self.redirect(destination) > else: > if self.the_args.has_key('camefrom'): > self.referer = self.the_args['camefrom'] > > Any ideas? > > Mvh Sebastian > > > _______________________________________________ > Grok-dev mailing list > Grok-dev@... > https://mail.zope.org/mailman/listinfo/grok-dev _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)I have reinstalled my project on the production server with grok 1.0a4
and it works fine so I guess I need to configure something differently for grok 1.0b2 to work. But since I made a fresh grokproject I don't see what I need to change. Mvh Sebastian On 4 okt 2009, at 14.31, Sebastian Ware wrote: > I only get the error when I do a successful login if that is any > help. The offending code causing [Unauthorised] should be: > >> if (not IUnauthenticatedPrincipal.providedBy(self.request.principal) >> and login_submit is not None): >> destination = self.request.get('referer') >> if not destination: >> destination = self.url(grok.getSite()) + '/default/ >> workflow' >> else: >> destination = unquote(destination) >> self.redirect(destination) > > Mvh Sebastian > > On 4 okt 2009, at 13.40, Sebastian Ware wrote: > >> I created a project with >> >> grok = 1.0a4 >> >> and it works well. Now I have deployed the same project with a fresh >> >> grok = 1.0b2 >> >> and I am getting [Unauthorized]. When I am trying to log in through >> my >> custom login view. I can reach the login view but [Unauthorized] >> seems >> to be thrown when I post my login data. I read the comment on >> <grant permission="zope.View" principal="zope.Anybody" /> >> but I am under the impression that this isn't related to my problem. >> >> I am not getting any entries in access.log, and obviously no errors, >> so I don't really know how to track down this problem. Especially >> since it works fine in my development setup. >> >> I can't reach any other views of my app except the login view. This >> is >> the login code. >> >> class Login(grok.View): >> grok.context(ProtonCMS) >> title = 'Logga in' >> >> referer = None >> >> def update(self, login_submit=None, login=None): >> # XXX: need to display some kind of feedback when the login >> fails >> self.the_url, self.the_args = self.get_url_and_args() >> if (not >> IUnauthenticatedPrincipal.providedBy(self.request.principal) >> and login_submit is not None): >> destination = self.request.get('referer') >> if not destination: >> destination = self.url(grok.getSite()) + '/default/ >> workflow' >> else: >> destination = unquote(destination) >> self.redirect(destination) >> else: >> if self.the_args.has_key('camefrom'): >> self.referer = self.the_args['camefrom'] >> >> Any ideas? >> >> Mvh Sebastian >> >> >> _______________________________________________ >> Grok-dev mailing list >> Grok-dev@... >> https://mail.zope.org/mailman/listinfo/grok-dev > _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)Sebastian Ware wrote:
> I have reinstalled my project on the production server with grok 1.0a4 > and it works fine so I guess I need to configure something differently > for grok 1.0b2 to work. But since I made a fresh grokproject I don't > see what I need to change. snip >>> class Login(grok.View): >>> grok.context(ProtonCMS) >>> title = 'Logga in' >>> >>> referer = None >>> >>> def update(self, login_submit=None, login=None): >>> # XXX: need to display some kind of feedback when the login >>> fails >>> self.the_url, self.the_args = self.get_url_and_args() >>> if (not >>> IUnauthenticatedPrincipal.providedBy(self.request.principal) >>> and login_submit is not None): >>> destination = self.request.get('referer') >>> if not destination: >>> destination = self.url(grok.getSite()) + '/default/ >>> workflow' >>> else: >>> destination = unquote(destination) >>> self.redirect(destination) >>> else: >>> if self.the_args.has_key('camefrom'): >>> self.referer = self.the_args['camefrom'] >>> >>> Any ideas? Could you test this again with a grok.require('zope.Public') on your Login view class? >>> class Login(grok.View): ... grok.require('zope.Public') ... grok.context(ProtonCMS) ... title = 'Logga in' ... If that does work, I think I know what went wrong (and then it is also clearly a documentation bug then). Regards, jw _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)Problem solved with:
> grok.require('zope.Public') Mvh Sebastian On 6 okt 2009, at 09.44, Jan-Wijbrand Kolman wrote: > Sebastian Ware wrote: >> I have reinstalled my project on the production server with grok >> 1.0a4 >> and it works fine so I guess I need to configure something >> differently >> for grok 1.0b2 to work. But since I made a fresh grokproject I don't >> see what I need to change. > snip >>>> class Login(grok.View): >>>> grok.context(ProtonCMS) >>>> title = 'Logga in' >>>> >>>> referer = None >>>> >>>> def update(self, login_submit=None, login=None): >>>> # XXX: need to display some kind of feedback when the login >>>> fails >>>> self.the_url, self.the_args = self.get_url_and_args() >>>> if (not >>>> IUnauthenticatedPrincipal.providedBy(self.request.principal) >>>> and login_submit is not None): >>>> destination = self.request.get('referer') >>>> if not destination: >>>> destination = self.url(grok.getSite()) + '/default/ >>>> workflow' >>>> else: >>>> destination = unquote(destination) >>>> self.redirect(destination) >>>> else: >>>> if self.the_args.has_key('camefrom'): >>>> self.referer = self.the_args['camefrom'] >>>> >>>> Any ideas? > > > Could you test this again with a grok.require('zope.Public') on your > Login view class? > >>>> class Login(grok.View): > ... grok.require('zope.Public') > ... grok.context(ProtonCMS) > ... title = 'Logga in' > ... > > > If that does work, I think I know what went wrong (and then it is also > clearly a documentation bug then). > > Regards, > jw > > _______________________________________________ > Grok-dev mailing list > Grok-dev@... > https://mail.zope.org/mailman/listinfo/grok-dev _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)Sebastian Ware wrote:
> Problem solved with: > >> grok.require('zope.Public') Right. Let me try to explain: * Generally a view that accepts login credentials can itself not require authentication. The key would be stored in the safe otherwise. * Starting with Grok 1.0b2 views that do not explicitly set a require, will have the 'zope.View' permission requirement and not 'zope.Public' anymore. It is important to realize that 'zope.View' really is a permssion, whereas 'zope.Public' is not a permission, but merely an indicator to the zope security machinery that this view does not need any checking of permissions at all. Now, what I still do not really understand about this situation is that you said you have added... <grant permission="zope.View" principal="zope.Anybody" /> ...to your project's site.zcml file. And this apparently still made the Login view to require authentication. I wonder if the "grant" somehow was not picked up by your project? Or if this "grant" is not enough for in certain situations? This needs a bit of thinking and experimentation. If there's indeed a bug in Grok or in the upgrade docs I'd really like to find it soonish... regards, jw _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)On 6 okt 2009, at 12.25, Jan-Wijbrand Kolman wrote:
> Now, what I still do not really understand about this situation is > that > you said you have added... > > <grant permission="zope.View" principal="zope.Anybody" /> > > ...to your project's site.zcml file. And this apparently still made > the > Login view to require authentication. I wonder if the "grant" somehow > was not picked up by your project? Or if this "grant" is not enough > for > in certain situations? > It was added by grokproject. I have double checked and this permission is in fact in the buildout.cfg file of the project and has been written to site.zcml. Mvh Sebastian _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
|
|
Re: Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?)Hi,
I upgraded my old grok project from v. 0.14 to v. 1.0 and i have same problem, but when i replaced in file site.zcml this: <grant permission="zope.View" principal="zope.Anybody" /> <grant permission="zope.app.dublincore.view" principal="zope.Anybody" /> with this: <grant permission="zope.View" principal="zope.Everybody" /> <grant permission="zope.app.dublincore.view" principal="zope.Everybody" /> it worked. But i don't understand why :) Regards Roman Lacko ________________________________________ From: grok-dev-bounces@... [grok-dev-bounces@...] On Behalf Of Sebastian Ware [sebastian@...] Sent: Tuesday, October 06, 2009 12:59 PM To: Jan-Wijbrand Kolman Cc: grok-dev@... Subject: Re: [Grok-dev] Unauthorized, but only on the upgraded Grok project (bug in 1.0b2?) On 6 okt 2009, at 12.25, Jan-Wijbrand Kolman wrote: > Now, what I still do not really understand about this situation is > that > you said you have added... > > <grant permission="zope.View" principal="zope.Anybody" /> > > ...to your project's site.zcml file. And this apparently still made > the > Login view to require authentication. I wonder if the "grant" somehow > was not picked up by your project? Or if this "grant" is not enough > for > in certain situations? > It was added by grokproject. I have double checked and this permission is in fact in the buildout.cfg file of the project and has been written to site.zcml. Mvh Sebastian _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev _______________________________________________ Grok-dev mailing list Grok-dev@... https://mail.zope.org/mailman/listinfo/grok-dev |
| Free embeddable forum powered by Nabble | Forum Help |