There's more...

Defining parameters within the path is a functionality delivered by werkzeug, called converters. The model converter is added by Odoo, which also defines the converter models that accept a comma-separated list of IDs and pass a recordset containing those IDs to your handler.

The beauty of converters is that the runtime coerces parameters to the expected type, while you're on your own with normal keyword parameters. These are delivered as strings, and you have to take care of the necessary type conversions yourself, as seen in the first example.

Built-in werkzeug converters include int, float, and string, but also more intricate, ones such as path, any, or uuid. You can look up their semantics at http://werkzeug.pocoo.org/docs/0.11/routing/#builtin-converters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset