Skip to content

Commit

Permalink
Fix some issues found by flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Dec 17, 2020
1 parent 9d87cd7 commit 4e79e2b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions account/account/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def index():
row = cur.fetchone()
if row:
pwhash = row[0]
cookie = {'user_name': user, 'session': row[0]}
cookie = {'user_name': user, 'session': pwhash}
util.set_servers_cookie_info(cookie, request.form.get('permanent'))
g.user = saliweb.frontend._get_user_from_cookie(cookie)
if not g.user:
Expand Down Expand Up @@ -166,7 +166,5 @@ def reset_link(user_id, reset_key):
request.form.get('permanent'))
flash("Password reset successfully. You are now logged in.")
return redirect(url_for('index'))
else:
permanent = True
return render_template('reset-link.html', error=error, user_name=user_name,
permanent=True)
2 changes: 2 additions & 0 deletions account/test/mock/MySQLdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# instead (UTC seconds-since-epoch) for testing
def adapt_datetime(ts):
return calendar.timegm(ts.timetuple())


sqlite3.register_adapter(datetime.datetime, adapt_datetime)


Expand Down
1 change: 0 additions & 1 deletion account/test/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import utils
import re
import flask
account = utils.import_mocked_account(__file__)


Expand Down
2 changes: 2 additions & 0 deletions account/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Make reading flask config a noop
def _mock_from_pyfile(self, fname, silent=False):
pass


flask.Config.from_pyfile = _mock_from_pyfile


Expand Down

0 comments on commit 4e79e2b

Please sign in to comment.