Add suppor 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:
@@ -129,6 +129,8 @@
|
||||
now get the permission inheritance from their base models.
|
||||
- Update common.http.URL to allow passing a query dictionary.
|
||||
- Add the document template sandbox feature.
|
||||
- Auto-import dependecies. No need to use:
|
||||
from .dependencies import * # NOQA
|
||||
|
||||
3.2.9 (2019-11-03)
|
||||
==================
|
||||
|
||||
@@ -4,8 +4,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.apps import MayanAppConfig
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
|
||||
|
||||
class AppearanceApp(MayanAppConfig):
|
||||
name = 'mayan.apps.appearance'
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.apps import MayanAppConfig
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
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.navigation.classes import SourceColumn
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .events import (
|
||||
event_cabinet_edited, event_cabinet_add_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 .classes import Template
|
||||
from .dependencies import * # NOQA
|
||||
from .handlers import (
|
||||
handler_pre_initial_setup, handler_pre_upgrade,
|
||||
handler_user_locale_profile_session_config, handler_user_locale_profile_create
|
||||
|
||||
@@ -8,7 +8,6 @@ from mayan.apps.common.apps import MayanAppConfig
|
||||
from mayan.apps.common.menus import menu_object, menu_secondary
|
||||
from mayan.apps.navigation.classes import SourceColumn
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .links import (
|
||||
link_transformation_delete, link_transformation_edit,
|
||||
link_transformation_select
|
||||
|
||||
@@ -10,7 +10,6 @@ from mayan.apps.common.html_widgets import TwoStateWidget
|
||||
from mayan.apps.navigation.classes import SourceColumn
|
||||
|
||||
from .classes import Dependency, DependencyGroup, DependencyGroupEntry
|
||||
from .dependencies import * # NOQA
|
||||
from .links import (
|
||||
link_check_version, link_dependency_group_entry_detail,
|
||||
link_dependency_group_entry_list, link_dependency_group_list,
|
||||
@@ -29,6 +28,8 @@ class DependenciesApp(MayanAppConfig):
|
||||
def ready(self):
|
||||
super(DependenciesApp, self).ready()
|
||||
|
||||
Dependency.initialize()
|
||||
|
||||
SourceColumn(
|
||||
attribute='get_label', label=_('Label'), order=-1, source=Dependency
|
||||
)
|
||||
|
||||
@@ -2,6 +2,8 @@ from __future__ import print_function, unicode_literals
|
||||
|
||||
import fileinput
|
||||
import json
|
||||
from importlib import import_module
|
||||
import logging
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import sys
|
||||
@@ -158,6 +160,18 @@ class DependencyGroupEntry(object):
|
||||
class Dependency(object):
|
||||
_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
|
||||
def return_sorted(dependencies):
|
||||
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 .classes import KeyStub
|
||||
from .dependencies import * # NOQA
|
||||
from .links import (
|
||||
link_key_delete, link_key_detail, link_key_download, link_key_query,
|
||||
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.navigation.classes import SourceColumn
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .events import (
|
||||
event_parsing_document_content_deleted,
|
||||
event_parsing_document_version_submit,
|
||||
|
||||
@@ -23,7 +23,6 @@ from mayan.apps.navigation.classes import SourceColumn
|
||||
|
||||
from .classes import DocumentStateHelper, WorkflowAction
|
||||
from .events import event_workflow_edited
|
||||
from .dependencies import * # NOQA
|
||||
from .handlers import (
|
||||
handler_create_workflow_image_cache, 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 .dependencies import * # NOQA
|
||||
from .html_widgets import (
|
||||
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 .classes import FileMetadataHelper
|
||||
from .dependencies import * # NOQA
|
||||
from .drivers import * # NOQA
|
||||
from .events import (
|
||||
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 .classes import StatisticLineChart, StatisticNamespace
|
||||
from .dependencies import * # NOQA
|
||||
from .links import (
|
||||
link_execute, link_namespace_details, link_namespace_list,
|
||||
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 .classes import DocumentMetadataHelper
|
||||
from .dependencies import * # NOQA
|
||||
from .events import (
|
||||
event_document_metadata_added, event_document_metadata_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 .dependencies import * # NOQA
|
||||
|
||||
|
||||
class MIMETypesApp(MayanAppConfig):
|
||||
name = 'mayan.apps.mimetype'
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.common.apps import MayanAppConfig
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
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.navigation.classes import SourceColumn
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .events import (
|
||||
event_ocr_document_content_deleted, event_ocr_document_version_finish,
|
||||
event_ocr_document_version_submit
|
||||
|
||||
@@ -9,7 +9,6 @@ from mayan.apps.common.apps import MayanAppConfig
|
||||
from mayan.apps.converter.links import link_transformation_list
|
||||
from mayan.apps.common.menus import menu_list_facet
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .layers import layer_redactions
|
||||
from .transformations import * # NOQA
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from mayan.apps.common.apps import MayanAppConfig
|
||||
from mayan.apps.common.menus import menu_tools
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .links import (
|
||||
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 .classes import StagingFile
|
||||
from .dependencies import * # NOQA
|
||||
from .handlers import (
|
||||
handler_copy_transformations_to_version,
|
||||
handler_create_default_document_source, 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.navigation.classes import SourceColumn
|
||||
|
||||
from .dependencies import * # NOQA
|
||||
from .events import (
|
||||
event_tag_attach, event_tag_edited, event_tag_remove
|
||||
)
|
||||
|
||||
@@ -8,7 +8,6 @@ from mayan.apps.common.menus import menu_tools
|
||||
from mayan.apps.navigation.classes import SourceColumn
|
||||
|
||||
from .classes import CeleryQueue, Task
|
||||
from .dependencies import * # NOQA
|
||||
from .links import link_task_manager
|
||||
from .settings import * # NOQA
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
# Don't import anything on start import, we just want to make it easy
|
||||
# Don't import anything on star import, we just want to make it easy
|
||||
# for apps.py to activate the settings in this module.
|
||||
__all__ = ()
|
||||
namespace = Namespace(label=_('Celery'), name='celery')
|
||||
|
||||
Reference in New Issue
Block a user