Source code for regcore.db

import sys

from django.conf import settings
from django.utils.importlib import import_module


def _select(key):
    module, class_name = settings.BACKENDS[key].rsplit('.', 1)
    module = import_module(module)
    return getattr(module, class_name)()


[docs]class Regulations(object): """A level of indirection for our database abstraction. All backends should provide the same interface.""" def __new__(cls): return _select('regulations')
[docs] def get(self, label, version): """Documentation method. Returns a regulation node or None""" raise NotImplementedError
[docs] def bulk_put(self, regs, version, root_label): """Documentation method. Add many entries, with a root of root_label. Each should have the provided version""" raise NotImplementedError
[docs] def listing(self, label): """Documentation method. List regulation versions that match this label, sorted""" raise NotImplementedError
[docs]class Layers(object): """A level of indirection for our database abstraction. All backends should provide the same interface.""" def __new__(cls): return _select('layers')
[docs] def bulk_put(self, layers, version, layer_name, root_label): """Documentation method. Add many entries, with the root of the entries having root_label and all entries having layer_name and version""" raise NotImplementedError
[docs] def get(self, name, label, version): """Doc method. Return a single layer (no meta data) or None""" raise NotImplementedError
[docs]class Notices(object): """A level of indirection for our database abstraction. All backends should provide the same interface.""" def __new__(cls): return _select('notices')
[docs] def put(self, doc_number, notice): """Documentation method. doc_number:String, notice:Dict""" raise NotImplementedError
[docs] def get(self, doc_number): """Documentation method. Return matching notice or None""" raise NotImplementedError
[docs] def listing(self, part=None): """Documentation method. Return all notices or notices by part""" raise NotImplementedError
[docs]class Diffs(object): """A level of indirection for our database abstraction. All backends should provide the same interface.""" def __new__(cls): return _select('diffs')
[docs] def put(self, label, old_version, new_version, diff): """Documentation method. label, old_version, new_version:String, diff:Dict""" raise NotImplementedError
[docs] def get(self, label, old_version, new_version): """Documentation method. Return matching diff or None""" raise NotImplementedError

Project Versions

This Page