Add a module for creating and managing integrations with other services.
Review Request #7947 — Created Feb. 6, 2016 and submitted
Modern web applications often need to integrate with other services, such as chat services. Each generally needs to be able to support any number of user-provided configurations, efficiently. This change adds a framework for more easily producing these integrations. Consuming applications just need to set up some classes and URLs, and will then be able to define integrations or, if they support extensions, will allow others to define integrations. A single integration can have any number of configurations, which applications can choose to bind to users, organizations, or anything else they choose. Configurations can be enabled or disabled, can have a name, and can have arbitrary settings configured. Integrations are instantiated when registered, but their logic and state are only initialized once there's one or more enabled configurations in the database for that integration. This allows a large number of integrations to be registered, without them having to take up any processing time unless used. An integration will generally listen to signals or other events, and may want to register into parts of the application. This overlaps a great deal with the needs of extensions, and so they've been written to be hook owners, allowing the user of ExtensionHooks. Like an extension, these hooks are bound to the lifecycle of an integration instance. There are built-in views available for listing all integrations (and their configurations), and creating/editing/deleting configurations. These can be used in the administration UI, or in other pages, depending on the needs of the application. To facilitate this, there are base classes for the views and there are administration-specific subclasses. Djblets just provides the foundation for integrations. Consuming applications are expected to subclass some of the classes to provide additional information, such as an instance of an IntegrationManager or additional configuration data.
Unit tests pass.
Modified rbslack to use integrations, and tested that they work.
Verified manually that integrations are only enabled when there are
enabled configurations, and that this state is recomputed properly when
enabling/disabling/creating/deleting integrations.Read through the docs and checked links.
Description | From | Last Updated |
---|---|---|
local variable 'config3' is assigned to but never used |
reviewbot | |
local variable 'config4' is assigned to but never used |
reviewbot | |
local variable 'config2' is assigned to but never used |
reviewbot | |
local variable 'config3' is assigned to but never used |
reviewbot | |
local variable 'config4' is assigned to but never used |
reviewbot | |
Col: 5 E303 too many blank lines (2) |
reviewbot | |
local variable 'config3' is assigned to but never used |
reviewbot | |
local variable 'config1' is assigned to but never used |
reviewbot | |
local variable 'config3' is assigned to but never used |
reviewbot | |
local variable 'manager1' is assigned to but never used |
reviewbot | |
local variable 'manager2' is assigned to but never used |
reviewbot | |
For @property, don't we write the docstring as more of an attribute form than a method form? |
david | |
Maybe use logging.exception instead of formatting in e? |
david | |
Same here. |
david | |
I think it would be better to say "An example would be when..." rather than "This is useful, for instance, … |
david | |
", though," doesn't add anything. |
david | |
Is this the best order to tear things down? It seems like it should be in the reverse order from … |
david | |
You don't need to format in e when using logging.exception. |
david | |
Shouldn't this link to #? |
david | |
Can we translate the string with {% trans %} instead of gettext()? |
david | |
Doesn't dispatch return a response? |
david | |
Same here. |
david | |
And here. |
david | |
Should this use self.get_config? |
david | |
Missing "Returns:" |
david | |
And here. |
david | |
This file needs unicode_literals |
david | |
This returns a response, not a request. |
david | |
Still missing unicode_literals. Did you forget to git add? |
david |
- Change Summary:
-
- Split the GenerationSynchronizer changes and docs into other review requests.
- Fixed unused variables in the unit tests.
- Description:
-
Modern web applications often need to integrate with other services,
such as chat services. Each generally needs to be able to support any number of user-provided configurations, efficiently. This change adds a framework for more easily producing these
integrations. Consuming applications just need to set up some classes and URLs, and will then be able to define integrations or, if they support extensions, will allow others to define integrations. A single integration can have any number of configurations, which
applications can choose to bind to users, organizations, or anything else they choose. Configurations can be enabled or disabled, can have a name, and can have arbitrary settings configured. Integrations are instantiated when registered, but their logic and state
are only initialized once there's one or more enabled configurations in the database for that integration. This allows a large number of integrations to be registered, without them having to take up any processing time unless used. An integration will generally listen to signals or other events, and may
want to register into parts of the application. This overlaps a great deal with the needs of extensions, and so they've been written to be hook owners, allowing the user of ExtensionHooks. Like an extension, these hooks are bound to the lifecycle of an integration instance. There are built-in views available for listing all integrations (and
their configurations), and creating/editing/deleting configurations. These can be used in the administration UI, or in other pages, depending on the needs of the application. To facilitate this, there are base classes for the views and there are administration-specific subclasses. Djblets just provides the foundation for integrations. Consuming
applications are expected to subclass some of the classes to provide additional information, such as an instance of an IntegrationManager or additional configuration data. - - Documentation has been written on both consuming the integrations
- framework and writing integrations.
-
Tool: PEP8 Style Checker Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/settings.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py Tool: Pyflakes Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/settings.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py
- Change Summary:
-
- Fixed some docstrings.
- Moved to
logging.exception
when sandboxing errors inBaseIntegrationsHook
. - Removed
BaseIntegrationConfigFormView.get_config()
. - Added keyword arguments to
BaseIntegrationConfigFormView.get_config_query_kwargs
. - Fixed the Delete link for integrations to use
<a href="#">
.
-
Tool: Pyflakes Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/settings.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py Tool: PEP8 Style Checker Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/settings.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py
-
Tool: Pyflakes Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/staticbundles.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py Tool: PEP8 Style Checker Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/staticbundles.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py
-
Tool: Pyflakes Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/staticbundles.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py
-
Tool: PEP8 Style Checker Processed Files: djblets/integrations/__init__.py djblets/integrations/tests/testcases.py djblets/integrations/errors.py djblets/integrations/tests/test_models.py djblets/integrations/hooks.py djblets/integrations/mixins.py djblets/integrations/views.py djblets/integrations/urls.py djblets/integrations/models.py djblets/integrations/forms.py djblets/integrations/middleware.py djblets/integrations/integration.py djblets/integrations/manager.py djblets/integrations/tests/test_integration.py djblets/integrations/app.py djblets/integrations/tests/test_manager.py djblets/integrations/tests/test_hooks.py djblets/integrations/tests/models.py djblets/staticbundles.py Ignored Files: djblets/integrations/templates/integrations/integration_list.html djblets/static/djblets/css/integrations.less djblets/integrations/templates/integrations/configure_integration.html djblets/integrations/tests/__init__.py