Some usages need to replace some standard classes, for example this Redis Cache implementation.
It is better for everyone that users don’t need to fork Tryton to extend/customize some parts.
The proposal is inspired by the logging.config module where it is possible to define alternative classes.
We could add similar behaviour for some classes where it makes sense to be able to replace them. The configuration could be extended to support new options. For example, we could add under the
cache section an option
class that will replace the
trytond.cache.Cache class with this kind of pattern:
class Cache(object): ... if config.get('cache', 'class'): from logging.config import _resolve Cache = _resolve(config.get('cache', 'class'))
The possible classes to be replaced: