From 4cc1e4ba049245ddac27b9907a821f79a9537712 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 30 Sep 2004 04:15:32 +0000 Subject: [PATCH] Abstracted for some future overriding. --- src/dbi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dbi.py b/src/dbi.py index 990aa351c..666c7f8ae 100644 --- a/src/dbi.py +++ b/src/dbi.py @@ -221,10 +221,13 @@ class FlatfileMapping(MappingInterface): class CdbMapping(MappingInterface): def __init__(self, filename, **kwargs): self.filename = filename - self.db = cdb.open(filename, 'c', **kwargs) + self._openCdb() # So it can be overridden later. if 'nextId' not in self.db: self.db['nextId'] = '1' + def _openCdb(self, *args, **kwargs): + self.db = cdb.open(filename, 'c', **kwargs) + def _getNextId(self): i = int(self.db['nextId']) self.db['nextId'] = str(i+1)