Try this

@view_config(route_name='user', renderer='json')
def user(request):
  headers = remember(request, email)
  request._response_headerlist_set(headers)
  return {'foo':'bar'}

Good luck.

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:05 AM, Zane <yaoaz...@gmail.com> wrote:

> 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')
>
>      request.response.headers = headers
>      # It would lost the Content-Type:application/json here
>      # so when I add header like this way, it will return a string.
>     return {'succeed':True}
>
> And before I replace the header, the render='json' will help me to add
> the Content-Type.
>
> Thanks
> Zane
>
>
>
>  --
> 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/-/8pnmgKfyTVoJ.
>
> To post to this group, send email to pylons-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-devel?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to