formatting changes

pull/4/head
Blake DeMarcy 2017-03-05 18:03:58 -06:00
parent b77a3a3332
commit af7a67951d
1 changed files with 18 additions and 5 deletions

View File

@ -28,8 +28,12 @@ def error(code, description):
def user_internal(ID, auth_hash, name, quip, bio, admin): def user_internal(ID, auth_hash, name, quip, bio, admin):
if not quip: quip = "" if not quip:
if not bio: bio = "" quip = ""
if not bio:
bio = ""
return { return {
"user_id": ID, # string "user_id": ID, # string
"quip": quip, # (possibly empty) 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): def user_external(ID, name, quip, bio, admin):
if not quip: quip = "" if not quip:
if not bio: bio = "" quip = ""
if not bio:
bio = ""
return { return {
"user_id": ID, # string "user_id": ID, # string
"quip": quip, # (possibly empty) 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): def thread(ID, author, body, title, tags):
if not tags: tags = list() if not tags:
tags = list()
body = formatting.parse(body, doquotes=False) body = formatting.parse(body, doquotes=False)
now = time() now = time()
return { return {
"thread_id": ID, # string "thread_id": ID, # string
"post_id": 1, # integer "post_id": 1, # integer
@ -72,8 +83,10 @@ def thread(ID, author, body, title, tags):
def reply(ID, author, body): def reply(ID, author, body):
body = formatting.parse(body) body = formatting.parse(body)
now = time() now = time()
return { return {
"post_id": ID, # integer "post_id": ID, # integer
"author": author, # string "author": author, # string