Created
August 1, 2011 11:51
-
-
Save wimleers/1118004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git code/arbitrator.py code/arbitrator.py | |
index a56cd43..071c913 100644 | |
--- code/arbitrator.py | |
+++ code/arbitrator.py | |
@@ -247,6 +247,7 @@ | |
# Create connection to synced files DB. | |
self.dbcon = sqlite3.connect(SYNCED_FILES_DB) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
self.dbcur.execute("CREATE TABLE IF NOT EXISTS synced_files(input_file text, transported_file_basename text, url text, server text)") | |
self.dbcur.execute("CREATE UNIQUE INDEX IF NOT EXISTS file_unique_per_server ON synced_files (input_file, server)") | |
diff --git code/fsmonitor.py code/fsmonitor.py | |
index 46a4bab..7e0a3c8 100644 | |
--- code/fsmonitor.py | |
+++ code/fsmonitor.py | |
@@ -147,6 +147,7 @@ | |
# Database. | |
if self.dbcur is None: | |
self.dbcon = sqlite3.connect(self.dbfile) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
# PathScanner. | |
if self.persistent == True and self.dbcur is not None: | |
diff --git code/pathscanner.py code/pathscanner.py | |
index 2c86f65..1660f47 100644 | |
--- code/pathscanner.py | |
+++ code/pathscanner.py | |
@@ -98,7 +98,6 @@ | |
Returns False if there is already data available for this path. | |
""" | |
- path = path.decode('utf-8') | |
# Check if there really isn't any data available for this path. | |
self.dbcur.execute("SELECT COUNT(filename) FROM %s WHERE path=?" % (self.table), (path,)) | |
@@ -111,7 +110,6 @@ | |
def purge_path(self, path): | |
"""purge the metadata for a given path and all its subdirectories""" | |
- path = path.decode('utf-8') | |
self.dbcur.execute("DELETE FROM %s WHERE path LIKE ?" % (self.table), (path + "%",)) | |
self.dbcur.execute("VACUUM %s" % (self.table)) | |
@@ -179,7 +177,6 @@ | |
- Can detect deleted directory trees. | |
""" | |
- path = path.decode('utf-8') | |
# Fetch the old metadata from the DB. | |
self.dbcur.execute("SELECT filename, mtime FROM %s WHERE path=?" % (self.table), (path, )) | |
old_files = {} | |
@@ -221,7 +218,6 @@ | |
def scan_tree(self, path): | |
"""scan a directory tree for changes""" | |
- path = path.decode('utf-8') | |
# Scan the current directory for changes. | |
result = self.scan(path) | |
diff --git code/persistent_list.py code/persistent_list.py | |
index 60a1d88..6840a07 100644 | |
--- code/persistent_list.py | |
+++ code/persistent_list.py | |
@@ -36,6 +36,7 @@ | |
def __prepare_db(self, dbfile): | |
sqlite3.register_converter("pickle", cPickle.loads) | |
self.dbcon = sqlite3.connect(dbfile, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
self.dbcur.execute("CREATE TABLE IF NOT EXISTS %s(id INTEGER PRIMARY KEY AUTOINCREMENT, item pickle)" % (self.table)) | |
self.dbcon.commit() | |
diff --git code/persistent_queue.py code/persistent_queue.py | |
index 230688c..869072a 100644 | |
--- code/persistent_queue.py | |
+++ code/persistent_queue.py | |
@@ -42,6 +42,7 @@ | |
def __prepare_db(self, dbfile): | |
sqlite3.register_converter("pickle", cPickle.loads) | |
self.dbcon = sqlite3.connect(dbfile, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
self.dbcur.execute("CREATE TABLE IF NOT EXISTS %s(id INTEGER PRIMARY KEY AUTOINCREMENT, item pickle)" % (self.table)) | |
self.dbcon.commit() | |
@@ -121,6 +122,7 @@ | |
def __prepare_db(self, dbfile): | |
self.dbcon = sqlite3.connect(dbfile) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
diff --git code/processors/link_updater.py code/processors/link_updater.py | |
index fd57581..60b5b60 100644 | |
--- code/processors/link_updater.py | |
+++ code/processors/link_updater.py | |
@@ -54,6 +54,7 @@ | |
# Step 3: verify that each of these files has been synced. | |
synced_files_db = urljoin(sys.path[0] + os.sep, SYNCED_FILES_DB) | |
self.dbcon = sqlite3.connect(synced_files_db) | |
+ self.dbcon.text_factory = str | |
self.dbcur = self.dbcon.cursor() | |
all_synced = True | |
for urlstring in getUrls(sheet): | |
diff --git code/verify.py code/verify.py | |
index 8cbd2c1..8aaece2 100644 | |
--- code/verify.py | |
+++ code/verify.py | |
@@ -8,6 +8,7 @@ | |
num_files_invalid = 0 | |
dbcon = sqlite3.connect(SYNCED_FILES_DB) | |
+dbcon.text_factory = str | |
dbcur = dbcon.cursor() | |
num_files = dbcur.execute("SELECT COUNT(*) FROM synced_files").fetchone()[0] | |
dbcur.execute("SELECT input_file, url, server FROM synced_files ORDER BY server") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment