Add support for auto importing dependecies
- No need to use: from .dependencies import * # NOQA Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
3.2.10 (2019-XX-XX)
|
||||||
|
===================
|
||||||
|
- Auto-import dependecies. No need to use:
|
||||||
|
from .dependencies import * # NOQA
|
||||||
|
|
||||||
|
|
||||||
3.2.9 (2019-11-03)
|
3.2.9 (2019-11-03)
|
||||||
==================
|
==================
|
||||||
- Move IMAPMockServer to its own module.
|
- Move IMAPMockServer to its own module.
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from mayan.apps.common.apps import MayanAppConfig
|
from mayan.apps.common.apps import MayanAppConfig
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
class AppearanceApp(MayanAppConfig):
|
class AppearanceApp(MayanAppConfig):
|
||||||
name = 'mayan.apps.appearance'
|
name = 'mayan.apps.appearance'
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from mayan.apps.common.apps import MayanAppConfig
|
from mayan.apps.common.apps import MayanAppConfig
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .handlers import handler_auto_admin_account_password_change
|
from .handlers import handler_auto_admin_account_password_change
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from mayan.apps.events.permissions import permission_events_view
|
|||||||
from mayan.apps.documents.search import document_page_search, document_search
|
from mayan.apps.documents.search import document_page_search, document_search
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .events import (
|
from .events import (
|
||||||
event_cabinet_edited, event_cabinet_add_document,
|
event_cabinet_edited, event_cabinet_add_document,
|
||||||
event_cabinet_remove_document
|
event_cabinet_remove_document
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from django.utils.module_loading import import_string
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from .classes import Template
|
from .classes import Template
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .handlers import (
|
from .handlers import (
|
||||||
handler_pre_initial_setup, handler_pre_upgrade,
|
handler_pre_initial_setup, handler_pre_upgrade,
|
||||||
handler_user_locale_profile_session_config, handler_user_locale_profile_create
|
handler_user_locale_profile_session_config, handler_user_locale_profile_create
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from mayan.apps.common.apps import MayanAppConfig
|
|||||||
from mayan.apps.common.menus import menu_object, menu_secondary
|
from mayan.apps.common.menus import menu_object, menu_secondary
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_transformation_create, link_transformation_delete,
|
link_transformation_create, link_transformation_delete,
|
||||||
link_transformation_edit
|
link_transformation_edit
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ from mayan.apps.common.html_widgets import TwoStateWidget
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import Dependency, DependencyGroup, DependencyGroupEntry
|
from .classes import Dependency, DependencyGroup, DependencyGroupEntry
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_check_version, link_dependency_group_entry_detail,
|
link_check_version, link_dependency_group_entry_detail,
|
||||||
link_dependency_group_entry_list, link_dependency_group_list,
|
link_dependency_group_entry_list, link_dependency_group_list,
|
||||||
@@ -29,6 +28,8 @@ class DependenciesApp(MayanAppConfig):
|
|||||||
def ready(self):
|
def ready(self):
|
||||||
super(DependenciesApp, self).ready()
|
super(DependenciesApp, self).ready()
|
||||||
|
|
||||||
|
Dependency.initialize()
|
||||||
|
|
||||||
SourceColumn(
|
SourceColumn(
|
||||||
attribute='get_label', label=_('Label'), order=-1, source=Dependency
|
attribute='get_label', label=_('Label'), order=-1, source=Dependency
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ from __future__ import print_function, unicode_literals
|
|||||||
|
|
||||||
import fileinput
|
import fileinput
|
||||||
import json
|
import json
|
||||||
|
from importlib import import_module
|
||||||
|
import logging
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -158,6 +160,18 @@ class DependencyGroupEntry(object):
|
|||||||
class Dependency(object):
|
class Dependency(object):
|
||||||
_registry = {}
|
_registry = {}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def initialize():
|
||||||
|
for app in apps.get_app_configs():
|
||||||
|
try:
|
||||||
|
import_module('{}.dependencies'.format(app.name))
|
||||||
|
except ImportError as exception:
|
||||||
|
if force_text(exception) not in ('No module named dependencies', 'No module named \'{}.dependencies\''.format(app.name)):
|
||||||
|
logger.error(
|
||||||
|
'Error importing %s dependencies.py file; %s', app.name,
|
||||||
|
exception
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def return_sorted(dependencies):
|
def return_sorted(dependencies):
|
||||||
return sorted(dependencies, key=lambda x: x.get_label())
|
return sorted(dependencies, key=lambda x: x.get_label())
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ from mayan.apps.common.menus import (
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import KeyStub
|
from .classes import KeyStub
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_key_delete, link_key_detail, link_key_download, link_key_query,
|
link_key_delete, link_key_detail, link_key_download, link_key_query,
|
||||||
link_key_receive, link_key_setup, link_key_upload, link_private_keys,
|
link_key_receive, link_key_setup, link_key_upload, link_private_keys,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from mayan.apps.documents.signals import post_version_upload
|
|||||||
from mayan.apps.events.classes import ModelEventType
|
from mayan.apps.events.classes import ModelEventType
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .events import (
|
from .events import (
|
||||||
event_parsing_document_content_deleted,
|
event_parsing_document_content_deleted,
|
||||||
event_parsing_document_version_submit,
|
event_parsing_document_version_submit,
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ from mayan.apps.navigation.classes import SourceColumn
|
|||||||
|
|
||||||
from .classes import DocumentStateHelper, WorkflowAction
|
from .classes import DocumentStateHelper, WorkflowAction
|
||||||
from .events import event_workflow_edited
|
from .events import event_workflow_edited
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .handlers import (
|
from .handlers import (
|
||||||
handler_index_document, handler_launch_workflow, handler_trigger_transition
|
handler_index_document, handler_launch_workflow, handler_trigger_transition
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ from mayan.apps.common.menus import (
|
|||||||
)
|
)
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .html_widgets import (
|
from .html_widgets import (
|
||||||
ObjectLinkWidget, widget_event_actor_link, widget_event_type_link
|
ObjectLinkWidget, widget_event_actor_link, widget_event_type_link
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from mayan.apps.events.classes import ModelEventType
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import FileMetadataHelper
|
from .classes import FileMetadataHelper
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .drivers import * # NOQA
|
from .drivers import * # NOQA
|
||||||
from .events import (
|
from .events import (
|
||||||
event_file_metadata_document_version_finish,
|
event_file_metadata_document_version_finish,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from mayan.apps.common.menus import menu_object, menu_secondary, menu_tools
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import StatisticLineChart, StatisticNamespace
|
from .classes import StatisticLineChart, StatisticNamespace
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_execute, link_namespace_details, link_namespace_list,
|
link_execute, link_namespace_details, link_namespace_list,
|
||||||
link_statistics, link_view
|
link_statistics, link_view
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ from mayan.apps.events.permissions import permission_events_view
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import DocumentMetadataHelper
|
from .classes import DocumentMetadataHelper
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .events import (
|
from .events import (
|
||||||
event_document_metadata_added, event_document_metadata_edited,
|
event_document_metadata_added, event_document_metadata_edited,
|
||||||
event_document_metadata_removed, event_metadata_type_edited,
|
event_document_metadata_removed, event_metadata_type_edited,
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from mayan.apps.common.apps import MayanAppConfig
|
from mayan.apps.common.apps import MayanAppConfig
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
class MIMETypesApp(MayanAppConfig):
|
class MIMETypesApp(MayanAppConfig):
|
||||||
name = 'mayan.apps.mimetype'
|
name = 'mayan.apps.mimetype'
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from mayan.apps.common.apps import MayanAppConfig
|
from mayan.apps.common.apps import MayanAppConfig
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .handlers import handler_document_cache_delete, handler_node_cache_delete
|
from .handlers import handler_document_cache_delete, handler_node_cache_delete
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from mayan.apps.documents.signals import post_version_upload
|
|||||||
from mayan.apps.events.classes import ModelEventType
|
from mayan.apps.events.classes import ModelEventType
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .events import (
|
from .events import (
|
||||||
event_ocr_document_content_deleted, event_ocr_document_version_finish,
|
event_ocr_document_content_deleted, event_ocr_document_version_finish,
|
||||||
event_ocr_document_version_submit
|
event_ocr_document_version_submit
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from mayan.apps.common.apps import MayanAppConfig
|
from mayan.apps.common.apps import MayanAppConfig
|
||||||
from mayan.apps.common.menus import menu_tools
|
from mayan.apps.common.menus import menu_tools
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_api, link_api_documentation, link_api_documentation_redoc
|
link_api, link_api_documentation, link_api_documentation_redoc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ from mayan.apps.documents.signals import post_version_upload
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import StagingFile
|
from .classes import StagingFile
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .handlers import (
|
from .handlers import (
|
||||||
handler_copy_transformations_to_version, handler_create_default_document_source,
|
handler_copy_transformations_to_version, handler_create_default_document_source,
|
||||||
handler_initialize_periodic_tasks
|
handler_initialize_periodic_tasks
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from mayan.apps.events.links import (
|
|||||||
from mayan.apps.events.permissions import permission_events_view
|
from mayan.apps.events.permissions import permission_events_view
|
||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .events import (
|
from .events import (
|
||||||
event_tag_attach, event_tag_edited, event_tag_remove
|
event_tag_attach, event_tag_edited, event_tag_remove
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ from mayan.apps.common.menus import menu_object, menu_secondary, menu_tools
|
|||||||
from mayan.apps.navigation.classes import SourceColumn
|
from mayan.apps.navigation.classes import SourceColumn
|
||||||
|
|
||||||
from .classes import CeleryQueue, Task
|
from .classes import CeleryQueue, Task
|
||||||
from .dependencies import * # NOQA
|
|
||||||
from .links import (
|
from .links import (
|
||||||
link_queue_list, link_queue_active_task_list,
|
link_queue_list, link_queue_active_task_list,
|
||||||
link_queue_scheduled_task_list, link_queue_reserved_task_list,
|
link_queue_scheduled_task_list, link_queue_reserved_task_list,
|
||||||
link_task_manager
|
link_task_manager
|
||||||
)
|
)
|
||||||
|
from .links import link_task_manager
|
||||||
|
|
||||||
|
|
||||||
class TaskManagerApp(MayanAppConfig):
|
class TaskManagerApp(MayanAppConfig):
|
||||||
|
|||||||
Reference in New Issue
Block a user