summaryrefslogtreecommitdiff
path: root/repoze
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-08-31 13:13:46 +0000
committerChris McDonough <chrism@agendaless.com>2010-08-31 13:13:46 +0000
commit2d4f61826a0ebc5330b869713abf7a36a69c0e6a (patch)
tree15ab99d60d0fadc5a8824db16934dd744ab6053e /repoze
parent211c300c104313796b1d298e3d95db2d5adaf848 (diff)
downloadpyramid-2d4f61826a0ebc5330b869713abf7a36a69c0e6a.tar.gz
pyramid-2d4f61826a0ebc5330b869713abf7a36a69c0e6a.tar.bz2
pyramid-2d4f61826a0ebc5330b869713abf7a36a69c0e6a.zip
- The reify decorator now maintains the docstring of the function it
wraps.
Diffstat (limited to 'repoze')
-rw-r--r--repoze/bfg/decorator.py4
-rw-r--r--repoze/bfg/tests/test_decorator.py6
2 files changed, 10 insertions, 0 deletions
diff --git a/repoze/bfg/decorator.py b/repoze/bfg/decorator.py
index d30a06658..98d7b36b5 100644
--- a/repoze/bfg/decorator.py
+++ b/repoze/bfg/decorator.py
@@ -6,6 +6,10 @@ class reify(object):
def __init__(self, wrapped):
self.wrapped = wrapped
+ try:
+ self.__doc__ = wrapped.__doc__
+ except: # pragma: no cover
+ pass
def __get__(self, inst, objtype=None):
if inst is None:
diff --git a/repoze/bfg/tests/test_decorator.py b/repoze/bfg/tests/test_decorator.py
index b1ac2252d..d41c62c65 100644
--- a/repoze/bfg/tests/test_decorator.py
+++ b/repoze/bfg/tests/test_decorator.py
@@ -19,5 +19,11 @@ class TestReify(unittest.TestCase):
result = decorator.__get__(None)
self.assertEqual(result, decorator)
+ def test___doc__copied(self):
+ def wrapped(inst):
+ """My doc"""
+ decorator = self._makeOne(wrapped)
+ self.assertEqual(decorator.__doc__, "My doc")
+
class Dummy(object):
pass