Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Flask.before_request instead of Flask.before_first_request to work around the re-entry deadlock introduced in Flask 0.11 #184

Merged
merged 1 commit into from
Jul 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion grip/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def __init__(self, source=None, auth=None, renderer=None,
rate_limit_route = posixpath.join(grip_url, 'rate-limit-preview')

# Initialize views
self.before_first_request(self._retrieve_styles)
self._styles_retrieved = False
self.before_request(self._retrieve_styles)
self.add_url_rule(asset_route, 'asset', self._render_asset)
self.add_url_rule(asset_subpath, 'asset', self._render_asset)
self.add_url_rule('/', 'render', self._render_page)
Expand Down Expand Up @@ -310,6 +311,10 @@ def _retrieve_styles(self):
Retrieves the style URLs from the source and caches them. This
is called before the first request is dispatched.
"""
if self._styles_retrieved:
return
self._styles_retrieved = True

try:
self.assets.retrieve_styles(url_for('asset'))
except Exception as ex:
Expand Down