This question has been flagged
1 Reply
5943 Views

Hi any body explain this  @http.route usage in below code 

@http.route('/hello/world', auth='public')('/hello/world', auth='public')
    def test_con(self):

return "Hello World"

Avatar
Discard
Best Answer

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.
Avatar
Discard
Author

Thanks Dhinesh....