• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Djblets 5.x
    2. Version 5.x
    3. Version 4.x
    4. Version 3.x
    5. Version 2.x
    6. Version 2.0
    7. Version 1.0
    8. Version 0.9
    9. Djblets Documentation
    10. Module and Class References
    11. djblets.extensions.resources
  • Home
  • Guides
  • Avatar Services Guides
  • Writing Avatar Services
  • Extension Guides
  • Writing Extensions
  • Testing Extensions
  • Feature Checks Guides
  • Introduction to Feature Checks
  • Writing Features
  • Writing Feature Checkers
  • Testing with Feature Checks
  • Integration Guides
  • Supporting Integrations
  • Writing Integrations
  • Privacy Compliance Guides
  • Getting and Checking Consent
  • Working with Personally Identifiable Information
  • Service Integrations
  • reCAPTCHA Guides
  • Using reCAPTCHA
  • Registries Guides
  • Writing Registries
  • Web API Guides
  • Writing Web API Resources
  • Adding OAuth2 Support
  • Module and Class References
  • djblets
  • djblets.deprecation
  • djblets.auth.forms
  • djblets.auth.ratelimit
  • djblets.auth.signals
  • djblets.auth.util
  • djblets.auth.views
  • djblets.avatars.errors
  • djblets.avatars.forms
  • djblets.avatars.registry
  • djblets.avatars.services
  • djblets.avatars.services.base
  • djblets.avatars.services.fallback
  • djblets.avatars.services.file_upload
  • djblets.avatars.services.gravatar
  • djblets.avatars.services.url
  • djblets.avatars.settings
  • djblets.cache.backend
  • djblets.cache.backend_compat
  • djblets.cache.context_processors
  • djblets.cache.errors
  • djblets.cache.forwarding_backend
  • djblets.cache.serials
  • djblets.cache.synchronizer
  • djblets.conditions
  • djblets.conditions.choices
  • djblets.conditions.conditions
  • djblets.conditions.errors
  • djblets.conditions.operators
  • djblets.conditions.values
  • djblets.configforms.forms
  • djblets.configforms.mixins
  • djblets.configforms.pages
  • djblets.configforms.registry
  • djblets.configforms.views
  • djblets.datagrid.grids
  • djblets.db.backends.mysql.base
  • djblets.db.fields
  • djblets.db.fields.base64_field
  • djblets.db.fields.comma_separated_values_field
  • djblets.db.fields.counter_field
  • djblets.db.fields.json_field
  • djblets.db.fields.modification_timestamp_field
  • djblets.db.fields.relation_counter_field
  • djblets.db.managers
  • djblets.db.query
  • djblets.db.query_catcher
  • djblets.db.query_comparator
  • djblets.db.validators
  • djblets.extensions.admin
  • djblets.extensions.errors
  • djblets.extensions.extension
  • djblets.extensions.forms
  • djblets.extensions.hooks
  • djblets.extensions.loaders
  • djblets.extensions.manager
  • djblets.extensions.middleware
  • djblets.extensions.models
  • djblets.extensions.packaging
  • djblets.extensions.resources
  • djblets.extensions.settings
  • djblets.extensions.signals
  • djblets.extensions.staticfiles
  • djblets.extensions.testing
  • djblets.extensions.testing.testcases
  • djblets.extensions.urls
  • djblets.extensions.views
  • djblets.extensions.templatetags.djblets_extensions
  • djblets.features
  • djblets.features.checkers
  • djblets.features.decorators
  • djblets.features.errors
  • djblets.features.feature
  • djblets.features.level
  • djblets.features.registry
  • djblets.features.testing
  • djblets.features.templatetags.features
  • djblets.forms.fields
  • djblets.forms.fieldsets
  • djblets.forms.forms
  • djblets.forms.forms.key_value_form
  • djblets.forms.widgets
  • djblets.gravatars
  • djblets.gravatars.templatetags.gravatars
  • djblets.http.middleware
  • djblets.http.responses
  • djblets.integrations.errors
  • djblets.integrations.forms
  • djblets.integrations.hooks
  • djblets.integrations.integration
  • djblets.integrations.manager
  • djblets.integrations.mixins
  • djblets.integrations.models
  • djblets.integrations.urls
  • djblets.integrations.views
  • djblets.log
  • djblets.log.middleware
  • djblets.log.siteconfig
  • djblets.log.urls
  • djblets.log.views
  • djblets.mail.dmarc
  • djblets.mail.message
  • djblets.mail.testing
  • djblets.mail.utils
  • djblets.markdown
  • djblets.markdown.extensions.escape_html
  • djblets.markdown.extensions.wysiwyg
  • djblets.markdown.extensions.wysiwyg_email
  • djblets.pipeline.compilers.es6
  • djblets.pipeline.compilers.less
  • djblets.pipeline.compilers.mixins
  • djblets.pipeline.compilers.rollup
  • djblets.pipeline.compilers.typescript
  • djblets.pipeline.settings
  • djblets.privacy.consent
  • djblets.privacy.consent.base
  • djblets.privacy.consent.common
  • djblets.privacy.consent.errors
  • djblets.privacy.consent.forms
  • djblets.privacy.consent.hooks
  • djblets.privacy.consent.registry
  • djblets.privacy.consent.tracker
  • djblets.privacy.models
  • djblets.privacy.pii
  • djblets.privacy.templatetags.djblets_privacy
  • djblets.recaptcha.mixins
  • djblets.recaptcha.siteconfig
  • djblets.recaptcha.templatetags.djblets_recaptcha
  • djblets.recaptcha.widgets
  • djblets.registries
  • djblets.registries.errors
  • djblets.registries.importer
  • djblets.registries.mixins
  • djblets.registries.registry
  • djblets.registries.signals
  • djblets.secrets
  • djblets.secrets.crypto
  • djblets.secrets.token_generators
  • djblets.secrets.token_generators.base
  • djblets.secrets.token_generators.legacy_sha1
  • djblets.secrets.token_generators.registry
  • djblets.secrets.token_generators.vendor_checksum
  • djblets.siteconfig
  • djblets.siteconfig.admin
  • djblets.siteconfig.context_processors
  • djblets.siteconfig.django_settings
  • djblets.siteconfig.forms
  • djblets.siteconfig.managers
  • djblets.siteconfig.middleware
  • djblets.siteconfig.models
  • djblets.siteconfig.signals
  • djblets.siteconfig.views
  • djblets.template.caches
  • djblets.template.context
  • djblets.template.loaders.conditional_cached
  • djblets.template.loaders.namespaced_app_dirs
  • djblets.testing.decorators
  • djblets.testing.testcases
  • djblets.testing.testrunners
  • djblets.urls.context_processors
  • djblets.urls.decorators
  • djblets.urls.patterns
  • djblets.urls.resolvers
  • djblets.urls.root
  • djblets.urls.staticfiles
  • djblets.util.compat.django.core.cache
  • djblets.util.compat.python.past
  • djblets.util.contextmanagers
  • djblets.util.dates
  • djblets.util.decorators
  • djblets.util.filesystem
  • djblets.util.functional
  • djblets.util.html
  • djblets.util.http
  • djblets.util.humanize
  • djblets.util.json_utils
  • djblets.util.properties
  • djblets.util.serializers
  • djblets.util.symbols
  • djblets.util.templatetags.djblets_deco
  • djblets.util.templatetags.djblets_email
  • djblets.util.templatetags.djblets_forms
  • djblets.util.templatetags.djblets_images
  • djblets.util.templatetags.djblets_js
  • djblets.util.templatetags.djblets_utils
  • djblets.util.typing
  • djblets.util.views
  • djblets.views.generic.base
  • djblets.views.generic.etag
  • djblets.webapi.auth
  • djblets.webapi.auth.backends
  • djblets.webapi.auth.backends.api_tokens
  • djblets.webapi.auth.backends.base
  • djblets.webapi.auth.backends.basic
  • djblets.webapi.auth.backends.oauth2_tokens
  • djblets.webapi.auth.views
  • djblets.webapi.decorators
  • djblets.webapi.encoders
  • djblets.webapi.errors
  • djblets.webapi.fields
  • djblets.webapi.managers
  • djblets.webapi.models
  • djblets.webapi.oauth2_scopes
  • djblets.webapi.resources
  • djblets.webapi.resources.base
  • djblets.webapi.resources.group
  • djblets.webapi.resources.registry
  • djblets.webapi.resources.root
  • djblets.webapi.resources.user
  • djblets.webapi.resources.mixins.api_tokens
  • djblets.webapi.resources.mixins.forms
  • djblets.webapi.resources.mixins.oauth2_tokens
  • djblets.webapi.resources.mixins.queries
  • djblets.webapi.responses
  • djblets.webapi.signals
  • djblets.webapi.testing
  • djblets.webapi.testing.decorators
  • djblets.webapi.testing.testcases
  • General Index
  • Python Module Index
  • Release Notes
  • djblets.extensions.resources¶

    class ExtensionResource(extension_manager)[source]¶

    Bases: WebAPIResource

    Provides information on installed extensions.

    model[source]¶

    alias of RegisteredExtension

    fields: Mapping[str, Union[WebAPIResourceFieldInfo, Mapping[str, Any]]] = {'author': {'description': 'The author of the extension.', 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'author_url': {'description': "The author's website.", 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'can_disable': {'description': 'Whether or not the extension can be disabled.', 'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, 'can_enable': {'description': 'Whether or not the extension can be enabled.', 'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, 'class_name': {'description': 'The class name for the extension.', 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'enabled': {'description': 'Whether or not the extension is enabled.', 'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, 'installed': {'description': 'Whether or not the extension is installed.', 'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, 'load_error': {'description': 'If the extension could not be loaded, this will contain any errors captured while trying to load.', 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'loadable': {'description': 'Whether or not the extension is currently loadable. An extension may be installed but missing or may be broken due to a bug.', 'type': <class 'djblets.webapi.fields.BooleanFieldType'>}, 'name': {'description': 'The name of the extension.', 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'summary': {'description': "A summary of the extension's functionality.", 'type': <class 'djblets.webapi.fields.StringFieldType'>}, 'version': {'description': 'The installed version of the extension.', 'type': <class 'djblets.webapi.fields.StringFieldType'>}}[source]¶

    A mapping of field names to definitions for any serialized objects.

    Each key should be a field name either present in model or defined as a serialize_<fieldname>_field method.

    Type:

    dict

    name = 'extension'[source]¶
    plural_name = 'extensions'[source]¶
    uri_object_key: Optional[str] = 'extension_name'[source]¶

    The key to populate with the ID of an object in an item resource.

    Type:

    str

    uri_object_key_regex: str = '[.A-Za-z0-9_-]+'[source]¶

    A regex for mapping keys for an object in an item resource.

    By default, this matches integers. Subclasses can override this to match IDs with other values.

    Type:

    str

    model_object_key: str = 'class_name'[source]¶

    The key on the provided model for matching an object key.

    This is used when model is set, allowing API resources to automatically query for a model instance matching this model key to the value in the URL corresponding to uri_object_key.

    Type:

    str

    allowed_methods: Sequence[str] = ('GET', 'PUT')[source]¶

    A list of HTTP methods that are allowed on this resource.

    Subclasses must have resource handlers defined for each allowed HTTP method.

    Type:

    tuple of str

    __init__(extension_manager)[source]¶

    Initialize the API resource.

    This will register the resource and set up state required for processing API requests.

    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(request, *args, **kwargs)[source]¶

    Returns the list of known extensions.

    Each extension in the list has been installed, but may not be enabled.

    get_links(resources=[], obj=None, request=None, *args, **kwargs)[source]¶

    Return a dictionary of links coming off this resource.

    The resulting links will point to the resources passed in resources, and will also provide special resources for self (which points back to the official location for this resource) and one per HTTP method/operation allowed on this resource.

    Parameters:
    • resources (list of WebAPIResource, optional) – A list of resources for which to generate additional links.

    • obj (object, optional) – The object being serialized, for use as a base for resource URLs.

    • *args (tuple) – Additional positional arguments passed to the view.

    • request (django.http.HttpRequest) – The HTTP request from the client.

    • **kwargs (dict) – Keyword arguments representing values captured from the URL.

    Returns:

    A dictionary of link names to link information.

    Return type:

    dict

    update(request, *args, **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]¶

    Return the Django URL patterns for this object and its children.

    This is used to automatically build up the URL hierarchy for all objects. Projects should call this for top-level resources and return them in the urls.py files.

    Returns:

    The list of URL patterns.

    Return type:

    list

    get_related_links(obj=None, request=None, *args, **kwargs)[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)

    __annotations__ = {'_parent_resource': 'Optional[WebAPIResource]', '_prefetch_related_fields': 'List[str]', '_select_related_fields': 'List[str]', 'allowed_methods': 'Sequence[str]', 'allowed_mimetypes': 'Sequence[AllowedMimetypeEntry]', 'autogenerate_etags': 'bool', 'etag_field': 'Optional[str]', 'fields': 'Mapping[str, Union[WebAPIResourceFieldInfo, Mapping[str, Any]]]', 'is_webapi_handler': 'Final[bool]', 'item_child_resources': 'Sequence[WebAPIResource]', 'last_modified_field': 'Optional[str]', 'list_child_resources': 'Sequence[WebAPIResource]', 'method_mapping': 'Mapping[str, str]', 'mimetype_item_resource_name': 'Optional[str]', 'mimetype_list_resource_name': 'Optional[str]', 'mimetype_vendor': 'Optional[str]', 'model': 'Optional[Type[Model]]', 'model_object_key': 'str', 'model_parent_key': 'Optional[str]', 'paginated_cls': 'Type[WebAPIResponsePaginated]', 'singleton': 'bool', 'uri_object_key': 'Optional[str]', 'uri_object_key_regex': 'str'}¶
    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

    RootResource

    __init__(*args, **kwargs)[source]¶

    Initialize the extension resource mixin to listen for changes.

    Parameters:
    • *args (tuple) – Additional positional arguments.

    • **kwargs (dict) – Additional keyword arguments.

    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

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • ExtensionResource
      • ExtensionResource.model
      • ExtensionResource.fields
      • ExtensionResource.name
      • ExtensionResource.plural_name
      • ExtensionResource.uri_object_key
      • ExtensionResource.uri_object_key_regex
      • ExtensionResource.model_object_key
      • ExtensionResource.allowed_methods
      • ExtensionResource.__init__()
      • ExtensionResource.serialize_author_field()
      • ExtensionResource.serialize_author_url_field()
      • ExtensionResource.serialize_can_disable_field()
      • ExtensionResource.serialize_can_enable_field()
      • ExtensionResource.serialize_loadable_field()
      • ExtensionResource.serialize_load_error_field()
      • ExtensionResource.serialize_name_field()
      • ExtensionResource.serialize_summary_field()
      • ExtensionResource.serialize_version_field()
      • ExtensionResource.get_list()
      • ExtensionResource.get_links()
      • ExtensionResource.update()
      • ExtensionResource.get_url_patterns()
      • ExtensionResource.get_related_links()
      • ExtensionResource.__annotations__
    • ExtensionRootResourceMixin
      • ExtensionRootResourceMixin.__init__()
      • ExtensionRootResourceMixin.get_extension_resource()