Example #1
0
 class MyMapper(lion.Mapper):
     _factory = Obj
     s = lion.StrField()
     s_none = lion.StrField()
     s_skip_none = lion.StrField(condition=lion.skip_none)
     s_skip_empty = lion.StrField(condition=lion.skip_empty)
     stringify = lion.StrField()
Example #2
0
class SubL(lion.Mapper):
    w = lion.IntField()
    x = lion.MapperMethodField()
    y = lion.StrField()
    z = lion.IntField()

    def get_x(self, obj):
        return obj.x + 10
Example #3
0
class ComplexL(lion.Mapper):
    foo = lion.StrField()
    bar = lion.Field(getter=lion.getters.call_method)
    sub = lion.MapperField(SubL)
    subs = lion.ListField(SubL)
Example #4
0
class FooMapper(lion.Mapper):
    name = lion.StrField()
    value = lion.IntField()
    bars = lion.ListField(BarMapper)
Example #5
0
class BarMapper(lion.Mapper):
    name = lion.StrField()
    x = lion.IntField()
    y = lion.FloatField()
    z = lion.Field(condition=lion.skip_none)
Example #6
0
 class SthMapper(lion.Mapper):
     _factory = Obj
     title = lion.StrField()
Example #7
0
class NodeMapper(lion.Mapper):
    _factory = Node
    id = lion.UUIDField()
    title = lion.StrField()
    parent = lion.MapperField('self', condition=lion.skip_none)
    children = lion.ListField('self', condition=lion.skip_empty)
Example #8
0
class ProjectMapper(lion.Mapper):
    _factory = Project
    id = lion.UUIDField()
    title = lion.StrField()
    logo = lion.MapperField(LogoMapper, condition=lion.skip_none)
Example #9
0
class CompanyMapper(lion.Mapper):
    _factory = Company
    id = lion.UUIDField()
    title = lion.StrField()
    logo = lion.MapperField(LogoMapper, condition=lion.skip_none)
Example #10
0
class LogoMapper(lion.Mapper):
    _factory = Logo
    url = lion.StrField()
    width = lion.IntField()
    height = lion.IntField()