Skip to content

Commit

Permalink
[#1943] PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Oct 29, 2014
1 parent 878a15b commit 6bf47f4
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions ckan/config/middleware.py
Expand Up @@ -32,6 +32,7 @@

log = logging.getLogger(__name__)


def make_app(conf, full_stack=True, static_files=True, **app_conf):
"""Create a Pylons WSGI application and return it
Expand Down Expand Up @@ -128,22 +129,23 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
OpenIdIdentificationPlugin._redirect_to_loginform = repoze_patch._redirect_to_loginform
OpenIdIdentificationPlugin.challenge = repoze_patch.challenge

who_parser.identifiers = [i for i in who_parser.identifiers if \
not isinstance(i, OpenIdIdentificationPlugin)]
who_parser.challengers = [i for i in who_parser.challengers if \
not isinstance(i, OpenIdIdentificationPlugin)]

app = PluggableAuthenticationMiddleware(app,
who_parser.identifiers,
who_parser.authenticators,
who_parser.challengers,
who_parser.mdproviders,
who_parser.request_classifier,
who_parser.challenge_decider,
logging.getLogger('repoze.who'),
logging.WARN, # ignored
who_parser.remote_user_key,
)
who_parser.identifiers = [i for i in who_parser.identifiers if
not isinstance(i, OpenIdIdentificationPlugin)]
who_parser.challengers = [i for i in who_parser.challengers if
not isinstance(i, OpenIdIdentificationPlugin)]

app = PluggableAuthenticationMiddleware(
app,
who_parser.identifiers,
who_parser.authenticators,
who_parser.challengers,
who_parser.mdproviders,
who_parser.request_classifier,
who_parser.challenge_decider,
logging.getLogger('repoze.who'),
logging.WARN, # ignored
who_parser.remote_user_key
)

# Establish the Registry for this application
app = RegistryManager(app)
Expand All @@ -156,7 +158,7 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
else int(config.get('ckan.static_max_age', 3600))

static_app = StaticURLParser(config['pylons.paths']['static_files'],
cache_max_age=static_max_age)
cache_max_age=static_max_age)
static_parsers = [static_app, app]

storage_directory = uploader.get_storage_path()
Expand All @@ -169,8 +171,7 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
if e.errno != 17:
raise

storage_app = StaticURLParser(path,
cache_max_age=static_max_age)
storage_app = StaticURLParser(path, cache_max_age=static_max_age)
static_parsers.insert(0, storage_app)

# Configurable extra static file paths
Expand All @@ -179,7 +180,7 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):
if public_path.strip():
extra_static_parsers.append(
StaticURLParser(public_path.strip(),
cache_max_age=static_max_age)
cache_max_age=static_max_age)
)
app = Cascade(extra_static_parsers + static_parsers)

Expand All @@ -193,6 +194,7 @@ def make_app(conf, full_stack=True, static_files=True, **app_conf):

return app


def ckan_auth_tkt_make_app(**kw):
if not len(kw.get('secret', '')) or kw.get('secret') == 'somesecret':
kw['secret'] = config['beaker.session.secret']
Expand Down

0 comments on commit 6bf47f4

Please sign in to comment.