Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#15120 closed (invalid)

django.contrib.staticfiles.views.serve fails in windows7

Reported by: oyvind Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: staticfiles
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Using python 2.6


STATIC_URL = '/media/'
    ("tinymce", "C:\\fivethreeo_project\\tinymce"),

Using runserver --insecure in latest svn fails with this traceback:

[19/Jan/2011 17:24:16] "GET /media/tinymce/jscripts/tiny_mce/tiny_mce.js HTTP/1.
1" 500 1409
Traceback (most recent call last):
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\core\serv
ers\", line 282, in run
    self.result = application(self.environ, self.start_response)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\", line 75, in __call__
    return super(StaticFilesHandler, self).__call__(environ, start_response)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\core\hand
lers\", line 273, in __call__
    response = self.get_response(request)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\", line 65, in get_response
    return self.serve(request)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\", line 58, in serve
    return serve(request, self.file_path(request.path), insecure=True)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\", line 87, in serve
    response["Last-Modified"] = http_date(statobj[stat.ST_MTIME])
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\utils\htt", line 69, in http_date
    rfcdate = formatdate(epoch_seconds)
  File "C:\Python26\Lib\email\", line 160, in formatdate
    now = time.gmtime(timeval)
ValueError: (22, 'Invalid argument')

Removing line 87 makes the problem go away

Change History (3)

comment:1 Changed 8 years ago by oyvind

statobj[stat.ST_MTIME] is a negative number

comment:2 Changed 8 years ago by oyvind

Resolution: invalid
Status: newclosed

Wrong date on file is in 2098, not a issue until 2038

comment:3 Changed 8 years ago by Jannis Leidel

I suppose we could wrap this with a try block and return a 404 to not bomb , not sure..

Note: See TracTickets for help on using tickets.
Back to Top