def do_share(username, url): #check if url is already an entry in 'entries' #if it isnt add (url) into 'entries' #put into shares (user_id, entry_id) entry_id = get_entry_id(url) if entry_id is None: entry_id = post_entry(url) user_id = exists_account(username) entry = exec_db(SQL_SHARE, [user_id, entry_id])
def create_account(username, password): exec_db(SQL_USER_INSERT, [username, password])
def post_entry(url): entry = exec_db(SQL_ENTRY_INSERT, [url], one=True) return entry