summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordev <dev@mail.code-35.com>2012-03-06 00:47:41 +0100
committerdev <dev@mail.code-35.com>2012-03-06 00:47:41 +0100
commit719a379e204104a8955b5691a6152e45d978d4ff (patch)
tree2cdd44feb8f992b2aa54b1005e6625bdf6da18ff
parentca9f88da0aab4501ec05a9d9ac9a40e131a131dc (diff)
downloadpyramid-719a379e204104a8955b5691a6152e45d978d4ff.tar.gz
pyramid-719a379e204104a8955b5691a6152e45d978d4ff.tar.bz2
pyramid-719a379e204104a8955b5691a6152e45d978d4ff.zip
fixed issue #461
- config.add_view() raises an AttributeError for __text__ if the View is an instancemethod. added wrapper adding the __text__ attribute if it isnt present yet.
-rw-r--r--pyramid/config/views.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index 0f70c604f..7d0a5a971 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -139,7 +139,18 @@ class ViewDeriver(object):
self.http_cached_view(
self.decorated_view(
self.rendered_view(
- self.mapped_view(view)))))))))
+ self.mapped_view(
+ self.text_wrapped_view(view))))))))))
+ @wraps_view
+ def text_wrapped_view(self, view):
+ # wraps the view and adds __text__ attribute
+ # intended for instancemethods
+ if hasattr(view, '__text__'):
+ return view
+ def text_wrapper(context, request):
+ return view(context, request)
+ text_wrapper.__text__ = ''
+ return text_wrapper
@wraps_view
def mapped_view(self, view):