aboutsummaryrefslogtreecommitdiffstats
path: root/object.py
diff options
context:
space:
mode:
authorguillaume <guillaume@localhost.localdomain>2010-08-10 16:27:37 -0400
committerguillaume <guillaume@localhost.localdomain>2010-08-10 16:27:37 -0400
commit724c296e54714a949ce79c5056229e00fb7c15c2 (patch)
treed505860e67513dcb76141ebecb86a50ac00ad70d /object.py
parent9e8fd4662da1688cc0c8fec2e9194b1606f30295 (diff)
downloadalias-724c296e54714a949ce79c5056229e00fb7c15c2.tar.gz
First code commit, with very few things.
* Beginning of object class * Beginning of permission class
Diffstat (limited to 'object.py')
-rwxr-xr-xobject.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/object.py b/object.py
new file mode 100755
index 0000000..a89b020
--- /dev/null
+++ b/object.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+#TODO : dissociate the db connexion and the objecthandler (probably pass a db connexion as init argument)
+import sqlite3
+from version import VERSION
+
+class ObjectHandler :
+
+ def __init__(self,root,dbhandler) :
+ self.rootDirectory = root
+ self.db = dbhandler
+ if isinstance(self.db,sqlite3.Connection) :
+ self.db.text_factory = str
+ self.sql = self.db.cursor()
+
+ def childList(self,hash) :
+ self.sql.execute("select son from structure where hash=?",(hash,))
+ l = []
+ for son in self.cursor :
+ l.append(son[0])
+ return l
+
+ def fileName(self,hash) :
+ return self.rootDirectory+'objects/'+hash[:2]+'/'+hash[2:]
+
+ def appendChild(self,father,son) :
+ self.sql.execute("insert into structure values (?,?)",(father,son))
+ self.db.commit()
+