Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 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: UI/UX:

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

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by oyvind

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

statobj[stat.ST_MTIME] is a negative number

comment:2 Changed 3 years ago by oyvind

  • Resolution set to invalid
  • Status changed from new to closed

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

comment:3 Changed 3 years ago by jezdez

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.