Item.validate(item_data) except ValueError, e: logging.warn(e) return error_response(400, 'Could not parse JSON') except ValidationError, e: logging.warn(e) return error_response(400, e.error) try: item = Item(item_data) item.set_creator(auth_user) item.save() item_added = item_list.add_item(item) if item_added: item_list.save() formatted_dict = item.formatted_dict() formatted_dict['editable'] = item.user_can_update(auth_user) return encode_json(formatted_dict) else: return error_response( 500, 'List cannot contain more than %d items.' % List.max_list_size) except Exception, e: logging.error(e) return error_response(500) @add_cors_headers @public_api_auth def DELETE(self, list_id, auth_user=None, auth_app_id=None): ''' Delete the given list, and returns a JSON object containing a