From fdaa89727d8fdba4ad6e9b6c54c5fca82ebc1a6a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 9 Jul 2009 17:39:05 +0000 Subject: - Added a workaround for a bug in Python 2.6, 2.6.1, and 2.6.2 having to do with a recursion error in the mimetypes module when trying to serve static files from Paste's FileApp: http://bugs.python.org/issue5853. Symptom: File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type return guess_type(url, strict) RuntimeError: maximum recursion depth exceeded. Thanks to Armin Ronacher for identifying the symptom and pointing out a fix. --- CHANGES.txt | 9 +++++++++ repoze/bfg/view.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 3e46cc184..e08239190 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,15 @@ Next release ============ +- Added a workaround for a bug in Python 2.6, 2.6.1, and 2.6.2 having + to do with a recursion error in the mimetypes module when trying to + serve static files from Paste's FileApp: + http://bugs.python.org/issue5853. Symptom: File + "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type return + guess_type(url, strict) RuntimeError: maximum recursion depth + exceeded. Thanks to Armin Ronacher for identifying the symptom and + pointing out a fix. + - Minor edits to tutorials for accuracy based on feedback. 1.0 (2009-07-05) diff --git a/repoze/bfg/view.py b/repoze/bfg/view.py index 2c0e3efdc..f099c4665 100644 --- a/repoze/bfg/view.py +++ b/repoze/bfg/view.py @@ -1,6 +1,19 @@ import os import inspect +import mimetypes + +try: + # See http://bugs.python.org/issue5853 which is a recursion bug + # that seems to effect Python 2.6, Python 2.6.1, and 2.6.2 (a fix + # has been applied on the Python 2 trunk). This workaround should + # really be in Paste if anywhere, but it's easiest to just do it + # here and get it over with to avoid needing to deal with any + # fallout. + mimetypes.init() +except AttributeError: + pass + from paste.urlparser import StaticURLParser from zope.component import queryMultiAdapter @@ -19,6 +32,7 @@ deprecated('view_execution_permitted', "view_execution_permitted')", ) + _marker = object() def render_view_to_response(context, request, name='', secure=True): -- cgit v1.2.3