简体   繁体   中英

How do you get a request variable using the python albatross framework

I have inherited a python project, and I admit that I am a noob on this, but the project is done using the albatross framework. I have added two fields to a form: "password" and "random". I now need to know how to retrieve those form fields on the back end. In php it would be the following:

$password = $_REQUEST['password'];
$random = $_REQUEST['random'];

I have been searching for information about how to do this, using the albatross framework, and have had trouble finding anything that works in the platform I have inherited. This is in apache 2.6, using mod_python, and relying on the RequestFields functionality in albatross.cgiapp.

Does anybody know how to do this, quick-and-dirty, or via a decent tutorial, that is specific to the framework that I am using? The albatross documentation doesn't seem to tell how to get data from form fields, and digging through the source code doesn't seem to be turning up much.

Thank you for any help you can give.

Have you read the section on using forms in the manual? This explains things pretty well.

import cgi
form = cgi.FieldStorage()

Now form should contain a dictionary with all your form data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM