def delete(request): id = request.matchdict['id'] try: entry = HundredPushups().getById(id) entry.delete() except: return { 'status': 404, 'message': 'Failed to Delete Entry' } return { 'status': 200, 'message': 'Successfully Delete Entry' }
def edit(request): id = request.matchdict['id'] params = request.params try: entry = HundredPushups().getById(id) entry.update(params) except: return { 'status': 404, 'message': 'Failed to Edit Entry' } return { 'status': 200, 'message': 'Successfully Edit Entry' }
def create(request): params = request.params message = params.get('message') try: entry = HundredPushups() entry.create(params) except: return { 'status': 404, 'message': 'Failed to Create Entry' } try: if params.get('twitter'): _post_twitter_update('%s%s (%s,%s,%s,%s,%s,%s,%s,%s) (Week %s,Day %s,Level %s) %s %s'%(message, entry.total(), entry.set1, entry.set2, entry.set3, entry.set4, entry.set5, entry.set6, entry.set7, entry.exhaust, entry.week, entry.day, entry.level, entry.hashtags, entry.mentions)) except: return { 'status': 404, 'message': 'Failed to Create Twitter Entry' } return { 'status': 200, 'message': 'Successfully Created Entry' }