Add header parameters in HTTPFound?

55 views
Skip to first unread message

QLands Software

unread,
Jan 12, 2015, 10:08:08 AM1/12/15
to pylons-...@googlegroups.com
Hi,

I have an application where I have a view called "Feeds" as this:

@view_config(route_name='feeds', renderer='templates/feeds/list_feeds.html')
def feeds_view(request):

   
print "**************"
   
for key in request.headers.keys():
       
print key
   
print "**************"


    commonCSS
.need()
    commonJS
.need()
    siteScript
.need()
    dataTables
.need()
    login
= authenticated_userid(request)
    user
= USERS.get(login)
   
if (user == None):
       
return HTTPFound(location=request.route_url('login'))
   
else:
       
return {'activeUser': user,'publicFeeds':loadPublicFeeds(user.login),'privateFeeds':loadPrivateFeeds(user.login)}



In a different view I use HTTPFound to as redirect to "feeds" but I am passing an extra value in the headers:

headers = {"Authorization": "864a2de6-074a-4fd7-a24e-48400183869e"}
return HTTPFound(location=request.route_url('feeds'),headers=headers)



However the "feeds" view does not seem to get it. What am I doing wrong?




Chris Rossi

unread,
Jan 12, 2015, 11:25:32 AM1/12/15
to pylons-...@googlegroups.com
Your problem is in misunderstanding HTTP.  Sending an 'Authorize' header in a response, will not cause the client to resend that Authorize header in a later request.  It just doesn't actually work that way.  Pyramid is happy to let you send the Authorize header, it is not actually a valid HTTP header for the response.  

Maybe you want a cookie instead.

Chris

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

QLands Software

unread,
Jan 25, 2015, 12:13:04 PM1/25/15
to pylons-...@googlegroups.com, ch...@archimedeanco.com
Ok. Got it. I implemented it with a cookie. Thanks
Reply all
Reply to author
Forward
0 new messages