changeset aec976f0a6b7 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=aec976f0a6b7 description: Make NullClientCaps a singleto so that we don't create a new object for each contact.
diffstat:
launch.sh | 2 +- src/common/caps_cache.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletions(-)
diffs (28 lines):
diff -r cacc47928bb3 -r aec976f0a6b7 launch.sh --- a/launch.sh Mon Dec 28 20:14:15 2009 +0100 +++ b/launch.sh Mon Dec 28 20:58:34 2009 +0100 @@ -1,3 +1,3 @@ #!/bin/sh cd "$(dirname $0)/src" -exec python -OOt gajim.py "$@" +exec python -m cProfile gajim.py "$@" diff -r cacc47928bb3 -r aec976f0a6b7 src/common/caps_cache.py --- a/src/common/caps_cache.py Mon Dec 28 20:14:15 2009 +0100 +++ b/src/common/caps_cache.py Mon Dec 28 20:58:34 2009 +0100 @@ -245,6 +245,16 @@
Assumes (almost) everything is supported. """ + _instance = None + def __new__(cls, *args, **kwargs): + """ + Make it a singleton. + """ + if not cls._instance: + cls._instance = super(NullClientCaps, cls).__new__( + cls, *args, **kwargs) + return cls._instance + def __init__(self): AbstractClientCaps.__init__(self, None, None)