summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-11 17:58:49 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-11 17:58:49 -0500
commit2a289e915e2d2f479300cecbe57b7495646e1ce7 (patch)
tree47545fe78e1db8630282c88a2e6adc8893651ba5 /lib/sqlalchemy/util
parentad9b85fa8e751f5bfc8c27705e86898131dbc62e (diff)
downloadsqlalchemy-2a289e915e2d2f479300cecbe57b7495646e1ce7.tar.gz
- fix long lines in test_attributes
- add deprecation warning to get_history() when passed True or False, convert - rearrange symbol() so we can get sphinx autodata to work
Diffstat (limited to 'lib/sqlalchemy/util')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index d723a1869..4088e85cb 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -657,10 +657,12 @@ class classproperty(property):
class _symbol(object):
- def __init__(self, name):
+ def __init__(self, name, doc=None):
"""Construct a new named symbol."""
assert isinstance(name, str)
self.name = name
+ if doc:
+ self.__doc__ = doc
def __reduce__(self):
return symbol, (self.name,)
def __repr__(self):
@@ -682,16 +684,23 @@ class symbol(object):
Repeated calls of symbol('name') will all return the same instance.
+ The optional ``doc`` argument assigns to ``__doc__``. This
+ is strictly so that Sphinx autoattr picks up the docstring we want
+ (it doesn't appear to pick up the in-module docstring if the datamember
+ is in a different module - autoattribute also blows up completely).
+ If Sphinx fixes/improves this then we would no longer need
+ ``doc`` here.
+
"""
symbols = {}
_lock = threading.Lock()
- def __new__(cls, name):
+ def __new__(cls, name, doc=None):
cls._lock.acquire()
try:
sym = cls.symbols.get(name)
if sym is None:
- cls.symbols[name] = sym = _symbol(name)
+ cls.symbols[name] = sym = _symbol(name, doc)
return sym
finally:
symbol._lock.release()