示例#1
0
    def prepare(self):
        """
        """
        if self.request.content_type[0] != "application/vnd.api+json":
            raise errors.UnsupportedMediaType()
        if not self.api.has_type(self.typename):
            raise errors.NotFound()

        # Load the resource
        self.resource = yield from self.db.get(
            (self.typename, self.resource_id))
        if self.resource is None:
            raise errors.NotFound()

        self.real_typename = self.api.get_typename(self.resource, None)
        return None
示例#2
0
 def prepare(self):
     """
     """
     if self.request.content_type[0] != "application/vnd.api+json":
         raise errors.UnsupportedMediaType()
     if not self.api.has_type(self.typename):
         raise errors.NotFound()
     return None