summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-06-21 14:11:17 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-06-21 14:12:56 +0200
commit9d5fd0895e710f2ea7d4c2e7e2faeed65d223203 (patch)
tree6c6806d212c1fe486335f91d28bc16330286b46c
parent6d48345b3c402b5180c86465fb56627f2501d282 (diff)
downloadfingerchange-9d5fd0895e710f2ea7d4c2e7e2faeed65d223203.tar.xz
Only add about-user section on /W
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rw-r--r--fingerchange.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/fingerchange.py b/fingerchange.py
index 4619c16..53d8495 100644
--- a/fingerchange.py
+++ b/fingerchange.py
@@ -76,7 +76,7 @@ def format_rep_changes(user):
return msg
-def format_user(user):
+def format_user(user, long_output=True):
msg = '\n'
msg += format_header(user['account_id'], '=')
msg += format_field('uid', user['user_id'])
@@ -90,7 +90,7 @@ def format_user(user):
msg += format_rep_changes(user)
msg += '\n'
- if 'about_me' in user:
+ if long_output and 'about_me' in user:
msg += format_header('About User', '-') + '\n'
soup = BeautifulSoup(user['about_me'])
@@ -114,6 +114,12 @@ def handle_client(reader, writer):
return
user, site = line.split('@')
+ if user.startswith('/W'):
+ long_output = True
+ user = user[3:]
+ else:
+ long_output = False
+
try:
uid = int(user)
users = [get_user_by_uid(site, uid)]
@@ -121,7 +127,7 @@ def handle_client(reader, writer):
users = get_users_by_name(site, user)
for user in users:
- msg = format_user(user)
+ msg = format_user(user, long_output)
writer.write(msg.encode('utf-8'))
writer.close()