Skip to content
Permalink
Browse files

flake8

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Jan 12, 2015
1 parent 17c69cf commit 66f22cc1ac541b6f8df04aacd2c9034590d82461
Showing with 21 additions and 11 deletions.
  1. +3 −1 comet/init.py
  2. +10 −5 comet/utils.py
  3. +8 −5 comet/web.py
@@ -31,6 +31,7 @@

__all__ = ['init', 'write_users']


def init():
print("ERROR: Not implemented.")
return 255
@@ -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:
@@ -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',
@@ -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:
@@ -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:
@@ -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
@@ -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
@@ -297,6 +297,7 @@ def find_post(path):

app = Flask('comet')


@app.after_request
def log_request(resp):
"""Log a request."""
@@ -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
@@ -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 = ''

0 comments on commit 66f22cc

Please sign in to comment.
You can’t perform that action at this time.