success notification. ''' try: app_id = ObjectId(app_id) except Exception, e: return error_response(400, 'Not a valid app id') try: app = App.collection.find_one({'_id': app_id, 'deleted': False}) except Exception, e: logging.error(e) return error_response(500, 'Server Error') if not app: message = 'App does not exist' logging.warn(message) return error_response(404, message) if not app.user_can_update(auth_user): message = 'App cannot be modified by the user' logging.warn(message) return error_response(403, message) try: app.delete() app.save() update_json = {'success': True} return encode_json(update_json) except Exception, e: logging.error(e) return error_response(500)
Delete the given app, and returns a JSON object containing a success notification. ''' try: app_id = ObjectId(app_id) except Exception, e: return error_response(400, 'Not a valid app id') try: app = App.collection.find_one({'_id': app_id, 'deleted': False}) except Exception, e: logging.error(e) return error_response(500, 'Server Error') if not app: message = 'App does not exist' logging.warn(message) return error_response(404, message) if not app.user_can_update(auth_user): message = 'App cannot be modified by the user' logging.warn(message) return error_response(403, message) try: app.delete() app.save() update_json = {'success': True} return encode_json(update_json) except Exception, e: logging.error(e) return error_response(500)