FF3 src error in django admin calendar

18 views
Skip to first unread message

Alastair Campbell

unread,
Jul 8, 2009, 4:22:58 AM7/8/09
to django...@googlegroups.com
Has anyone else started getting application error emails from the
Django admin after updating to Firefox 3.5?

I haven't had much change to investigate, but I get 500 error emails with:

ValueError: invalid literal for int(): 706/img/admin/icon_clock.gif

Looking via Firebug, the src for the image (imported by JavaScript) is
locally referenced, not absolutely in FF3.5. The upper half of this
screen shot is FF3.5:
http://alastairc.ac/testing/django_admin_calendar_images.png

I'm surprised I didn't find more from Googling, apart from a couple of
references to the issue in Safari. Are people not upgrading to FF3.5?
I have a pretty standard (Django 1.0) setup, and it's obviously a
difference in Firefoxs.

-Alastair

Karen Tracey

unread,
Jul 8, 2009, 8:08:29 AM7/8/09
to django...@googlegroups.com

I've been using Firefox 3.5 since it was in beta and called 3.1 and not had any problem like this.  If the source for the page shows that the img src values are relative, not absolute, it really sounds like the problem is your ADMIN_MEDIA_PREFIX setting. 

Karen

Alastair Campbell

unread,
Jul 8, 2009, 9:32:45 AM7/8/09
to django...@googlegroups.com
On Wed, Jul 8, 2009 at 1:08 PM, Karen Tracey<kmtr...@gmail.com> wrote:
> If the source for the page shows that the img src
> values are relative, not absolute, it really sounds like the problem is your
> ADMIN_MEDIA_PREFIX setting.

My setting is:
ADMIN_MEDIA_PREFIX = '/media/admin/'

Also:
MEDIA_URL = 'http://ukwindsurfing.com/media/'

I'm not sure why a change of browser would affect this?

It does seem to be a JavaScript thing, where the addCalendar (and
clock) function in DateTimeShortcuts.js isn't working?

That function uses:
quickElement('img', cal_link, '', 'src',
DateTimeShortcuts.admin_media_prefix + 'img/admin/icon_calendar.gif',
'alt', gettext('Calendar'));

In FF3.5 that returns img/admin/icon_calendar.gif
In FF3.0 that returns
http://ukwindsurfing.com/media/admin/img/admin/icon_calendar.gif

The prefix is from the init section above:
var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);

Is that a problem in the new version of Firefox?

-Alastair

Xiong Chiamiov

unread,
Jul 8, 2009, 1:01:33 PM7/8/09
to Django users
On Jul 8, 1:22 am, Alastair Campbell <ala...@gmail.com> wrote:
> Has anyone else started getting application error emails from the
> Django admin after updating to Firefox 3.5?

Before 3.5, actually. The function that modifies the path to the
image is called once the page has finished loading, and Firefox never
registers that the page is done (the status bar registers that it is
still waiting for something, though it is not, since this problem
persists on local pages). I'm inclined to think that it's the result
of one of my many extensions, or some combination of them. I haven't
taken the time, however, to go through and isolate it, nor to test
with a vanilla Firefox; I know that the problem doesn't exist in Opera
or Konqueror, though.

Xiong Chiamiov

unread,
Jul 8, 2009, 1:02:49 PM7/8/09
to Django users
Oh, I forgot to note that Firebug is very helpful in these kind of
situations, as you can call the functions explicitly and see what
happens.

Alastair Campbell

unread,
Jul 8, 2009, 2:22:16 PM7/8/09
to django...@googlegroups.com
Ok, I think I got to the bottom of this, it's a combination of TinyMCE
and Firefox 3.5

Unfortunately my Firebug expertise isn't that great, but with a few
alert boxes, it is the IF statement in DateTimeShortcuts.js that isn't
firing:

var scripts = document.getElementsByTagName('script');
for (var i=0; i<scripts.length; i++) {
if (scripts[i].src.match(/DateTimeShortcuts/)) {


var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);

break;
}
}

Adding an alert(scripts[i].src) at the top of the FOR loop stops after
the 'core.js' file, so that IF statement never fires.

If I add a console.log at that point, the JavaScript runs, sometimes,
but sometimes stops after core.js.

TinyMCE is two files in the source code, but then it imports another
10 (ish) for the pluggins.

It *seems* like Firefox gives up on the script loop when there are so
many to go through.

My solution has been to move the TinyMCE source files to after the
admin JS, which works for me, but is somewhat annoying.

I'll see if I can put a test case together, it might be worth adding a
bug report somewhere, although I'm not sure if it's for TinyMCE or
Firefox?!?

Thanks,

-Alastair

J

unread,
Aug 26, 2009, 7:59:29 PM8/26/09
to django...@googlegroups.com

I'm getting the same problem. --Using tinymce and FF3.5.

If you find a good fix, I hope you share! Cheers!

Ron W

unread,
Sep 29, 2009, 6:45:46 PM9/29/09
to Django users
I've been getting thrown 500 errors from someone using the admin from
what looks like Mac Firefox 3.5 with the Huffington Post's Firefox
extension (why on earth..), but its looking for /img/admin/
icon_calendar.gif/ which isn't from TinyMCE its the Django admin date
picker icon. Its really odd I can't get it to replicate locally.

Love to hear if somebody has a fix its driving me crazy

Daniel Roseman

unread,
Sep 30, 2009, 6:08:37 AM9/30/09
to Django users
On Sep 29, 11:45 pm, Ron W <zenji...@gmail.com> wrote:
> I've been getting thrown 500 errors from someone using the admin from
> what looks like Mac Firefox 3.5 with the Huffington Post's Firefox
> extension (why on earth..), but its looking for /img/admin/
> icon_calendar.gif/ which isn't from TinyMCE its the Django admin date
> picker icon. Its really odd I can't get it to replicate locally.
>
> Love to hear if somebody has a fix its driving me crazy


It is the combination of TinyMCE and Firefox 3.5 that is the problem.
To quote myself from a previous message about this:

> What seems to be happening is thatTinyMCEinjects various scripts
> into the DOM. For some reason, in Firefox 3.5 this causes
> document.getElementsByTagName('script') to no longer return the full
> list of scripts in the DOM. Django's DateTimeShortcuts.js script uses
> this list to work out its own source path (which it uses to find the
> path to the admin icons), but now can no longer find itself in that
> list, so fails.
>
> This is really a bug either in Firefox or inTinyMCE, but could
> probably be averted if Django had a better way for js files to get the
> value of ADMIN_MEDIA_PREFIX. Not sure if this has been addressed in
> the recent Google Summer of Code project to rewrite the admin
> javascript.

I've got some time this week so I might try and work up a patch: I
think it would be best to set an admin_media_path variable in the
admin base template, which all the JS files can use, although I
suspect this might run into 'design decision needed' territory.
--
DR.

Dan Ward

unread,
Oct 28, 2009, 12:05:00 PM10/28/09
to Django users
I've had the issue myself, and noticed a bug has been reported on the
part of Django's DateTimeShortcuts.js script relying on the DOM to
fetch the admin_media_prefix. A milestone of 1.2 has also been set by
Jacob on the ticket, so fingers-crossed, other than the patch, an
upcoming update will resolve the issue.

The ticket information can be found here for anybody interested:
http://code.djangoproject.com/ticket/11967

Thanks,
Daniel Ward (http://danward.tel)
Reply all
Reply to author
Forward
0 new messages