diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-07 05:02:56 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-07 05:02:56 +0000 |
commit | 2cc88a7a3233d6bd70ec174ba976d093dc7f0d98 (patch) | |
tree | 01bce05442cfc7b4759758a36c369e11b529c989 /ipalib/public.py | |
parent | 8a6041b7978d370418e99df8b9fc06b2055a39e6 (diff) | |
download | freeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.tar.gz freeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.tar.xz freeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.zip |
74: Finished opt.__rules_iter(); is_rule(obj) now returns False if obj is not callable; updated unit tests
Diffstat (limited to 'ipalib/public.py')
-rw-r--r-- | ipalib/public.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ipalib/public.py b/ipalib/public.py index b43e0af9..baae83e4 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -35,9 +35,7 @@ def rule(obj): return obj def is_rule(obj): - return getattr(obj, RULE_FLAG, False) is True - - + return callable(obj) and getattr(obj, RULE_FLAG, False) is True class opt(plugable.ReadOnly): @@ -65,7 +63,12 @@ class opt(plugable.ReadOnly): rules = property(__get_rules) def __rules_iter(self): - pass + for name in dir(self): + if name.startswith('_'): + continue + attr = getattr(self, name) + if is_rule(attr): + yield attr def validate(self, value): pass |