From 1be1aac9d044de9655426912d534f240176fcb1b Mon Sep 17 00:00:00 2001 From: Blallo Date: Sun, 30 Jun 2019 21:23:11 +0200 Subject: [PATCH] Hacker, Robots, Congregations now singletons. --- src/phi/async_ldap/model.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/phi/async_ldap/model.py b/src/phi/async_ldap/model.py index 6257c55..2558302 100644 --- a/src/phi/async_ldap/model.py +++ b/src/phi/async_ldap/model.py @@ -122,6 +122,12 @@ class Hackers(Entry): """ kind = "ou" + _instance = None + + def __new__(cls, *args, **kwargs): + if cls._instance is None: + cls._instance = object.__new__(cls) + return cls._instance def __init__(self, client, *args, **kwargs): super().__init__(client) @@ -142,6 +148,12 @@ class Robots(Entry): kind = "ou" _name = "Services" + _instance = None + + def __new__(cls, *args, **kwargs): + if cls._instance is None: + cls._instance = object.__new__(cls) + return cls._instance def __init__(self, client, *args, **kwargs): super().__init__(client) @@ -162,6 +174,12 @@ class Congregations(Entry): kind = "ou" _name = "Groups" + _instance = None + + def __new__(cls, *args, **kwargs): + if cls._instance is None: + cls._instance = object.__new__(cls) + return cls._instance def __init__(self, client, *args, **kwargs): super().__init__(client)