PylonsHQ.

Layout: Fixed-width

Label: controllers-faq

Content with label controllers-faq in Pylons FAQ (See content from all spaces)
There are no related labels.

How do I allow an optional slash at the end of the URL?
Question How do I allow an optional slash at the end of the URL? Answer In your config/routing.py add this map.redirect('/(url)/', '/ ', redirectcode='301 Moved Permanently') before the final {{return map}} statement. The Pylons Cookbook has a similar ...
How do I get at the raw body of an HTTP POST?
Question How do I get at the raw body of an HTTP POST? I can't use {{request.POST}} because my HTTP POST wasn't submitted by a form. Answer The {{request.POST}} method provides convenient, dictlike access to the params of an ...
How do I get full path of the current url, including any query parameters?
Q: How do I get full path of the current url, including any query parameters? A: Use constructurl function from paste.request http://pythonpaste.org/modulepaste.request.html. OR If you are only concerned with the url and not the protocol://host:port , you can ...
How do I make all actions in a controller require a user to be authenticated? (Authkit)
Question How do I make all actions in a controller require a user to be authenticated? (Authkit) Answer At the end of your controller add this line: MyController = authkit.authorize.middleware(MyController(), authkit.permissions.RemoteUser()) If the user is not logged in yet then calling any action in this controller will make ...
Streaming Content to the Browser
Question How do I stream content to the browser? Answer First, turn off debug mode in your ini file, or copy your development.ini file and uncomment the line: #set debug = false When debug mode is on, streaming can't ...
Why do redirect_to and abort raise exceptions, instead of returning a Response?
Redirects and aborts are typically operations that should occur immediately, preventing anything else from executing in your controller's calling functions. Thus the redirectto and abort functions raise exceptions (of base class paste.httpexceptions.HTTPException). These exceptions are caught by the httpexceptions middleware towards ...

Powered by Pylons - Contact Administrators