Sample:
@view_config(permission = 'view',route_name='addUser', renderer='json',
custom_predicates=(allowed_methods('POST'),))
def add(request):
post_data = request.json_body
email = post_data['email']
headers = remember(request, email, max_age='86400')
/* How to response this
On Mon, 2012-02-20 at 06:55 -0800, Zane wrote:
Sample:
@view_config(permission = 'view',route_name='addUser',
renderer='json', custom_predicates=(allowed_methods('POST'),))
def add(request):
post_data = request.json_body
email = post_data['email']
headers = remember(request,
Thanks @Chris
Yes.This is what I want, but now I receive a string {'succeed':True}, and
before I add header in response is a object {'succeed':True} ( I using
Ajax)
I guess this cause the view_config(renderer='json')
But How can I add header and return a Obj not a string.
Sorry~ I'm a
On Mon, 2012-02-20 at 07:34 -0800, Zane wrote:
Thanks @Chris
Yes.This is what I want, but now I receive a string
{'succeed':True}, and before I add header in response is a object
{'succeed':True} ( I using Ajax)
I guess this cause the view_config(renderer='json')
But How can I add header
Oh~ Excuse my English~
May be I know the reason of my fault,
I am using pyramid.security
from pyramid.security import authenticated_userid, remember, forget
@view_config(route_name='user', renderer='json')
..
headers = remember(request, email, max_age='86400')
It's work *:*)
Thank you @ yasaikun and Chris McDonough
--
You received this message because you are subscribed to the Google Groups
pylons-devel group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pylons-devel/-/_x-s9OJqdhYJ.
To post to this group, send email
No problem :)
Regards,
CL Chow
Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?8483
On Tue, Feb 21, 2012 at 12:16 AM, Zane yaoaz...@gmail.com wrote:
It's work *:*)
Thank you @ yasaikun and Chris McDonough
--
You received this message