Hi any body explain this @http.route usage in below code
@http.route('/hello/world', auth='public')('/hello/world', auth='public')
return "Hello World"
It is called web controller. Decorator marking the decorated method as being a handler for requests. The method must be part of a subclass of Controller.
If you enter localhost:8070/web/hello/world, it will print "Hello world" in your browser. This is responsible to decide which page is shown in which url. The parament auth is for authentication purpose. Is this page is shown for all or only logged in user only can view it. For more...
The type of authentication method, can be one of the following:
- user: The user must be authenticated and the current request will perform using the rights of the user.
- admin: The user may not be authenticated and the current request will perform using the admin user.
- none: The method is always active, even if there is no database. Mainly used by the framework and authentication modules. There request code will not have any facilities to access the database nor have any configuration indicating the current database nor the current user.
- public: public authentication, not login required.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 2/10/15, 2:49 AM|
|Seen: 889 times|
|Last updated: 3/16/15, 8:10 AM|