avoid get params so django uses the cache (bug 562231)
This commit is contained in:
Родитель
453227ac82
Коммит
f7b5cb9635
|
@ -298,7 +298,13 @@ class TestTagsBox(test_utils.TestCase):
|
|||
|
||||
def test_button_caching():
|
||||
"""The button popups should be cached for a long time."""
|
||||
response = test.Client().get(reverse('addons.buttons.js'), follow=True)
|
||||
# Get the url from a real page so it includes the build id.
|
||||
client = test.Client()
|
||||
doc = pq(client.get('/', follow=True).content)
|
||||
js_url = reverse('addons.buttons.js')
|
||||
url_with_build = doc('script[src^="%s"]' % js_url).attr('src')
|
||||
|
||||
response = client.get(url_with_build, follow=True)
|
||||
fmt = '%a, %d %b %Y %H:%M:%S GMT'
|
||||
expires = datetime.strptime(response['Expires'], fmt)
|
||||
assert (expires - datetime.now()).days >= 365
|
||||
|
|
|
@ -22,7 +22,9 @@ urlpatterns = patterns('',
|
|||
# URLs for a single add-on.
|
||||
('^addon/(?P<addon_id>\d+)/', include(detail_patterns)),
|
||||
|
||||
# Accept extra junk at the end for a cache-busting build id.
|
||||
url('^addons/buttons.js(?:/.+)?$', 'addons.buttons.js'),
|
||||
|
||||
# For happy install button debugging.
|
||||
url('^addons/smorgasbord$', 'addons.buttons.smorgasbord'),
|
||||
url('^addons/buttons.js$', 'addons.buttons.js'),
|
||||
)
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
{# js #}
|
||||
<script src="{{ url('django.views.i18n.javascript_catalog') }}"></script>
|
||||
{{ js('common') }}
|
||||
<script async defer src="{{ url('addons.buttons.js') }}?build={{ BUILD_ID_JS }}"></script>
|
||||
<script async defer src="{{ url('addons.buttons.js') }}/build:{{ BUILD_ID_JS }}"></script>
|
||||
{% block js %}{% endblock %}
|
||||
{% include "footer.html" %}
|
||||
{# Webtrends Stats Tracking #}
|
||||
|
|
Загрузка…
Ссылка в новой задаче