Permalink
Browse files

Fixed bugs of annoying language :P

and a bug of wrong variable name
  • Loading branch information...
1 parent 94f3b6e commit d1b4db5b7b087a2331cab52335dfb2f683ee1aa8 @ik5 committed Feb 5, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 convert_quotes.py
View
@@ -117,17 +117,18 @@ def insert_to_db(con, quote, author, logger=LOGGER) :
try :
logger.debug('About to insert author (%s) into the db', author)
cursor.execute('insert into quote_authors(AUTHOR) values(?)',
- (author))
+ (author,))
except fdb.DatabaseError as e :
# usually means that the author already exists ...
logger.info('Could not insert author (%s): %s', (author, e))
try :
logger.debug('About to get the author (%s) id', author)
cursor.execute('select id from quote_authors where author=?',
- (author))
+ (author,))
- author_id = cursor.fetchone['id']
+ row = cursor.fetchone()
+ author_id = row[0]
logger.debug('Author (%s) id : %d', (author, author_id))
except fdb.DatabaseError as e : # could not get the author id
logger.info('Could not find author (%s): %s', (author, e))
@@ -137,7 +138,7 @@ def insert_to_db(con, quote, author, logger=LOGGER) :
try :
logger.debug('Going to insert quote ("%s") to db', quote)
cursor.execute(('insert into quotes(body, author_ref) '
- 'values(?, ?)'), (quote, author))
+ 'values(?, ?)'), (quote, author_id))
logger.debug('Going to commit everything')
con.commit()

0 comments on commit d1b4db5

Please sign in to comment.