def allowed(self, op, body): """Raise exception if op is not a valid operation on entity.""" op = op.upper() if not op in self.operations: raise NotImplementedStatus( "Operation '%s' not implemented for '%s' %s" % (op, self.name, self.operations))
def not_implemented(operation, entity_type): """Raise NOT_IMPLEMENTED exception""" raise NotImplementedStatus("Operation '%s' not implemented on %s" % (operation, entity_type))