|
@@ -69,10 +69,18 @@ def main():
|
|
|
if kind != "150" and kind != "Admin": # We only have this two log types
|
|
|
raise KindError
|
|
|
if method == "POST":
|
|
|
- send_mail = input()
|
|
|
- auth(user_id, "POST", kind) # Check if the user can post for the requested kind
|
|
|
- log = sys.stdin.read() # Read the log content
|
|
|
- method_post(kind, user_name, date, tags, log, send_mail == "MAIL")
|
|
|
+ optional_line = input()
|
|
|
+ auth(user_id, "POST", kind) # Check if the user can post for the requested kind
|
|
|
+ log = sys.stdin.read() # Read the log content
|
|
|
+ if optional_line == "MAIL":
|
|
|
+ send_mail = True
|
|
|
+ else:
|
|
|
+ send_mail = False
|
|
|
+ # optional_line consumes the input but it is not
|
|
|
+ # a recognized header, so it's
|
|
|
+ # the first line of the log
|
|
|
+ log = optional_line + log
|
|
|
+ method_post(kind, user_name, date, tags, log, send_mail)
|
|
|
elif method == "GET":
|
|
|
auth(user_id, "GET", kind) # Check if the user can get logs for the requested kind
|
|
|
user_to_find = input() # Read the user name of the log writer to search
|