From 4b72f626d9e4f89fd9230194b9edc19f64e3910a Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 25 Sep 2018 02:19:29 +0300 Subject: [PATCH] Update string substitution format Instead of doing numbered strings I will just depend on the order, at least to be consistent. --- app.py | 4 ++-- indexer.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index f7cde11..984bbe1 100644 --- a/app.py +++ b/app.py @@ -25,7 +25,7 @@ class AllItemsResource: pages = round(cursor.fetchone()[0] / limit) # get statistics, ordered by id, and use limit and offset to page through results - cursor.execute('SELECT id, views, downloads FROM items ORDER BY id ASC LIMIT {0} OFFSET {1}'.format(limit, offset)) + cursor.execute('SELECT id, views, downloads FROM items ORDER BY id ASC LIMIT {} OFFSET {}'.format(limit, offset)) results = cursor.fetchmany(limit) cursor.close() @@ -50,7 +50,7 @@ class ItemResource: """Handles GET requests""" cursor = db.cursor() - cursor.execute('SELECT views, downloads FROM items WHERE id={0}'.format(item_id)) + cursor.execute('SELECT views, downloads FROM items WHERE id={}'.format(item_id)) results = cursor.fetchone() cursor.close() diff --git a/indexer.py b/indexer.py index 8b2cd1e..46f7eb4 100755 --- a/indexer.py +++ b/indexer.py @@ -55,7 +55,7 @@ def index_views(): cursor = db.cursor() while results_current_page <= results_num_pages: - print('Page {0} of {1}.'.format(results_current_page, results_num_pages)) + print('Page {} of {}.'.format(results_current_page, results_num_pages)) res = solr.query('statistics', { 'q':'type:2', @@ -102,7 +102,7 @@ def index_downloads(): cursor = db.cursor() while results_current_page <= results_num_pages: - print('Page {0} of {1}.'.format(results_current_page, results_num_pages)) + print('Page {} of {}.'.format(results_current_page, results_num_pages)) res = solr.query('statistics', { 'q':'type:0',