def delete(self, user):
        """Delete a sub-resource"""
        if user:
            can_delete = yield self.can_delete(user)
        else:
            can_delete = False

        if not can_delete:
            raise exceptions.Unauthorized('User may not delete the resource')

        try:
            parent = yield self.get_parent()
        except couch.NotFound:
            msg = '{}_id {} not found'.format(
                self.parent_resource.resource_type,
                self.parent_id)
            raise exceptions.ValidationError(msg)

        yield parent.delete_subresource(self)
def delete ( self , user ) : if user : can_delete = yield self . can_delete ( user ) else : can_delete = False if not can_delete : raise exceptions . Unauthorized ( 'User may not delete the resource' ) try : parent = yield self . get_parent ( ) except couch . NotFound : msg = '{}_id {} not found' . format ( self . parent_resource . resource_type , self . parent_id ) raise exceptions . ValidationError ( msg ) yield parent . delete_subresource ( self )
Delete a sub-resource