| |
@@ -4,7 +4,7 @@
|
| |
import time
|
| |
|
| |
import flask
|
| |
- from flask.signals import template_rendered, before_render_template
|
| |
+ from flask.signals import template_rendered
|
| |
|
| |
from hubs.models import Hub
|
| |
from hubs.views.utils import get_hub, require_hub_access
|
| |
@@ -13,6 +13,11 @@
|
| |
from .functions import GetRequests
|
| |
from .utils import find_hubs_for_msg, paginate
|
| |
|
| |
+ try:
|
| |
+ from flask.signals import before_render_template
|
| |
+ except ImportError:
|
| |
+ before_render_template = None # Flask < 0.11
|
| |
+
|
| |
|
| |
class BaseView(WidgetView):
|
| |
"""The base view to instantiate the widget."""
|
| |
@@ -190,8 +195,9 @@
|
| |
)
|
| |
initial["hubs"] = [hub.name]
|
| |
context = dict(mode="add", url=post_url, initial=initial)
|
| |
- before_render_template.send(
|
| |
- flask.current_app, template=template, context=context)
|
| |
+ if before_render_template is not None:
|
| |
+ before_render_template.send(
|
| |
+ flask.current_app, template=template, context=context)
|
| |
output = template.render(**context)
|
| |
template_rendered.send(
|
| |
flask.current_app, template=template, context=context)
|
| |
This change adds testing with different versions of Flask and fix incompatibilities with Flask 0.10 (the version we have in EPEL).