Domain Name

class plinth.modules.names.components.DomainName(component_id, name, domain_type, services)[source]

Component to represent a domain name and its properties.

Each domain name is necessarily attached to a domain type component that must be created prior to creating the domain name.

When an application providing or managing a domain name is disabled, the corresponding domain name should become unavailable for others apps and they must de-configure the domain name from app configuration. This is the primary reason for making a domain name available as a component.

__init__(component_id, name, domain_type, services)[source]

Initialize a domain name.

component_id should be a unique ID across all components of an app and across all components. The value is typically ‘domain-{app}-{domain}’. This ensures that if the same domain is managed by multiple apps, it is available as multiple instances. When one instance is removed, say by disabling that app, the other instance will still provide that domain.

name is the domain name that is being represented by the component. This should be fully qualified domain name.

domain_type should be a string representing the type of the domain. This is the component ID of the domain type earlier registered by the app that is creating the domain name component.

services is a list of string identifiers for services potentially provided by the domain. For example, ‘ssh’ for secure shell service provided on port 22. It is used for showing information to the user and to retrieve a list of a domains that an app may use.

A service value can also be an integer in which case it will be converted to a string by looking up a list of known services. This process is not perfect and may cause problems when filtering domains that could potentially provide a service.

The most common value of a services parameter is the string ‘__all__’ indicating that the domain can potentially provide any service without limitations due to the nature of the domain name.

classmethod get(component_id)[source]

Return the domain name object given name and app.


Return list of unique service strings that can be shown to user.


Return whether a service is available for this domain name.

classmethod list(filter_for_service=None)[source]

Return list of domains.

classmethod list_names(filter_for_service=None)[source]

Return a set of unique domain names.

Multiple different components may provide the same domain name. This method could be used to retrieve a list of all domain names without duplication.


Remove the domain name from global list of domains.

It is acceptable to call remove() multiple times.

property services

Read-only property to get the list of services.

class plinth.modules.names.components.DomainType(component_id, display_name, configuration_url, can_have_certificate=True)[source]

Component to create a new type of domain.

It serves the primary purpose of showing a entry in the domain names page. This will allow users to discover the new type of domain and use the providing app to create that type of domain.

Similar to a menu entry, domain type information is available to the user even when the corresponding app is disabled.

__init__(component_id, display_name, configuration_url, can_have_certificate=True)[source]

Initialize the domain type component.

component_id should be a unique ID across all components of an app and across all components. This will also act as the ‘type’ parameter for each created domain.

display_name is the type of domain displayed to the user in the interface.

configuration_url is the Django URL to which a user is redirected to in order to create or manage a domain of this type.

can_have_certificate indicates if this type of domain can have a TLS certificate that can be validated by a typical browser.

classmethod get(component_id)[source]

Return a component of given ID.

classmethod list()[source]

Return a list of all domain types.