From 9d5fd0895e710f2ea7d4c2e7e2faeed65d223203 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 21 Jun 2015 14:11:17 +0200 Subject: Only add about-user section on /W MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- fingerchange.py | 12 +++++++++--- 1 file 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() -- cgit v1.2.3-70-g09d2