Hi,

I have a view, which is available to all users. I want to have different logic based on the user name if the user is logged in. The view is a grok.View. Unfortunately, the user is not authenticated before the view is invoked. Is there another View baseclass that I should be using?

My understanding is that "zope2.View" should invoke the authentication machinery whereas "zope2.Public" would not.

Thanks,

Kevin


from five import grok

class ListTags(grok.View):
    grok.context(Interface)
    grok.require('zope2.View')

    def __init__(self, context, request):
        super(ListTags, self).__init__(context, request)
        import pdb; pdb.set_trace()

However, even though I am logged in

(Pdb) context.portal_membership.isAnonymousUser()
1

Later on in the same request, code called from a viewlet is authenticated...

(Pdb) context.portal_membership.isAnonymousUser()
0


_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/product-developers

Reply via email to