Evaluate refactor SRPAuth's singleton implementation.
First of all, do we need a singleton?
If we do, the we could use the python module-import system to get the singleton behavior. E.g.:
class _SRPAuth(object):
"""
SRPAuth implementation
"""
# NOTE: here goes the implementation
def setup_srpauth(provider_config, signaler):
if SRPAuth is not None:
SRPAuth = _SRPAuth()
# SRPAuth is a singleton since this code gets called just once, no matter how
# many times we import this module.
SRPAuth = None
This @SRPAuth@ object needs to be used as @SRPAuth@ instead of @SRPAuth()@ which is easier to get that we are dealing with a singleton while reading through the code.
I think this way is more clear that the current implementation.
(from redmine: created on 2014-04-16)