diff --git a/src/schema.py b/src/schema.py index 7f5f545..b0698f4 100644 --- a/src/schema.py +++ b/src/schema.py @@ -28,8 +28,12 @@ def error(code, description): def user_internal(ID, auth_hash, name, quip, bio, admin): - if not quip: quip = "" - if not bio: bio = "" + if not quip: + quip = "" + + if not bio: + bio = "" + return { "user_id": ID, # string "quip": quip, # (possibly empty) string @@ -41,8 +45,12 @@ def user_internal(ID, auth_hash, name, quip, bio, admin): def user_external(ID, name, quip, bio, admin): - if not quip: quip = "" - if not bio: bio = "" + if not quip: + quip = "" + + if not bio: + bio = "" + return { "user_id": ID, # string "quip": quip, # (possibly empty) string @@ -53,9 +61,12 @@ def user_external(ID, name, quip, bio, admin): def thread(ID, author, body, title, tags): - if not tags: tags = list() + if not tags: + tags = list() + body = formatting.parse(body, doquotes=False) now = time() + return { "thread_id": ID, # string "post_id": 1, # integer @@ -72,8 +83,10 @@ def thread(ID, author, body, title, tags): def reply(ID, author, body): + body = formatting.parse(body) now = time() + return { "post_id": ID, # integer "author": author, # string