Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-04-21 13:35:51 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-04-21 13:35:51 (GMT)
commitce69715f8a8036a2681d459d1fef9f9533dd50dc (patch)
tree9ed6c9da119aec9d18734aba07abc0420a68ec9a
parentdf433a014e1f9abdb1fd02d76917711d84912cef (diff)
Handle activity isolation properlyHEADmaster
-rw-r--r--readdb.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/readdb.py b/readdb.py
index 5300993..c7d290a 100644
--- a/readdb.py
+++ b/readdb.py
@@ -17,6 +17,8 @@
import logging
+import os, os.path
+import shutil
import sqlite3
import time
@@ -27,8 +29,17 @@ from readbookmark import Bookmark
_logger = logging.getLogger('read-activity')
class BookmarkManager:
- def __init__(self, filehash, dbpath='read.db'):
+ def __init__(self, filehash, dbfile='read.db'):
self._filehash = filehash
+
+ dbpath = os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'], 'data', \
+ dbfile)
+
+ if not os.path.exists(dbpath):
+ # This makes me nervous
+ srcpath = os.path.join(os.environ['SUGAR_BUNDLE_PATH'], 'read.db')
+ shutil.copy(srcpath, dbpath)
+
self._conn = sqlite3.connect(dbpath)
self._bookmarks = []