diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-22 11:13:10 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-22 11:13:10 -0400 |
commit | 84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8 (patch) | |
tree | c5977862a8db696e078853cd12581d4d72ed9cf1 /src/sbin/bcfg2-info | |
parent | 26567899f7095e9404254d1430f1d87456d3fb41 (diff) | |
download | bcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.tar.gz bcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.tar.bz2 bcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.zip |
bcfg2-info: fixed building help message on 2.4 (from Michael Fenn)
Diffstat (limited to 'src/sbin/bcfg2-info')
-rwxr-xr-x | src/sbin/bcfg2-info | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 5bbe5b43b..cfcc95be2 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -736,10 +736,13 @@ def build_usage(): usage = dict() for attrname in dir(InfoCore): attr = getattr(InfoCore, attrname) - if (hasattr(attr, "__func__") and - attr.__func__.func_name not in cmd_blacklist and - attr.__func__.func_name.startswith("do_") and - attr.__func__.func_doc): + + # shim for python 2.4, __func__ is im_func + funcattr = getattr(attr, "__func__", getattr(attr, "im_func", None)) + if (funcattr != None and + funcattr.func_name not in cmd_blacklist and + funcattr.func_name.startswith("do_") and + funcattr.func_doc): usage[attr.__name__] = re.sub(r'\s+', ' ', attr.__doc__) return "Commands:\n" + "\n".join(usage[k] for k in sorted(usage.keys())) |