From 49afb9ed34d3586ab63439c5547ec0420d3d766f Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Tue, 29 Oct 2013 11:51:51 -0700 Subject: [PATCH] Pep8 check most files I left some errors on puppetboard/forms.py because I'm not sure how to fix them. --- dev.py | 2 +- passenger_wsgi.py | 5 ++--- puppetboard/default_settings.py | 22 +++++++++++----------- puppetboard/forms.py | 18 +++++++++--------- puppetboard/utils.py | 1 + 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dev.py b/dev.py index e9f387a..313a58f 100644 --- a/dev.py +++ b/dev.py @@ -5,5 +5,5 @@ from puppetboard.app import app from puppetboard.default_settings import DEV_LISTEN_HOST, DEV_LISTEN_PORT if __name__ == '__main__': - app.debug=True + app.debug = True app.run(DEV_LISTEN_HOST, DEV_LISTEN_PORT) diff --git a/passenger_wsgi.py b/passenger_wsgi.py index 436fb10..6f22959 100644 --- a/passenger_wsgi.py +++ b/passenger_wsgi.py @@ -14,7 +14,6 @@ logfilename = os.path.join('/tmp/', 'puppetboard_passenger_wsgi.log') logging.basicConfig(filename=logfilename, level=logging.INFO) try: - from puppetboard.app import app as application + from puppetboard.app import app as application except Exception, inst: - logging.exception("Error: %s", str(type(inst))) - + logging.exception("Error: %s", str(type(inst))) diff --git a/puppetboard/default_settings.py b/puppetboard/default_settings.py index 5fab6ab..f68dfd2 100644 --- a/puppetboard/default_settings.py +++ b/puppetboard/default_settings.py @@ -1,11 +1,11 @@ -PUPPETDB_HOST='localhost' -PUPPETDB_PORT=8080 -PUPPETDB_SSL=False -PUPPETDB_KEY=None -PUPPETDB_CERT=None -PUPPETDB_TIMEOUT=20 -DEV_LISTEN_HOST='127.0.0.1' -DEV_LISTEN_PORT=5000 -UNRESPONSIVE_HOURS=2 -ENABLE_QUERY=True -LOGLEVEL='info' +PUPPETDB_HOST = 'localhost' +PUPPETDB_PORT = 8080 +PUPPETDB_SSL = False +PUPPETDB_KEY = None +PUPPETDB_CERT = None +PUPPETDB_TIMEOUT = 20 +DEV_LISTEN_HOST = '127.0.0.1' +DEV_LISTEN_PORT = 5000 +UNRESPONSIVE_HOURS = 2 +ENABLE_QUERY = True +LOGLEVEL = 'info' diff --git a/puppetboard/forms.py b/puppetboard/forms.py index 382cfb1..45dbfb8 100644 --- a/puppetboard/forms.py +++ b/puppetboard/forms.py @@ -4,17 +4,17 @@ from __future__ import absolute_import from flask.ext.wtf import Form from wtforms import RadioField, TextAreaField, validators + class QueryForm(Form): """The form used to allow freeform queries to be executed against PuppetDB.""" query = TextAreaField('Query', [validators.Required( - message='A query is required.')]) + message='A query is required.')]) endpoints = RadioField('API endpoint', choices = [ - ('nodes', 'Nodes'), - ('resources', 'Resources'), - ('facts', 'Facts'), - ('fact-names', 'Fact Names'), - ('reports', 'Reports'), - ('events', 'Events'), - ]) - + ('nodes', 'Nodes'), + ('resources', 'Resources'), + ('facts', 'Facts'), + ('fact-names', 'Fact Names'), + ('reports', 'Reports'), + ('events', 'Events'), + ]) diff --git a/puppetboard/utils.py b/puppetboard/utils.py index 9945297..8ac63f5 100644 --- a/puppetboard/utils.py +++ b/puppetboard/utils.py @@ -6,6 +6,7 @@ from pypuppetdb.errors import EmptyResponseError from flask import abort + def get_or_abort(func, *args, **kwargs): """Execute the function with its arguments and handle the possible errors that might occur.