djblets.extensions.resources¶
-
class
ExtensionResource
(extension_manager)[source]¶ Bases:
djblets.webapi.resources.base.WebAPIResource
Provides information on installed extensions.
-
fields
= {u'author': {u'description': u'The author of the extension.', u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'author_url': {u'description': u"The author's website.", u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'can_disable': {u'description': u'Whether or not the extension can be disabled.', u'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, u'can_enable': {u'description': u'Whether or not the extension can be enabled.', u'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, u'class_name': {u'description': u'The class name for the extension.', u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'enabled': {u'description': u'Whether or not the extension is enabled.', u'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, u'installed': {u'description': u'Whether or not the extension is installed.', u'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, u'load_error': {u'description': u'If the extension could not be loaded, this will contain any errors captured while trying to load.', u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'loadable': {u'description': u'Whether or not the extension is currently loadable. An extension may be installed but missing or may be broken due to a bug.', u'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, u'name': {u'description': u'The name of the extension.', u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'summary': {u'description': u"A summary of the extension's functionality.", u'type': <class 'djblets.webapi.fields.StringFieldType'>}, u'version': {u'description': u'The installed version of the extension.', u'type': <class 'djblets.webapi.fields.StringFieldType'>}}[source]¶
-
get_list
(**kwargs)[source]¶ Returns the list of known extensions.
Each extension in the list has been installed, but may not be enabled.
-
update
(**kwargs)[source]¶ Updates the state of the extension.
If
enabled
is true, then the extension will be enabled, if it is not already. If false, it will be disabled.
Returns links to the resources provided by the extension.
The result should be a dictionary of link names to a dictionary of information. The information should contain:
- ‘method’ - The HTTP method
- ‘href’ - The URL
- ‘title’ - The title of the link (optional)
- ‘resource’ - The WebAPIResource instance
- ‘list-resource’ - True if this links to a list resource (optional)
-
-
class
ExtensionRootResourceMixin
(*args, **kwargs)[source]¶ Bases:
object
Mixin for Root Resources making use of Extension Resources.
As extensions are able to provide their own API resources, this mixin allows a root resource to generate URI templates for non built-in resources.
See also
-
__init__
(*args, **kwargs)[source]¶ Initialize the extension resource mixin to listen for changes.
Parameters:
-
get_extension_resource
()[source]¶ Return the associated extension resource.
Subclasses using this mixin must implement this method.
Returns: The extension resource associated with the root resource. Return type: djblets.extensions.resources.ExtensionResource
-