summaryrefslogtreecommitdiff
path: root/portato/db/database.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-01-28 13:13:56 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-01-28 13:13:56 +0100
commit816fbaf42407fbbb8466c0d08d64fc11f605e5b6 (patch)
tree319eddc33bddd69ddea511a7972dcba9cc1e822c /portato/db/database.py
parent320f6f6270853b0209611ac6ec642994a90220b5 (diff)
downloadportato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.tar.gz
portato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.tar.bz2
portato-816fbaf42407fbbb8466c0d08d64fc11f605e5b6.zip
Use the new database class layout
Diffstat (limited to 'portato/db/database.py')
-rw-r--r--portato/db/database.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/portato/db/database.py b/portato/db/database.py
index 7d8e378..941c3a3 100644
--- a/portato/db/database.py
+++ b/portato/db/database.py
@@ -12,6 +12,9 @@
from __future__ import absolute_import, with_statement
+from threading import RLock
+from functools import wraps
+
class PkgData (object):
__slots__ = ("cat", "pkg", "inst")
@@ -33,6 +36,20 @@ class Database (object):
ALL = _("ALL")
+ def __init__ (self):
+ self._lock = RLock()
+
+ @staticmethod
+ def lock (f):
+ @wraps(f)
+ def wrapper (self, *args, **kwargs):
+ with self._lock:
+ r = f(self, *args, **kwargs)
+
+ return r
+
+ return wrapper
+
def populate (self, category = None):
"""Populates the database.