generate_html_documentation() => html documentation for the server Generates HTML documentation for the server using introspection for installed functions and instances that do not implement the _dispatch method. Alternatively, instances can choose to implement the _
(self)
| 845 | self.server_documentation = server_documentation |
| 846 | |
| 847 | def generate_html_documentation(self): |
| 848 | """generate_html_documentation() => html documentation for the server |
| 849 | |
| 850 | Generates HTML documentation for the server using introspection for |
| 851 | installed functions and instances that do not implement the |
| 852 | _dispatch method. Alternatively, instances can choose to implement |
| 853 | the _get_method_argstring(method_name) method to provide the |
| 854 | argument string used in the documentation and the |
| 855 | _methodHelp(method_name) method to provide the help text used |
| 856 | in the documentation.""" |
| 857 | |
| 858 | methods = {} |
| 859 | |
| 860 | for method_name in self.system_listMethods(): |
| 861 | if method_name in self.funcs: |
| 862 | method = self.funcs[method_name] |
| 863 | elif self.instance is not None: |
| 864 | method_info = [None, None] # argspec, documentation |
| 865 | if hasattr(self.instance, '_get_method_argstring'): |
| 866 | method_info[0] = self.instance._get_method_argstring(method_name) |
| 867 | if hasattr(self.instance, '_methodHelp'): |
| 868 | method_info[1] = self.instance._methodHelp(method_name) |
| 869 | |
| 870 | method_info = tuple(method_info) |
| 871 | if method_info != (None, None): |
| 872 | method = method_info |
| 873 | elif not hasattr(self.instance, '_dispatch'): |
| 874 | try: |
| 875 | method = resolve_dotted_attribute( |
| 876 | self.instance, |
| 877 | method_name |
| 878 | ) |
| 879 | except AttributeError: |
| 880 | method = method_info |
| 881 | else: |
| 882 | method = method_info |
| 883 | else: |
| 884 | assert 0, "Could not find method in self.functions and no "\ |
| 885 | "instance installed" |
| 886 | |
| 887 | methods[method_name] = method |
| 888 | |
| 889 | documenter = ServerHTMLDoc() |
| 890 | documentation = documenter.docserver( |
| 891 | self.server_name, |
| 892 | self.server_documentation, |
| 893 | methods |
| 894 | ) |
| 895 | |
| 896 | return documenter.page(html.escape(self.server_title), documentation) |
| 897 | |
| 898 | class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): |
| 899 | """XML-RPC and documentation request handler class. |