Esempio n. 1
0
class CompanyMapper(Mapper):
    __type__ = User

    id = field.String(read_only=True)
    name = field.String()

    __roles__ = {'public': whitelist('name', 'id')}
Esempio n. 2
0
class UserMapper(BaseMapper):

    __type__ = User

    name = field.String()
    email = field.String()

    __roles__ = {'__default__': role.blacklist('password')}
Esempio n. 3
0
    class DocumentMapper(Mapper):
        __type__ = dict

        id = field.String(required=True)
        name = field.String()
        user = field.Nested('UserMapper',
                            name='user',
                            allow_partial_updates=True)
Esempio n. 4
0
class BookMapper(BaseMapper):

    __type__ = Book

    title = field.String()
    amazon_url = field.String()
    author = field.String()
    genre = field.String()
Esempio n. 5
0
class PlanetMapper(Mapper):

    __type__ = Planet

    id = field.Integer(read_only=True)
    name = field.String()
    description = field.String()
    created_at = field.DateTime(read_only=True)
Esempio n. 6
0
class UserMapper(Mapper):
    __type__ = User

    id = field.String(read_only=True)
    name = field.String()
    password = field.String()
    is_admin = field.Boolean(required=False, default=False)

    __roles__ = {'public': whitelist('name', 'id', 'is_admin')}
Esempio n. 7
0
    class UserMapper(Mapper):

        __type__ = dict

        id = field.String(required=True, read_only=True)
        name = field.String()

        __roles__ = {
            'public': [
                'name',
            ]
        }
Esempio n. 8
0
class SchedulableMapper(PolymorphicMapper):

    __type__ = TestType
    id = field.Integer(read_only=True)
    name = field.String()
    object_type = field.String(choices=['event', 'task'], read_only=True)

    __mapper_args__ = {
        'polymorphic_on': object_type,
        'allow_polymorphic_marshal': True,
    }

    __roles__ = {
        'name_only': ['name'],
        'public': whitelist('name', 'id'),
    }
Esempio n. 9
0
    class PostMapper(Mapper):

        __type__ = Post

        title = field.String()
        user = field.Nested('UserMapper', required=True, allow_create=True)
        readers = field.Collection(field.Nested('UserMapper'), required=False)
Esempio n. 10
0
class CharacterMapper(Mapper):

    __type__ = Character

    id = field.Integer(read_only=True)
    name = field.String()
    created_at = field.DateTime(read_only=True)
Esempio n. 11
0
class MyMapper(Mapper):

    __type__ = MyObject

    id = field.Integer()
    name = field.String()

    __roles__ = {'name_only': ['name']}
Esempio n. 12
0
    class PostMapper(Mapper):

        __type__ = Post

        title = field.String()
        user = field.Nested('UserMapper',
                            required=True,
                            allow_updates_in_place=True)
Esempio n. 13
0
class UserMapper(Mapper):
    __type__ = User

    id = field.Integer(read_only=True)
    name = field.String()
    is_admin = field.Boolean(required=False, default=False)
    company = field.Nested(CompanyMapper, getter=company_getter)

    __roles__ = {
        'overview': whitelist('id', 'name')
    }
Esempio n. 14
0
    class PostMapper(Mapper):

        __type__ = Post

        title = field.String()
        user = field.Nested('UserMapper',
                            required=False,
                            allow_updates_in_place=True)
        readers = field.Collection(field.Nested('PostMapper',
                                                getter=foo_getter),
                                   required=False)
Esempio n. 15
0
def test_collection_proxies_name_to_wrapped_field():

    f = field.Collection(field.Integer(), name='post_ids')
    f2 = field.Collection(field.String(), name='test')

    with pytest.raises(field.FieldError):
        field.Collection(field.String(name='foo'))

    class UserMapper(Mapper):

        __type__ = TestType

        id = field.String(required=True)
        tags = field.Collection(field.String())

    assert f.name == 'post_ids'
    assert f2.name == 'test'

    mapper = UserMapper({})
    assert mapper.fields['tags'].name == 'tags'
Esempio n. 16
0
class UserMapper(BaseMapper):

    __type__ = User

    name = field.String()
    email = field.String()
    website = field.String()
    street_address = field.String()
    city = field.String()
    state = field.String()
    zip = field.String()
    phone = field.String()

    __roles__ = {'__default__': role.blacklist('password')}
Esempio n. 17
0
class TaskMapper(SchedulableMapper):

    __type__ = TestType
    status = field.String()

    __mapper_args__ = {
        'polymorphic_name': 'task'
    }

    __roles__ = {
        'public': SchedulableMapper.__roles__['public']
        | whitelist('status'),
        'task_only_role': whitelist('id', 'status'),
        'task_blacklist': blacklist('status')
    }
Esempio n. 18
0
class EventMapper(SchedulableMapper):

    __type__ = TestType
    location = field.String()

    __mapper_args__ = {
        'polymorphic_name': 'event'
    }

    __roles__ = {
        'public': SchedulableMapper.__roles__['public']
        | whitelist('location'),
        'event_only_role': whitelist('id', 'location'),
        'event_blacklist': blacklist('location')
    }
Esempio n. 19
0
    class UserMapper(Mapper):

        __type__ = User

        name = field.String()
Esempio n. 20
0
class CompanyMapper(Mapper):
    __type__ = Company

    id = field.Integer(read_only=True)
    name = field.String()
Esempio n. 21
0
    class PostMapper(Mapper):

        __type__ = Post

        title = field.String()
        user = field.Nested('UserMapper', required=True, getter=getter)
Esempio n. 22
0
class SchoolMapper(BaseMapper):
    __type__ = School
    school_name = field.String()
    wut = field.String()
    date_of_graduation = field.String()
Esempio n. 23
0
    class Inner(Mapper):
        __type__ = dict

        name = field.String(source='user_name')
Esempio n. 24
0
    class UserMapper(Mapper):

        __type__ = dict

        id = field.String(required=True, read_only=True)
        name = field.String()
Esempio n. 25
0
    class UserMapper(Mapper):

        __type__ = User

        id = field.Integer(read_only=True)
        name = field.String()
Esempio n. 26
0
class WeaponOfChoiceMapper(BaseMapper):
    __type__ = WeaponOfChoice
    title = field.String()
    items = field.Collection(field.String())
Esempio n. 27
0
class TechnicalExperienceMapper(BaseMapper):
    __type__ = TechnicalExperience
    title = field.String()
    items = field.Collection(field.String())
Esempio n. 28
0
File: data.py Progetto: larsks/kim
class SubMapper(Mapper):
    __type__ = SubResource
    w = field.String()
    x = field.String(extra_serialize_pipes={'output': [x_pipe]})
    y = field.String()
    z = field.String()
Esempio n. 29
0
class CharacterMapper(BaseMapper):

    __type__ = Character

    name = field.String()
Esempio n. 30
0
File: data.py Progetto: larsks/kim
class ComplexMapper(Mapper):
    __type__ = Complex
    foo = field.String()
    bar = field.String(extra_serialize_pipes={'output': [bar_pipe]})
    sub = field.Nested(SubMapper)
    subs = field.Collection(field.Nested(SubMapper))