How to pass arguments.

A
rguments are passed and received through URL as well as POST data. The URL arguments are located in req.url.arguments inside your display class as a list of strings. The POST data is located in req.form_data as a dictionary. Be careful when dealing with form_data. When you expect form_data['value'] to be None, you may find that form_data does not have an 'value' attribute at all! This is thanks to Apache, and we have to work with it. The Arguments Mixin handles both and helps parsing the arguments.

Most pages get their arguments through the URL.

Some pages which are called from search forms, want to get their arguments through POST data. The problem with this is that when the user clicks Back in his/her browser, the post data will get sent again. Secondly, the user cannot bookmark this page (or any page which was created as a result of a POST request). To handle both these problems, the page should check whether it got any arguments through POST data, and if so should bounce the request to itself, except that all the arguments are now in the URL. If we do this, then the browser only remembers the page the user was bounced to, and since it was not created by a POST, it can be book marked. If the user clicks Back, then the browser send a request for the URL which we bounced to, and so does not have to do another POST request. All this is automatically done by process_search_arguments provided by the Arguments Mixin class. So pages which can get its arguments through URL as well as POST data, should use the process_search_arguments instead of parse_arguments.

Action pages (pages which modify the database and bounce the user to another page) are called with both URL and POST data. Since they never get displayed anyway, we don't want process_search_arguments to do any bouncing before the action is actually done.

To summarize:

If the page always gets its arguments through the URL (no search page calling this page), then use parse_arguments.

If the page is searchable (some search page calls this page), then use process_search_arguments.

When you are writing code to implement actions, then you should be getting all the data which the user entered through POST data, and the other data (primary keys or data which identify which record to modify). You will see the POST data in display.form_fields and the other data in self.args (assuming you had a self.args=self.parse_arguments in your perform_action code).