mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
remove legacy action
This commit is contained in:
parent
19cfa540d9
commit
05839ca94c
@ -3,16 +3,12 @@ Utility file to enable simper imports
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .registry import registry
|
from .registry import registry
|
||||||
|
|
||||||
from .plugin import InvenTreePluginBase, IntegrationPluginBase
|
from .plugin import InvenTreePluginBase, IntegrationPluginBase
|
||||||
from .base.action.action import ActionPlugin
|
|
||||||
|
|
||||||
from .helpers import MixinNotImplementedError, MixinImplementationError
|
from .helpers import MixinNotImplementedError, MixinImplementationError
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'registry',
|
'registry',
|
||||||
|
|
||||||
'ActionPlugin',
|
|
||||||
'IntegrationPluginBase',
|
'IntegrationPluginBase',
|
||||||
'InvenTreePluginBase',
|
'InvenTreePluginBase',
|
||||||
'MixinNotImplementedError',
|
'MixinNotImplementedError',
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""Class for ActionPlugin"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
from plugin.base.action.mixins import ActionMixin
|
|
||||||
import plugin.plugin
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger("inventree")
|
|
||||||
|
|
||||||
|
|
||||||
class ActionPlugin(ActionMixin, plugin.plugin.IntegrationPluginBase):
|
|
||||||
"""
|
|
||||||
Legacy action definition - will be replaced
|
|
||||||
Please use the new Integration Plugin API and the Action mixin
|
|
||||||
"""
|
|
||||||
# TODO @matmair remove this with InvenTree 0.7.0
|
|
||||||
def __init__(self, user=None, data=None):
|
|
||||||
warnings.warn("using the ActionPlugin is depreceated", DeprecationWarning)
|
|
||||||
super().__init__()
|
|
||||||
self.init(user, data)
|
|
@ -2,32 +2,35 @@
|
|||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from plugin.base.action.action import ActionPlugin
|
from plugin import IntegrationPluginBase
|
||||||
|
from plugin.mixins import ActionMixin
|
||||||
|
|
||||||
|
|
||||||
class ActionPluginTests(TestCase):
|
class ActionMixinTests(TestCase):
|
||||||
""" Tests for ActionPlugin """
|
""" Tests for ActionMixin """
|
||||||
ACTION_RETURN = 'a action was performed'
|
ACTION_RETURN = 'a action was performed'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.plugin = ActionPlugin('user')
|
class SimplePlugin(ActionMixin, IntegrationPluginBase):
|
||||||
|
pass
|
||||||
|
self.plugin = SimplePlugin('user')
|
||||||
|
|
||||||
class TestActionPlugin(ActionPlugin):
|
class TestActionPlugin(ActionMixin, IntegrationPluginBase):
|
||||||
"""a action plugin"""
|
"""a action plugin"""
|
||||||
ACTION_NAME = 'abc123'
|
ACTION_NAME = 'abc123'
|
||||||
|
|
||||||
def perform_action(self):
|
def perform_action(self):
|
||||||
return ActionPluginTests.ACTION_RETURN + 'action'
|
return ActionMixinTests.ACTION_RETURN + 'action'
|
||||||
|
|
||||||
def get_result(self):
|
def get_result(self):
|
||||||
return ActionPluginTests.ACTION_RETURN + 'result'
|
return ActionMixinTests.ACTION_RETURN + 'result'
|
||||||
|
|
||||||
def get_info(self):
|
def get_info(self):
|
||||||
return ActionPluginTests.ACTION_RETURN + 'info'
|
return ActionMixinTests.ACTION_RETURN + 'info'
|
||||||
|
|
||||||
self.action_plugin = TestActionPlugin('user')
|
self.action_plugin = TestActionPlugin('user')
|
||||||
|
|
||||||
class NameActionPlugin(ActionPlugin):
|
class NameActionPlugin(ActionMixin, IntegrationPluginBase):
|
||||||
PLUGIN_NAME = 'Aplugin'
|
PLUGIN_NAME = 'Aplugin'
|
||||||
|
|
||||||
self.action_name = NameActionPlugin('user')
|
self.action_name = NameActionPlugin('user')
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""sample implementation for ActionPlugin"""
|
"""sample implementation for ActionMixin"""
|
||||||
from plugin.base.action.action import ActionPlugin
|
from plugin import IntegrationPluginBase
|
||||||
|
from plugin.mixins import ActionMixin
|
||||||
|
|
||||||
|
|
||||||
class SimpleActionPlugin(ActionPlugin):
|
class SimpleActionPlugin(ActionMixin, IntegrationPluginBase):
|
||||||
"""
|
"""
|
||||||
An EXTREMELY simple action plugin which demonstrates
|
An EXTREMELY simple action plugin which demonstrates
|
||||||
the capability of the ActionPlugin class
|
the capability of the ActionMixin class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PLUGIN_NAME = "SimpleActionPlugin"
|
PLUGIN_NAME = "SimpleActionPlugin"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user