diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-07-29 20:30:32 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-07-29 20:30:32 +0000 |
commit | cf633e297502696b09f18919de541091560f9351 (patch) | |
tree | 3a462a757bc1a3e5d9e81e19f114df9c203d4012 /doc/build/lib/docstring.py | |
parent | f94d9efecc7956f12e6c87ecf6faef3be687adb1 (diff) | |
download | sqlalchemy-cf633e297502696b09f18919de541091560f9351.tar.gz |
- added Session constructor which turns autoflush/transactional on
- Session is used by unitofwork unit test now as well as session.py tests
- fixes to table/schema reflection broken last night
- doc updates
- other unittest fixes
Diffstat (limited to 'doc/build/lib/docstring.py')
-rw-r--r-- | doc/build/lib/docstring.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/doc/build/lib/docstring.py b/doc/build/lib/docstring.py index f0aebe92b..5d33667c7 100644 --- a/doc/build/lib/docstring.py +++ b/doc/build/lib/docstring.py @@ -34,7 +34,7 @@ class ObjectDoc(AbstractDoc): for x in objects if getattr(obj,x,None) is not None and (isinstance(getattr(obj,x), types.FunctionType)) - and not getattr(obj,x).__name__[0] == '_' + and not self._is_private_name(getattr(obj,x).__name__) ] if sort: functions.sort(lambda a, b: cmp(a.__name__, b.__name__)) @@ -43,7 +43,7 @@ class ObjectDoc(AbstractDoc): if getattr(obj,x,None) is not None and (isinstance(getattr(obj,x), types.TypeType) or isinstance(getattr(obj,x), types.ClassType)) - and (self.include_all_classes or not getattr(obj,x).__name__[0] == '_') + and (self.include_all_classes or not self._is_private_name(getattr(obj,x).__name__)) ] classes = list(set(classes)) if sort: @@ -53,11 +53,11 @@ class ObjectDoc(AbstractDoc): functions = ( [getattr(obj, x).im_func for x in obj.__dict__.keys() if isinstance(getattr(obj,x), types.MethodType) and - (getattr(obj, x).__name__ == '__init__' or not getattr(obj,x).__name__[0] == '_') + (getattr(obj, x).__name__ == '__init__' or not self._is_private_name(getattr(obj,x).__name__)) ] + [(x, getattr(obj, x)) for x in obj.__dict__.keys() if _is_property(getattr(obj,x)) and - not x[0] == '_' + not self._is_private_name(x) ] ) functions.sort(lambda a, b: cmp(getattr(a, '__name__', None) or a[0], getattr(b, '__name__', None) or b[0] )) @@ -100,7 +100,15 @@ class ObjectDoc(AbstractDoc): self.classes = [] for class_ in classes: self.classes.append(ObjectDoc(class_)) - + + def _is_private_name(self, name): + if re.match(r'^__.*__$', name): + return False + elif name.startswith('_'): + return True + else: + return False + def _get_inherits(self): for item in self._inherits: if item[0] in self.allobjects: |