XD-DENG edited a comment on issue #4376: [AIRFLOW-XXX] Fix/complete example 
code in plugins.rst
URL: https://github.com/apache/airflow/pull/4376#issuecomment-453712511
 
 
   **Notes of the local tests I have done (commits will be updated later):**
   1. For the plugin view for RBAC, `default_view` in the class MUST be 
specified, and it should be the name of the method user creates inside the 
class. Otherwise there will be error when we try to open the UI (default 
`default_view` is `list`):
   
   ```
   werkzeug.routing.BuildError: Could not build url for endpoint 
'thisisatest.list'. Did you mean 'thisisatest.test' instead?
   ```
   
   2. The URL to be exposed is decided by the plugin class name. Let's say the 
plugin class (for RBAC) is:
   
   ```python
   class TestAppBuilderBaseView(AppBuilderBaseView):
       ......
   ```
   the plugin view will be exposed with URL 
https://<airflow_host>/testappbuilderbaseview`
   
   3. The example plugin in 
https://github.com/apache/airflow/blob/master/tests/plugins/test_plugin.py is 
actually partially wrong. `flask_appbuilder.BaseView` (imported as 
`AppBuilderBaseView`) doesn't have attribute `'render'` at all. I tried to run 
it but got exception `AttributeError: 'TestAppBuilderBaseView' object has no 
attribute 'render'`. It should be `render_template` instead, but where the html 
templates should be put seems different and needs to be figured out.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to