diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-07 15:24:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-07 15:36:25 +0300 |
commit | 987e9e2145fd31e9a3f763819b0e942ccd93bb65 (patch) | |
tree | b9370a5f3e27144199f0c684ff9ca3e336341cf4 /release/scripts/startup/bl_operators | |
parent | c55b578c9e1f4f5d03fbac01c7efa070e1d6970d (diff) |
Fix T84469: Online manual raises an exception with key-map options
Report an error instead of raising a Python exception.
Currently these properties aren't written to the manual
so it's best to show an error.
Diffstat (limited to 'release/scripts/startup/bl_operators')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 350d9391acf..bef3e5d4384 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -974,7 +974,7 @@ class WM_OT_path_open(Operator): return {'FINISHED'} -def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""): +def _wm_doc_get_id(doc_id, do_url=True, url_prefix="", report=None): def operator_exists_pair(a, b): # Not fast, this is only for docs. @@ -1025,6 +1025,11 @@ def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""): # Check class for dynamically registered types. rna_class = bpy.types.PropertyGroup.bl_rna_get_subclass_py(class_name) + if rna_class is None: + if report is not None: + report({'ERROR'}, iface_("Type \"%s\" can not be found") % class_name) + return None + # Detect if this is a inherited member and use that name instead. rna_parent = rna_class.bl_rna rna_prop = rna_parent.properties.get(class_prop) @@ -1084,9 +1089,9 @@ class WM_OT_doc_view_manual(Operator): return url def execute(self, _context): - rna_id = _wm_doc_get_id(self.doc_id, do_url=False) + rna_id = _wm_doc_get_id(self.doc_id, do_url=False, report=self.report) if rna_id is None: - return {'PASS_THROUGH'} + return {'CANCELLED'} url = self._lookup_rna_url(rna_id) @@ -1118,9 +1123,9 @@ class WM_OT_doc_view(Operator): _prefix = ("https://docs.blender.org/api/master") def execute(self, _context): - url = _wm_doc_get_id(self.doc_id, do_url=True, url_prefix=self._prefix) + url = _wm_doc_get_id(self.doc_id, do_url=True, url_prefix=self._prefix, report=self.report) if url is None: - return {'PASS_THROUGH'} + return {'CANCELLED'} import webbrowser webbrowser.open(url) |