Configuration registry

Registry store configurations by the way of its interface.

Default global registry is available at rstview.registry.rstview_registry and is global for the whole project and apps, you don’t need to fill it again for a same Django instance.

A configuration is a dictionnary of parameters for reStructuredText parser:

    'default': {
        'initial_header_level': 1,
        'language_code': "en",

Configuration name is used to retrieve parameters from the registry interface.

See Docutils Configuration for a full references of available parser parameters.

class rstview.registry.RstConfigSite(*args, **kwargs)[source]

Rstview configurations registry

Keyword Arguments:
  • initial (dict) – Optional initial dictionnary of configuration. Default
  • an empty dict. (to) –

Return registred configuration names.

Returns:List of registred names, sorted with default sorted() behavior.
Return type:list

Get parameters from given configuration name.

Parameters:name (string) – Configuration name.
Returns:Configuration parameters.
Return type:string or tuple

Return current registry

Returns:Currrent registry.
Return type:dict

Find if given name is a registred configuration name.

Returns:True if name exists in current registry, else False.
Return type:bool
register(name, value)[source]

Register a configuration for given name.

  • name (string) – Configuration name.
  • value (string or tuple) – Configuration parameters to define.
  • RstviewConfigAlreadyRegistered if name is allready registered in
  • configurations.

Reset registry to an empty Dict.


Unregister a configuration from its name.

Parameters:name (string) – Url name.
Raises:RstviewConfigNotRegistered if given url name is not registred yet.

Update many configuration.

This works like the Dict.update({..}) method.

Parameters:configs (dict) – A dict of configurations.
rstview.registry.rstview_registry = <rstview.registry.RstConfigSite object>

Default rstview configurations registry for a Django instance.