A component is defined as the functional a part of an internet web page, which goes autonomously. it can be composed of modules, controllers, and perspectives, which are embedded in a web page. The issue in a utility must be localized tag and the overall performance is taken into consideration to be unbiased of the module.
In web2py, the principle consciousness is on using components which can be loaded in the page and which communicate with the aspect controller via AJAX.
don't forget an easy internet software namely “check” that extends the web2py utility with the custom version in document “fashions/db_comments.py”.
The above code will create a table “comment_post” with the proper table definition. The action will be implemented with the help of functions in “controllers/comments.py”.
The corresponding view will be displayed as −
The page can be accessed using the given URL − http://127.0.0.1:8000/test/comments/post
The method mentioned above is a traditional way of accessing a view, which can be changed with the implementation of the LOAD function.
This can be achieved by creating a new view with the extension ".load" that does not extend the layout.
The new view created would be "views/comments/post.load" −
The URL to access the page would be − http://127.0.0.1:8000/test/comments/post.load
The LOAD component can be embedded into any other page of web2py application. This can be done by using the following statement.
For example, the Controllers can be edited as −
In View, we can add the component −
The page can be accessed with the URL − http://127.0.0.1:8000/test/default/index
Component plugins are the plugins, which uniquely define Components. Components access the database directly with their model definition.
As mentioned in the previous example, comments component into a comments_plugin can be done in the Models section −
The Controller will include the following plugin −
Web2Py Related Interview Questions
|Python Interview Questions||MySQL Interview Questions|
|Oracle 11g Interview Questions||PostgreSQL Interview Questions|
|SQL DBA Interview Questions||SQL Interview Questions|
|Database Testing Interview Questions||Django Interview Questions|
|Database Administration Interview Questions||Git (software) Interview Questions|
|Data analyst Interview Questions||CouchDB Interview Questions|
|wxPython Interview Questions||MongoDB Interview Questions|
|Advanced Linux Interview Questions||Python Automation Testing Interview Questions|
|RabbitMQ Interview Questions|
Web2Py Related Practice Tests
|Python Practice Tests||MySQL Practice Tests|
|Oracle 11g Practice Tests||PostgreSQL Practice Tests|
|SQL DBA Practice Tests||SQL Practice Tests|
|Database Testing Practice Tests||Django Practice Tests|
|Database Administration Practice Tests||Git (software) Practice Tests|
|MongoDB Practice Tests|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.