Changes between Initial Version and Version 1 of Ticket #19538


Ignore:
Timestamp:
Dec 30, 2012, 6:08:27 AM (12 years ago)
Author:
Florian Apolloner
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19538 – Description

    initial v1  
    11contrib/admin/templates/admin/base.html contains the line:
     2{{{
    23<script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
     4}}}
    35
    4 The __admin_media_prefix__ is used in contrib/admin/static/admin/js/admin/DateTimeShortcuts.js to form URLs by concatenation:
     6The !__admin_media_prefix!__ is used in contrib/admin/static/admin/js/admin/DateTimeShortcuts.js to form URLs by concatenation:
    57DateTimeShortcuts.admin_media_prefix + 'img/icon_clock.gif'
    68
    79This causes a problem with certain storage backends (such as S3 Boto) which include authentication digests as part of the URL. For instance, when using the S3 Boto backend, my admin renders the following line:
     10{{{
    811<script type="text/javascript">window.__admin_media_prefix__ = "https://oca3\u002Dqa.s3.amazonaws.com/admin?Signature\u003DXIt%2FCc9wPWjaw%2F3ITNjkYE3bc%2FI%3D\u0026Expires\u003D1356844210\u0026AWSAccessKeyId\u003DAKIAIGREZ7J53KZ23QKQ";</script>
     12}}}
    913
    1014Which, when concatenated with the fixed string generates the invalid URL: https://oca3\u002Dqa.s3.amazonaws.com/admin?Signature\u003DXIt%2FCc9wPWjaw%2F3ITNjkYE3bc%2FI%3D\u0026Expires\u003D1356844210\u0026AWSAccessKeyId\u003DAKIAIGREZ7J53KZ23QKQimg/icon_clock.gif
    1115
    12 I suspect that the assumption the DateTime widget is relying on ({% static a+b %} should be equivelant to {% static a %}b) is invalid, and it should be using a more robust method to determine the static URL of its resources. The DateTime widget appears to be the only element depending on __admin_media_prefix__, and thus the only one to fail when switching to a backend that doesn't support its assumption.
     16I suspect that the assumption the DateTime widget is relying on ({% static a+b %} should be equivelant to {% static a %}b) is invalid, and it should be using a more robust method to determine the static URL of its resources. The DateTime widget appears to be the only element depending on !__admin_media_prefix!__, and thus the only one to fail when switching to a backend that doesn't support its assumption.
Back to Top