Jelajahi Sumber

Fix crash in case there are no tags

 Fix #53
Oz N Tiram 7 tahun lalu
induk
melakukan
e201a2ca1c
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      pwman/data/nodes.py

+ 6 - 1
pwman/data/nodes.py

@@ -37,7 +37,12 @@ class Node(object):
                           kwargs.get('tags', '')]
                           kwargs.get('tags', '')]
 
 
     def __str__(self):
     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(
         p = "{entry_title:>{width}} {entry:<{width}}\n".format(
             entry_title=pwman.ui.tools.typeset('Username:', Fore.RED),
             entry_title=pwman.ui.tools.typeset('Username:', Fore.RED),
             width=10, entry=str(self.username))
             width=10, entry=str(self.username))