def handle_tweet_rest(request): if request.method == "GET": if (request.matchdict['id'] == ''): return dict(objects=Tweet.get_tweets(), meta={}) return dict(objects=Tweet.get(request.matchdict['id']), meta={}) if request.method == "DELETE": tweet = Tweet.get(request.matchdict['id']) Tweet.delete(tweet) return dict(error='nope') if request.method == "POST": tweet = Tweet(request.json_body['username'], request.json_body['message'] ) # DOESN'T WORK: request.param['sdfsd'] tweet.save() # session.add(tweet); return dict(error='nope')
def handle_tweet_rest(request): if request.method == "GET": if (request.matchdict['id'] == ''): return dict(objects=Tweet.get_tweets(),meta={}) return dict(objects=Tweet.get(request.matchdict['id']),meta={}) if request.method == "DELETE": tweet = Tweet.get(request.matchdict['id']) Tweet.delete(tweet) return dict(error='nope') if request.method == "POST": tweet = Tweet(request.json_body['username'], request.json_body['message']) # DOESN'T WORK: request.param['sdfsd'] tweet.save() # session.add(tweet); return dict(error='nope')
def tweet(request): return dict(objects=Tweet.get_tweets())
def post_tweet(request): tweet = Tweet(request.json_body['username'], request.json_body['message']) tweet.save() return dict(error='nope')
def get_tweet(request): return dict(objects=Tweet.get_tweets(),meta={})