]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/bin/pwclient
pwclient: rename variable CONFIG_FILES to be singular
[patchwork] / apps / patchwork / bin / pwclient
index e642195153a08e95b19dd0e38126dfd991e60b7b..2104f593f9ca37618d33cc4bee0530366aaea76a 100755 (executable)
@@ -34,7 +34,7 @@ import ConfigParser
 # for the URL to access.  If that is unspecified, it will fallback to
 # the hardcoded default value specified here.
 DEFAULT_URL = "http://patchwork/xmlrpc/"
-CONFIG_FILES = [os.path.expanduser('~/.pwclientrc')]
+CONFIG_FILE = os.path.expanduser('~/.pwclientrc')
 
 class Filter:
     """Filter for selecting patches."""
@@ -165,10 +165,10 @@ def person_ids_by_name(rpc, name):
 
 def list_patches(patches):
     """Dump a list of patches to stdout."""
-    print("%-5s %-12s %s" % ("ID", "State", "Name"))
-    print("%-5s %-12s %s" % ("--", "-----", "----"))
+    print("%-7s %-12s %s" % ("ID", "State", "Name"))
+    print("%-7s %-12s %s" % ("--", "-----", "----"))
     for patch in patches:
-        print("%-5d %-12s %s" % (patch['id'], patch['state'], patch['name']))
+        print("%-7d %-12s %s" % (patch['id'], patch['state'], patch['name']))
 
 def action_list(rpc, filter, submitter_str, delegate_str):
     filter.resolve_ids(rpc)
@@ -231,7 +231,7 @@ def action_info(rpc, patch_id):
     print(s)
     print('-' * len(s))
     for key, value in sorted(patch.iteritems()):
-        print("- %- 14s: %s" % (key, value))
+        print("- %- 14s: %s" % (key, unicode(value).encode("utf-8")))
 
 def action_get(rpc, patch_id):
     patch = rpc.patch_get(patch_id)
@@ -351,7 +351,7 @@ def main():
     url = DEFAULT_URL
 
     config = ConfigParser.ConfigParser()
-    config.read(CONFIG_FILES)
+    config.read([CONFIG_FILE])
 
     # grab settings from config files
     if config.has_option('base', 'url'):