Make a copy of mutable list in pull()

This commit is contained in:
Shy 2017-03-21 12:08:00 +01:00
parent f63de4f5bb
commit bcf0fd6029

View file

@ -62,7 +62,7 @@ class C4Interface():
def pull(self, topic=[]): def pull(self, topic=[]):
"""Return current state of topic.""" """Return current state of topic."""
from paho.mqtt import subscribe from paho.mqtt import subscribe
topic = topic or self.topic topic = topic.copy() or self.topic
# <topic> must be a list # <topic> must be a list
if type(topic) == str: if type(topic) == str:
topic = [topic] topic = [topic]
@ -1047,7 +1047,7 @@ if __name__ == "__main__":
if args.k_switch != None: if args.k_switch != None:
Keller().light_switch(args.k_switch) Keller().light_switch(args.k_switch)
# No command line options or only debug? # No or no useful command line options?
if len(sys.argv) <= 1 or len(sys.argv) == 2 and args.debug: if len(sys.argv) <= 1 or len(sys.argv) == 2 and args.debug:
parser.print_help() parser.print_help()