Example #1
0
    def _construct_resource(self, archetype, resource, version, mixins):
        bases = tuple([resource] + list(mixins))
        resource = type(
            str(archetype.resource).capitalize(), bases, {
                'name': archetype.resource,
                'version': version,
                'requests': 'create delete get put query update',
                'schema': {
                    'id': scheme.UUID(oncreate=True, operators='equal')
                },
            })

        if archetype.properties:
            for name, field in archetype.properties.structure.iteritems():
                add_schema_field(resource, field)

        return resource
Example #2
0
    def _construct_resource(self, archetype, resource, version, mixins):
        bases = tuple([resource] + list(mixins))
        resource = type(
            str(archetype.resource).capitalize(),
            bases,
            {
                "name": archetype.resource,
                "version": version,
                "requests": "create delete get put query update",
                "schema": {"id": scheme.UUID(oncreate=True, operators="equal")},
            },
        )

        if archetype.properties:
            for name, field in archetype.properties.structure.iteritems():
                add_schema_field(resource, field)

        return resource
Example #3
0
 def _annotate_resource(cls, registration, resource):
     for name, field in cls.resource.schema.iteritems():
         if name not in resource.schema and field.annotational:
             add_schema_field(resource, field)
Example #4
0
 def _annotate_resource(cls, registration, resource):
     for name, field in cls.resource.schema.iteritems():
         if name not in resource.schema and field.annotational:
             add_schema_field(resource, field)