diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-08 15:37:41 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-08 15:37:41 +0000 |
commit | 14c0dc7b4a6ae0723b692d67b912ecd2c3847bb8 (patch) | |
tree | ced6ae023ab41fbfdb994b977e9fe72b8dd549dc /lib/sqlalchemy/util.py | |
parent | 4ab87682e14fbedaa34f140f2fe4fdf773fc2d2b (diff) | |
download | sqlalchemy-14c0dc7b4a6ae0723b692d67b912ecd2c3847bb8.tar.gz |
- cleaned up the attributes scan for reconstitute hooks
- added more careful check for "_should_exclude", guard against possible heisenbug activity
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r-- | lib/sqlalchemy/util.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index a9e7d2238..76c73ca6a 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -410,6 +410,20 @@ def class_hierarchy(cls): hier.add(s) return list(hier) +def iterate_attributes(cls): + """iterate all the keys and attributes associated with a class, without using getattr(). + + Does not use getattr() so that class-sensitive descriptors (i.e. property.__get__()) + are not called. + + """ + keys = dir(cls) + for key in keys: + for c in cls.__mro__: + if key in c.__dict__: + yield (key, c.__dict__[key]) + break + # from paste.deploy.converters def asbool(obj): if isinstance(obj, (str, unicode)): |