Anonymous avatar Anonymous committed 03633bd

output 'None' instead of empty table

Comments (0)

Files changed (1)

                         ${proc_type}
                 </p>
                 <h4>Parameters</h4>
-                <table id="parameters">
+                ${parameters}
+                <h4>Return</h4>
+                ${results}
+                <hr style="margin-bottom:0px;" />
+                <nav>
+                        <a href="${prev_link}" style="float:left;">previous</a>
+                        <a href="${index_link}">index</a>
+                        <a href="${next_link}" style="float:right;">next</a>
+                </nav>
+        </body>
+</html>
+"""
+TABLE_HTML = """
+                <table>
                         <thead>
                                 <tr>
                                         <th>Type</th>
                                 </tr>
                         </thead>
                         <tbody>
-                                ${parameters}
+                                ${body}
                         </tbody>
                 </table>
-                <h4>Return</h4>
-                <table id="return">
-                        <thead>
-                                <tr>
-                                        <th>type</th>
-                                        <th>name</th>
-                                        <th>description</th>
-                                </tr>
-                        </thead>
-                        <tbody>
-                                ${results}
-                        </tbody>
-                </table>
-                <hr style="margin-bottom:0px;" />
-                <nav>
-                        <a href="${prev_link}" style="float:left;">previous</a>
-                        <a href="${index_link}">index</a>
-                        <a href="${next_link}" style="float:right;">next</a>
-                </nav>
-        </body>
-</html>
 """
 TR_HTML = """
                                 <tr ${class}>
 INDEX_TEMPLATE = """
 """
 
+MessageBox = ctypes.windll.user32.MessageBoxA
+
 def escape(html):
         """
         Returns the given HTML with ampersands, quotes and angle brackets encoded.
         return value
 
 def get_dir() :
-        MessageBox = ctypes.windll.user32.MessageBoxA
         response = ""
 
         # Check for new pygtk: this is new class in PyGtk 2.4
 
         return PROC_TYPES[t]
 
-def dump_table(lst) :
+def make_table(lst) :
         row = dict()
         html = ""
         alt = False
                 html += Template(TR_HTML).safe_substitute(row)
                 alt = not alt
 
-        return html
+        return Template(TABLE_HTML).safe_substitute({"body":html})
 
 def dump_proc(proc, outFile, mode, links) :
         d = dict()
         d["next_link"] = links[2]
 
         d["proc_name"] = escape(proc.proc_name)
-        d["proc_author"] = escape(proc.proc_author)
+
+        d["proc_author"] = ""
+        authors = proc.proc_author.split(',')
+        for author in authors :
+                d["proc_author"] += "%s<br>"%escape(author.strip())
+
         d["proc_date"] = escape(proc.proc_date)
         d["proc_copyright"] = escape(proc.proc_copyright)
         d["proc_blurb"] = escape(proc.proc_blurb)
         d["proc_help"] = escape(proc.proc_help)
         d["proc_type"] = dump_proc_type(escape(proc.proc_type))
 
-        d["parameters"] = dump_table(proc.params)
-        d["results"] = dump_table(proc.return_vals)
+        d["parameters"] = "<p>None</p>"
+        if (0 != proc.nparams) :
+                d["parameters"] = make_table(proc.params)
+
+        d["results"] = "<p>None</p>"
+        if (0 != proc.nreturn_vals) :
+                d["results"] = make_table(proc.return_vals)
 
         with open(outFile, mode) as f :
                 f.write(Template(PROC_HTML).safe_substitute(d))
         return "%s.html"%(slugify(pname))
 
 def dump_pdb() :
-        MessageBox = ctypes.windll.user32.MessageBoxA
 
         root = get_dir()
         if("" == root) :
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.