summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-04-16 10:42:24 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2009-04-16 10:42:24 +0200
commit9e4e6b7727df521bd187ca209e2a0ebc10f4a382 (patch)
tree6598f7c232391db821456e55b12ef4b71c0e3a68 /storage
parent188d0883ef4eda09da91cfa6e4cffd583dd999ac (diff)
downloadtodolist-9e4e6b7727df521bd187ca209e2a0ebc10f4a382.tar.gz
todolist-9e4e6b7727df521bd187ca209e2a0ebc10f4a382.tar.xz
todolist-9e4e6b7727df521bd187ca209e2a0ebc10f4a382.zip
first trys
Diffstat (limited to 'storage')
-rw-r--r--storage/__init__.py0
-rw-r--r--storage/factory.py5
-rw-r--r--storage/sqlite.py17
-rw-r--r--storage/storageBase.py11
4 files changed, 33 insertions, 0 deletions
diff --git a/storage/__init__.py b/storage/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/storage/__init__.py
diff --git a/storage/factory.py b/storage/factory.py
new file mode 100644
index 0000000..c1fa049
--- /dev/null
+++ b/storage/factory.py
@@ -0,0 +1,5 @@
+from sqlite import *
+
+def getStorage():
+ x = sqlite()
+ return x
diff --git a/storage/sqlite.py b/storage/sqlite.py
new file mode 100644
index 0000000..8a24858
--- /dev/null
+++ b/storage/sqlite.py
@@ -0,0 +1,17 @@
+from storageBase import storageBase
+from itemList import itemList
+from pysqlite2 import dbapi2 as sqliteBackend
+
+class sqlite(storageBase):
+ def __init__(self):
+ self.con = sqliteBackend.connect(self.getConfigDir() + '/data.sqlite')
+
+ def __del__(self):
+ self.con.close()
+
+ def load(self):
+ return itemList(self)
+
+ def notifyChange(self, sender):
+ print '%s %s' % ('Save changes:', sender.getCreatedAt())
+ return
diff --git a/storage/storageBase.py b/storage/storageBase.py
new file mode 100644
index 0000000..24abd2c
--- /dev/null
+++ b/storage/storageBase.py
@@ -0,0 +1,11 @@
+import os
+
+class storageBase:
+ def notifyChange(self, sender): abstract
+
+ def getConfigDir(self):
+ dir = os.path.expanduser('~/.todolist/blub')
+ if not os.path.exists(dir):
+ os.makedirs(dir)
+
+ return dir