Jump to >

djblets.extensions.resources

class ExtensionResource(extension_manager)[source]

Bases: djblets.webapi.resources.base.WebAPIResource

Provides information on installed extensions.

model[source]

alias of djblets.extensions.models.RegisteredExtension

fields = {u'author': {u'type': <type 'str'>, u'description': u'The author of the extension.'}, u'author_url': {u'type': <type 'str'>, u'description': u"The author's website."}, u'can_disable': {u'type': <type 'bool'>, u'description': u'Whether or not the extension can be disabled.'}, u'can_enable': {u'type': <type 'bool'>, u'description': u'Whether or not the extension can be enabled.'}, u'class_name': {u'type': <type 'str'>, u'description': u'The class name for the extension.'}, u'enabled': {u'type': <type 'bool'>, u'description': u'Whether or not the extension is enabled.'}, u'installed': {u'type': <type 'bool'>, u'description': u'Whether or not the extension is installed.'}, u'load_error': {u'type': <type 'str'>, u'description': u'If the extension could not be loaded, this will contain any errors captured while trying to load.'}, u'loadable': {u'type': <type 'bool'>, 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'name': {u'type': <type 'str'>, u'description': u'The name of the extension.'}, u'summary': {u'type': <type 'str'>, u'description': u"A summary of the extension's functionality."}, u'version': {u'type': <type 'str'>, u'description': u'The installed version of the extension.'}}[source]
name = u'extension'[source]
plural_name = u'extensions'[source]
uri_object_key = u'extension_name'[source]
uri_object_key_regex = u'[.A-Za-z0-9_-]+'[source]
model_object_key = u'class_name'[source]
allowed_methods = (u'GET', u'PUT')[source]
__init__(extension_manager)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

serialize_author_field(extension, *args, **kwargs)[source]
serialize_author_url_field(extension, *args, **kwargs)[source]
serialize_can_disable_field(extension, *args, **kwargs)[source]
serialize_can_enable_field(extension, *args, **kwargs)[source]
serialize_loadable_field(ext, *args, **kwargs)[source]
serialize_load_error_field(extension, *args, **kwargs)[source]
serialize_name_field(extension, *args, **kwargs)[source]
serialize_summary_field(extension, *args, **kwargs)[source]
serialize_version_field(extension, *args, **kwargs)[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.

get_url_patterns()[source]

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)