For some reason I keep getting 404 when I am redirected by my application after logging in if I have a permission attached to that view but everything is fine if I remove the permission. I am using an AuthTktAuthenticationPolicy and I have already tried adding the following callback:
def principalFinder(username, request):
return [Authenticated]
but that didn't change anything. This is the view in question:
@view_config(route_name='test', context=myAERO, permission='editAln')
def test(request):
return Response(request.authenticated_userid)
as you can see it uses the class myAERO as its context:
class myAERO():
__acl__ = [
(Allow, Authenticated, 'editAln')
]
def __init__(self, request):
self.request = request
Now, it seems that there is nothing wrong with the authentication because if I remove permission='editAln' from the @view_config() decorator, my app does show return the username I used to log in.
I am absolutely puzzled by this. I could understand getting a 403 forbidden, but I just don't understand why I keep getting a 404 status code at all! I found this question that seems to be somewhat related, but as you can see I am not using the name attribute at all, so it didn't really help me. This is my first time using Pyramid and in my mind what I am trying to accomplish with my application (responding to XHR POST requests with JSON responses based on the username of the authenticated user) should not be that hard, so I am hoping that someone with slightly more Pyramid experience can help me understand this.