Mercurial > hg
comparison doc/gendoc.py @ 14943:d3bb825ddae3
globally: use safehasattr(x, '__call__') instead of hasattr(x, '__call__')
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 25 Jul 2011 16:24:37 -0500 |
parents | f5b0834cf685 |
children | 525fdb738975 |
comparison
equal
deleted
inserted
replaced
14942:5b072d4b62f2 | 14943:d3bb825ddae3 |
---|---|
7 from mercurial import encoding | 7 from mercurial import encoding |
8 from mercurial.commands import table, globalopts | 8 from mercurial.commands import table, globalopts |
9 from mercurial.i18n import _ | 9 from mercurial.i18n import _ |
10 from mercurial.help import helptable | 10 from mercurial.help import helptable |
11 from mercurial import extensions | 11 from mercurial import extensions |
12 from mercurial import util | |
12 | 13 |
13 def get_desc(docstr): | 14 def get_desc(docstr): |
14 if not docstr: | 15 if not docstr: |
15 return "", "" | 16 return "", "" |
16 # sanitize | 17 # sanitize |
93 continue | 94 continue |
94 for name in names: | 95 for name in names: |
95 ui.write(".. _%s:\n" % name) | 96 ui.write(".. _%s:\n" % name) |
96 ui.write("\n") | 97 ui.write("\n") |
97 section(ui, sec) | 98 section(ui, sec) |
98 if hasattr(doc, '__call__'): | 99 if util.safehasattr(doc, '__call__'): |
99 doc = doc() | 100 doc = doc() |
100 ui.write(doc) | 101 ui.write(doc) |
101 ui.write("\n") | 102 ui.write("\n") |
102 | 103 |
103 section(ui, _("Extensions")) | 104 section(ui, _("Extensions")) |