diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2009-01-28 13:13:56 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2009-01-28 13:13:56 +0100 |
commit | 816fbaf42407fbbb8466c0d08d64fc11f605e5b6 (patch) | |
tree | 319eddc33bddd69ddea511a7972dcba9cc1e822c /portato/db/dict.py | |
parent | 320f6f6270853b0209611ac6ec642994a90220b5 (diff) | |
download | portato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.tar.gz portato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.tar.bz2 portato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.zip |
Use the new database class layout
Diffstat (limited to 'portato/db/dict.py')
-rw-r--r-- | portato/db/dict.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/portato/db/dict.py b/portato/db/dict.py index 435cdd9..5c5ca49 100644 --- a/portato/db/dict.py +++ b/portato/db/dict.py @@ -14,7 +14,7 @@ from __future__ import absolute_import, with_statement import re from collections import defaultdict -from functools import wraps +from threading import RLock from ..backend import system from .database import Database, PkgData @@ -22,21 +22,15 @@ from .database import Database, PkgData class DictDatabase (Database): """An internal database which holds a simple dictionary cat -> [package_list].""" + lock = Database.lock + def __init__ (self): """Constructor.""" + Database.__init__(self) + self.__initialize() - self._lock = RLock() self.populate() - def lock (f): - @wraps(f) - def wrapper (self, *args, **kwargs): - with self._lock: - r = f(self, *args, **kwargs) - return r - - return wrapper - def __initialize (self): self._db = defaultdict(list) self.inst_cats = set([self.ALL]) |