Browse Source

Work around lack of f-strings in Python 3.5.

This forwards the arguments and keywords to `str.format`. It's a good
poor man's f-string, anyway...
pull/152/head
Adam Johnson 5 years ago
parent
commit
3ac3ee2186
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 9
      korman/exporter/explosions.py

9
korman/exporter/explosions.py

@ -23,8 +23,13 @@ class NonfatalExportError(Exception):
class ExportError(Exception):
def __init__(self, value="Undefined Export Error"):
super(Exception, self).__init__(value)
def __init__(self, *args, **kwargs):
if not args:
super(Exception, self).__init__("Undefined Export Error")
elif len(args) > 1:
super(Exception, self).__init__(args[0].format(*args[1:], **kwargs))
else:
super(Exception, self).__init__(args[0])
class BlenderOptionNotSupportedError(ExportError):

Loading…
Cancel
Save