Commit ad658714 authored by Seblu's avatar Seblu
Browse files

Restore options only if already exists

parent bb886079
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ class TqlCommand(RemoteCommand):
        for _o in kwargs.copy():
            if _o.startswith("_"):
                o = _o[1:]
                _saved_options[o] = getattr(self.options, o)
                _saved_options[o] = getattr(self.options, o) if hasattr(self.options, o) else None
                setattr(self.options, o, kwargs[_o])
                kwargs.pop(_o)
        # set tql_index to 1 if any
@@ -335,6 +335,9 @@ class TqlCommand(RemoteCommand):
            out = self._secure_rpccall(args, **kwargs)
        # restore saved options
        for (k, v) in _saved_options.items():
            if v is None:
                delattr(self.options, k)
            else:
                setattr(self.options, k, v)
        # return output
        return out