staugur / Flask-PluginKit

Web program plugin development kit based on Flask.

Home Page:https://flask-pluginkit.rtfd.vip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR: Add Plugin inheritance

halali opened this issue · comments

Hi,

I know is it maybe big change but it will help me a lot.

I need to add possibility add some endpoints to existing plugin without need to modify it...

Example:
i have plugin for HR like list of employe
and i want extend this plugin by another plugin with require HR plugin to be installed.

Thank you

For my use case for now i need to make nested navigation menu in template...

After i need to check how this will work with sqlalchemy models

Is there any sample code to realize the function?

In addition, I just noticed the title of this issue, which gave me inspiration, not only to implement the description function I answered for the first time, but to directly extend the function of a plug-in or any plug-in, that is, update the return value of the register function.

sorry i get lost...

for start i need extend existing menu in template created by plugin by another plugin...

I see that in open source project odoo

I am in China, and there is a time difference.

I will implement a function first, located in the branch feat/issue4, after completion, you can try to see if it meets your requirements.

Sorry, it's a bit late.

You can try to install the code of this branch:

pip install -U git+https://github.com/staugur/Flask-PluginKit.git@feat/issue4

Usage, in the register method of your plug-in:

def update(the_plugin_tcp_data):
    # your code: operate `the_plugin_tcp_data` and the return type must be consistent.
    return the_plugin_tcp_data

def register():
    # p3 format: { "Target plugin_name": {"pet": "pet_processing_function"} }
    # eg.
    return dict(p3=dict(a_plugin_name=dict(tcp=update)))

Hi i just test what did you made...

I think you can close this issue, i will thinking about how i can implement this for my use case.

Thank you