Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 12, 2015
1 parent 17c69cf commit 66f22cc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion comet/init.py
Expand Up @@ -31,6 +31,7 @@

__all__ = ['init', 'write_users']


def init():
print("ERROR: Not implemented.")
return 255
Expand All @@ -40,7 +41,8 @@ def write_users(dburl):
data = {
'username': 'admin',
'realname': 'Website Administrator',
'password': '$2a$12$.qMCcA2uOo0BKkDtEF/bueYtHjcdPBmfEdpxtktRwRTgsR7ZVTWmW',
'password':
'$2a$12$.qMCcA2uOo0BKkDtEF/bueYtHjcdPBmfEdpxtktRwRTgsR7ZVTWmW',
}

for p in PERMISSIONS:
Expand Down
15 changes: 10 additions & 5 deletions comet/utils.py
Expand Up @@ -30,7 +30,8 @@
import sys


__all__ = ['PERMISSIONS', 'USER_FIELDS', 'USER_ALL', 'parse_redis', 'ask', 'ask_yesno']
__all__ = ['PERMISSIONS', 'USER_FIELDS', 'USER_ALL', 'parse_redis', 'ask',
'ask_yesno']

USER_FIELDS = ['username', 'realname', 'password', 'email']
PERMISSIONS = ['active', 'is_admin', 'can_edit_all_posts', 'wants_all_posts',
Expand Down Expand Up @@ -67,9 +68,11 @@ def ask(query, default=None):
else:
default_q = ''
if sys.version_info[0] == 3:
inp = raw_input("{query}{default_q}: ".format(query=query, default_q=default_q)).strip()
inp = raw_input("{query}{default_q}: ".format(
query=query, default_q=default_q)).strip()
else:
inp = raw_input("{query}{default_q}: ".format(query=query, default_q=default_q).encode('utf-8')).strip()
inp = raw_input("{query}{default_q}: ".format(
query=query, default_q=default_q).encode('utf-8')).strip()
if inp or default is None:
return inp
else:
Expand All @@ -85,9 +88,11 @@ def ask_yesno(query, default=None):
elif default is False:
default_q = ' [y/N]'
if sys.version_info[0] == 3:
inp = raw_input("{query}{default_q} ".format(query=query, default_q=default_q)).strip()
inp = raw_input("{query}{default_q} ".format(
query=query, default_q=default_q)).strip()
else:
inp = raw_input("{query}{default_q} ".format(query=query, default_q=default_q).encode('utf-8')).strip()
inp = raw_input("{query}{default_q} ".format(
query=query, default_q=default_q).encode('utf-8')).strip()
if inp:
return inp.lower().startswith('y')
elif default is not None:
Expand Down
13 changes: 8 additions & 5 deletions comet/web.py
Expand Up @@ -32,7 +32,6 @@
import pkg_resources
import nikola.__main__
import logbook
import kombu
import redis
from nikola.utils import unicode_str, get_logger, ColorfulStderrHandler
import nikola.plugins.command.new_post
Expand Down Expand Up @@ -140,10 +139,11 @@ def configure_site():
<script src="/comet_assets/js/comet.js"></scripts>
"""

# Theme must inherit from bootstrap3, because we have hardcoded HTML for that.
# Theme must inherit from bootstrap3, because we have hardcoded HTML.
bs3 = ('bootstrap3' in site.THEMES) or ('bootstrap3-jinja' in site.THEMES)
if not bs3:
app.logger.notice("THEME does not inherit from 'bootstrap3' or 'bootstrap3-jinja', using 'bootstrap3' instead.")
app.logger.notice("THEME does not inherit from 'bootstrap3' or "
"'bootstrap3-jinja', using 'bootstrap3' instead.")
site.config['THEME'] = 'bootstrap3'
# Reloading some things
site._THEMES = None
Expand Down Expand Up @@ -297,6 +297,7 @@ def find_post(path):

app = Flask('comet')


@app.after_request
def log_request(resp):
"""Log a request."""
Expand Down Expand Up @@ -730,7 +731,8 @@ def acp_users_edit():

if action == 'new':
if not data['username']:
return error("No username to create specified.", 400, "/users/edit")
return error("No username to create specified.", 400,
"/users/edit")
uid = db.incr('last_uid')
pf = [False for p in PERMISSIONS]
pf[0] = True # active
Expand Down Expand Up @@ -835,7 +837,8 @@ def display_permission(user, permission):
if permission == 'wants_all_posts' and not user.can_edit_all_posts:
# If this happens, permissions are damaged.
checked = ''
if user.uid == current_user.uid and permission in ['active', 'is_admin']:
if user.uid == current_user.uid and permission in ['active',
'is_admin']:
disabled = 'disabled'
else:
disabled = ''
Expand Down

0 comments on commit 66f22cc

Please sign in to comment.