mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
* Unit tests added (limits application) * Added support for limits * Big changes were required * Using standard HTTP codes to identify errors (json) * Custom exceptions have been reworked (not finished yet) see #491
16 lines
357 B
Python
16 lines
357 B
Python
|
|
|
|
# works in Python 2 & 3
|
|
class _Singleton(type):
|
|
_instances = {}
|
|
|
|
def __call__(cls, *args, **kwargs):
|
|
if cls not in cls._instances:
|
|
cls._instances[cls] = \
|
|
super(_Singleton, cls).__call__(*args, **kwargs)
|
|
return cls._instances[cls]
|
|
|
|
|
|
class Singleton(_Singleton('SingletonMeta', (object,), {})):
|
|
pass
|