summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-07-09 17:39:05 +0000
committerChris McDonough <chrism@agendaless.com>2009-07-09 17:39:05 +0000
commitfdaa89727d8fdba4ad6e9b6c54c5fca82ebc1a6a (patch)
tree88c393fa1dd113b3b658056d7c660eb01e0cad53
parent48ed321cde95950bff3e8d135b11766df984ac10 (diff)
downloadpyramid-fdaa89727d8fdba4ad6e9b6c54c5fca82ebc1a6a.tar.gz
pyramid-fdaa89727d8fdba4ad6e9b6c54c5fca82ebc1a6a.tar.bz2
pyramid-fdaa89727d8fdba4ad6e9b6c54c5fca82ebc1a6a.zip
- 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.
-rw-r--r--CHANGES.txt9
-rw-r--r--repoze/bfg/view.py14
2 files changed, 23 insertions, 0 deletions
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):