示例#1
0
class SiCDSConfig(Schema):
    required = {
        'superkey': t_uni,
        'store': store_from_url,
    }
    optional = {
        'host': str,
        'port': withdefault(int, ''),
        'keys': withdefault(many(t_uni), []),
        'loggers': withdefault(many(logger_from_url), [StdOutLogger()]),
    }
示例#2
0
文件: app.py 项目: ushahidi/SiCDS
class IDRequest(Schema):
    '''
    >>> req = {"key":"some_key","contentItems":[
    ...         {"id":"d87fds7f6s87f6sd78fsdf","difcollections":[
    ...           {"name":"collection1","difs":[
    ...             {"type":"some-type1","value":"some-value-1"},
    ...             {"type":"some-type1","value":"some-value-2"}
    ...             ]
    ...           },
    ...           {"name":"collection2","difs":[
    ...             {"type":"some-type1","value":"some-value-1"},
    ...             {"type":"some-type1","value":"some-value-2"}
    ...             ]
    ...           }]
    ...         }]
    ...       }
    >>> req = IDRequest(req)
    >>> req
    <IDRequest ...>
    >>> req.key
    u'some_key'
    >>> IDRequest({'fields': 'missing'})
    Traceback (most recent call last):
      ...
    RequiredField: ...

    '''
    required = {'key': t_uni, 'contentItems': many(ContentItem, atleast=1)}
示例#3
0
文件: app.py 项目: ushahidi/SiCDS
class IDResponse(Schema):
    required = {'key': t_uni, 'results': many(IDResult, atleast=1)}
示例#4
0
文件: app.py 项目: ushahidi/SiCDS
class ContentItem(Schema):
    required = {'id': t_uni, 'difcollections': many(DifCollection, atleast=1)}
示例#5
0
文件: app.py 项目: ushahidi/SiCDS
class DifCollection(Schema):
    required = {'name': t_uni, 'difs': many(Dif, atleast=1)}