Эх сурвалжийг харах

Fix crash in case there are no tags

 Fix #53
Oz N Tiram 7 жил өмнө
parent
commit
e201a2ca1c
1 өөрчлөгдсөн 6 нэмэгдсэн , 1 устгасан
  1. 6 1
      pwman/data/nodes.py

+ 6 - 1
pwman/data/nodes.py

@@ -37,7 +37,12 @@ class Node(object):
                           kwargs.get('tags', '')]
 
     def __str__(self):
-        tags =",".join(t.decode() for t in self.tags) if len(self.tags) > 1 else self.tags[0].decode()  # noqa
+        tags = self.tags
+        if tags:
+            tags = ", ".join(t.decode() for t in tags)
+        else:
+            tags = ""
+
         p = "{entry_title:>{width}} {entry:<{width}}\n".format(
             entry_title=pwman.ui.tools.typeset('Username:', Fore.RED),
             width=10, entry=str(self.username))