aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-03-23 12:01:05 +0100
committercedricbonhomme <devnull@localhost>2010-03-23 12:01:05 +0100
commit2b263f301764e6c2e52b764f689639d56ba9c372 (patch)
treebc48677fcbd34c18edc89ef52ea83dbaa6a43a91 /utils.py
parentMinor bugfix. (diff)
downloadnewspipe-2b263f301764e6c2e52b764f689639d56ba9c372.tar.gz
newspipe-2b263f301764e6c2e52b764f689639d56ba9c372.tar.bz2
newspipe-2b263f301764e6c2e52b764f689639d56ba9c372.zip
Bug fix: when the database do not exists at first launch.
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index ef6b3977..e0011edd 100755
--- a/utils.py
+++ b/utils.py
@@ -168,6 +168,24 @@ def compare(stringtime1, stringtime2):
return 1
return 0
+def create_base():
+ """
+ Create the base if not exists.
+ """
+ sqlite3.register_adapter(str, lambda s : s.decode('utf-8'))
+ conn = sqlite3.connect("./var/feed.db", isolation_level = None)
+ c = conn.cursor()
+ c.execute('''create table if not exists feeds
+ (feed_title text, feed_site_link text, \
+ feed_link text PRIMARY KEY, feed_image_link text,
+ mail text)''')
+ c.execute('''create table if not exists articles
+ (article_date text, article_title text, \
+ article_link text PRIMARY KEY, article_description text, \
+ article_readed text, feed_link text)''')
+ conn.commit()
+ c.close()
+
def load_feed():
"""
Load feeds and articles in a dictionary.
@@ -232,4 +250,5 @@ def load_feed():
c.close()
LOCKER.release()
return (articles, feeds)
+ LOCKER.release()
return (articles, feeds) \ No newline at end of file
bgstack15