Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#15120 closed (invalid)

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

Reported by: oyvind Owned by: nobody
Component: Contrib apps Version: dev
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

Description

Using python 2.6

Settings:

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

Using manage.py 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\basehttp.py", line 282, in run
    self.result = application(self.environ, self.start_response)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\handlers.py", line 75, in __call__
    return super(StaticFilesHandler, self).__call__(environ, start_response)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\core\hand
lers\wsgi.py", line 273, in __call__
    response = self.get_response(request)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\handlers.py", line 65, in get_response
    return self.serve(request)
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\contrib\s
taticfiles\handlers.py", 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\views.py", line 87, in serve
    response["Last-Modified"] = http_date(statobj[stat.ST_MTIME])
  File "c:\fivethreeo_project\virtualenvs\fivethreeo\src\django\django\utils\htt
p.py", line 69, in http_date
    rfcdate = formatdate(epoch_seconds)
  File "C:\Python26\Lib\email\utils.py", 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 by oyvind, 14 years ago

statobj[stat.ST_MTIME] is a negative number

comment:2 by oyvind, 14 years ago

Resolution: invalid
Status: newclosed

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

comment:3 by Jannis Leidel, 14 years ago

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