Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

-1

What is the use of @http.route('/hello/world', auth='public') from web site module

By
Odoo
on 2/10/15, 2:49 AM 1,080 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"

3

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 2/10/15, 5:09 AM

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.

Thanks Dhinesh....

Odoo
on 2/10/15, 5:20 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/10/15, 2:49 AM
Seen: 1080 times
Last updated: 3/16/15, 8:10 AM