Backends

django-anysign‘s signature backend encapsulates signature workflow and integration with vendor specific implementation.

Note

The backend API is quite experimental. This document deals with both vision (concepts) and current implementation (which may improve).

Scope of a backend

A signature backend is typically known by models and views. They use the backend to perform vendor-specific operations. The backend contains vendor-specific implementation that has to be shared with several consumers such as models and views.

A signature backend also typically knowns the workflows. So it should be helpful for URL resolution.

django-anysign’s SignatureBackend

Here is the current implementation of base backend.

django-dummysign’s SignatureBackend

Here is the demo signature backend implementation provided by django-dummysign.

import logging

import django_anysign


logger = logging.getLogger(__name__)


class DummySignBackend(django_anysign.SignatureBackend):
    def __init__(self):
        super(DummySignBackend, self).__init__(
            name='DummySign',
            code='dummysign',
        )

    def create_signature(self, signature):
        """Register ``signature`` in backend, return updated object.

        As a dummy backend: just emit a log.

        """
        signature = super(DummySignBackend, self).create_signature(self)
        logger.debug('[django_dummysign] Signature created in backend')
        return signature