class QueryStringSchema(MappingSchema): limit = SchemaNode(Integer(), missing=drop, validator=colander.Range(0, COLLECTION_MAX_LENGTH)) offset = SchemaNode(Integer(), missing=drop) sort_by = SchemaNode(String(), missing=drop) sort_direction = SchemaNode(String(), missing='asc', validator=OneOf(['asc', 'desc'])) provider_id = SchemaNode(String(), missing=drop, validator=Length(1, SAFE_MAX_LENGTH)) start_time = SchemaNode(DateTime(default_tzinfo=None), missing=drop) end_time = SchemaNode(DateTime(default_tzinfo=None), missing=drop)
class ActivitySchema(BaseModelSchema): """ Schema definition for activity model. """ description = SchemaNode(String()) start = SchemaNode(DateTime(), missing=drop) end = SchemaNode(DateTime(), missing=drop) activity_type = SchemaNode(String(), missing=drop, validator=OneOf(ACTIVITY_TYPES.keys()), default=ACTIVITY_UNASSIGNED) project_id = SchemaNode(Integer(), missing=drop) task_id = SchemaNode(Integer(), missing=drop) user_id = SchemaNode(Integer())
class UpdateUserSchema(MappingSchema): username = SchemaNode(String(encoding='utf-8'), missing=None) photo_url = SchemaNode(String(encoding='utf-8'), missing=None) signature = SchemaNode(String(encoding='utf-8'), missing=None) access_token = SchemaNode(String(encoding='utf-8'), missing=u'') status = SchemaNode(String(encoding='utf-8'), missing=None) date_update = SchemaNode(DateTime(), missing=None)
def deferred_datetime_node(node, kw): """We defer the creation of the datetime node so that we can get the timezone from the user's profile. See the generate_task_form method in views.py to see how this is bound together. """ tz = timezone(kw['user_tz']) return DateTime(default_tzinfo=tz)
class CommentSchema(Schema): commenter = SchemaNode(String(), ) text = SchemaNode(String(), ) pubdate = SchemaNode( DateTime(), default=now_default, )
class TemperatureTSSchema(PropertySchema): timeseries = SequenceSchema( TupleSchema(children=[ SchemaNode(DateTime(default_tzinfo=None), missing=drop), SchemaNode(Float(), missing=0) ], missing=drop)) varnames = SequenceSchema(SchemaNode(String(), missing=drop))
class TimeSeriesPropSchema(PropertySchema): time = TimeSchema(missing=drop) data = SequenceSchema(SchemaNode(Float()), missing=drop) timeseries = SequenceSchema(TupleSchema(children=[ SchemaNode(DateTime(default_tzinfo=None), missing=drop), SchemaNode(Float(), missing=0) ], missing=drop), missing=drop)
class PriceReportSchema(MappingSchema): """Schema for `PriceReport` model""" datetime = SchemaNode(DateTime()) price_value = SchemaNode(Decimal()) amount = SchemaNode(Decimal()) merchant = MerchantSchema() product = ProductSchema() reporter = ReporterSchema() url = SchemaNode(String())
class DocumentSchema(BaseDocumentSchema): """Document schema""" api = SchemaNode(String(), title=_("Document base REST API URL")) oid = SchemaNode(String(), title=_("Document unique identifier")) version = SchemaNode(Int(), title=_("Document version")) href = SchemaNode(String(), title=_("Absolute URL of document data file")) hash = SchemaNode(String(), title=_("SHA512 hash of document data file")) filesize = SchemaNode(Int(), title=_("Document file size")) content_type = SchemaNode(String(), title=_("Document content type")) creator = SchemaNode(String(), title=_("Document creator principal ID")) created_time = SchemaNode(DateTime(), title=_("Document creation timestamp")) owner = SchemaNode(String(), title=_("Current document owner")) updater = SchemaNode(String(), title=_("Last document updater principal ID")) updated_time = SchemaNode(DateTime(), title=_("Last document update timestamp")) status_updater = SchemaNode( String(), title=_("Last workflow status updater principal ID")) status_update_time = SchemaNode( DateTime(), title=_("Last document status update timestamp"))
class TSVectorPropSchema(VectorPropSchema): timeseries = SequenceSchema(TupleSchema(children=[ SchemaNode(DateTime(default_tzinfo=None), missing=drop), TupleSchema(children=[ SchemaNode(Float(), missing=0), SchemaNode(Float(), missing=0) ]) ], missing=drop), missing=drop) # variables = SequenceSchema(TupleSchema(SchemaNode(Float()))) varnames = SequenceSchema(SchemaNode(String(), missing=drop), missing=drop)
class TimeSchema(base_schema.ObjTypeSchema): filename = FilenameSchema( isdatafile=True, test_equal=False, update=False ) varname = SchemaNode( String(), read_only=True ) data = SequenceSchema( SchemaNode( DateTime(default_tzinfo=None) ) )
class BlogEntrySchema(Schema): name = SchemaNode( String(), validator=make_name_validator('Blog Entry'), ) title = SchemaNode(String(), ) entry = SchemaNode( String(), widget=TextAreaWidget(rows=20, cols=70), ) format = SchemaNode( String(), validator=OneOf(['rst', 'html']), widget=SelectWidget(values=[('rst', 'rst'), ('html', 'html')]), ) pubdate = SchemaNode( DateTime(default_tzinfo=eastern), default=now_default, )
class EventSchema(MappingSchema): id = SchemaNode(String(), missing=drop, validator=Length(1, SAFE_MAX_LENGTH)) provider_id = default_schema_node() title = SchemaNode(String(), missing='', validator=Length(1, SAFE_MAX_LENGTH)) email = SchemaNode(String(), validator=colander.Email()) firstname = default_schema_node() lastname = default_schema_node() telephone = default_schema_node() description = SchemaNode(String(), missing='') event_id = default_schema_node() email = SchemaNode(String(), missing='', validator=colander.Email()) firstname = default_schema_node() language = default_schema_node() lastname = default_schema_node() latlong = default_schema_node() price_information = default_schema_node() organiser = default_schema_node() performers = default_schema_node() press_url = SchemaNode(String(), missing='', validator=colander.url) source_id = default_schema_node() source = default_schema_node() target = default_schema_node() telephone = default_schema_node() url = SchemaNode(String(), missing='', validator=colander.url) location_name = default_schema_node() location_address = default_schema_node() location_post_code = default_schema_node() location_town = default_schema_node() location_capacity = default_schema_node() location_country = default_schema_node() start_time = SchemaNode(DateTime(default_tzinfo=None), preparer=remove_timezone) end_time = SchemaNode(DateTime(default_tzinfo=None), missing=None, preparer=remove_timezone) publication_start = SchemaNode(DateTime(default_tzinfo=None), missing=None, preparer=remove_timezone) publication_end = SchemaNode(DateTime(default_tzinfo=None), missing=None, preparer=remove_timezone) press_contact_email = SchemaNode(String(), missing='', validator=colander.Email()) press_contact_name = default_schema_node() press_contact_phone_number = default_schema_node() ticket_contact_email = SchemaNode(String(), missing='', validator=colander.Email()) ticket_contact_name = default_schema_node() ticket_contact_phone_number = default_schema_node() @instantiate(missing=[]) class videos(SequenceSchema): video = MediaSchema() @instantiate(missing=[]) class sounds(SequenceSchema): sound = MediaSchema() @instantiate(missing=[]) class images(SequenceSchema): image = MediaSchema() @instantiate(missing=[]) class tags(SequenceSchema): name = SchemaNode(String(), validator=Length(1, TAG_MAX_LENGTH)) @instantiate(missing=[]) class categories(SequenceSchema): name = SchemaNode(String(), validator=Length(1, TAG_MAX_LENGTH))
class ImportDocumentSchema(NewDocumentSchema): """Import document schema""" created_time = SchemaNode(DateTime(), title=_("Document creation timestamp")) owner = SchemaNode(String(), title=_("Current document owner"))
class RideSchema(MappingSchema): time_started = SchemaNode(DateTime()) time_ended = SchemaNode(DateTime()) owner_id = SchemaNode(Integer())
class TraceSchema(MappingSchema): altitude = SchemaNode(Integer()) ride_id = SchemaNode(Integer()) device_timestamp = SchemaNode(DateTime()) geometry = SchemaNode(String())
class PropertySchema(base_schema.ObjType): name = SchemaNode(String(), missing='default') units = SchemaNode(typ=Sequence(accept_scalar=True), children=[SchemaNode(String(), missing=drop), SchemaNode(String(), missing=drop)]) time = SequenceSchema(SchemaNode(DateTime(default_tzinfo=None), missing=drop), missing=drop)
class UpdatePostSchema(MappingSchema): title = SchemaNode(String(encoding='utf-8'), missing=None) author_id = SchemaNode(Int(), missing=None) pic_small = SchemaNode(String(encoding='utf-8'), missing=None) date_update = SchemaNode(DateTime(), missing=datetime.now())
def __init__(self, title, name, round=1, missing='', widget=None, mapinit=None, processing_form=None, desc=None, table_reduce=False, rank=0, required=False, missing_msg='champ requis', primary_key=False): # Form display self.title = title self.name = name self.required = required self.missing_msg = missing_msg self.type = str self.desc = desc self.round = round if widget is None: keyw = { 'key_date': '{}-date'.format(self.name), 'key_time': '{}-time'.format(self.name) } self.widget = DateTimeInputWidget(**keyw) self.mapinit = {'date': None, 'time': None} processing_form = lambda x: pd.Timestamp('{} {}'.format( x['date'], x['time'])) else: self.widget = widget self.mapinit = mapinit # Db column self.dbcol_ = (name, Colsql(Strsql(250), primary_key=primary_key)) # Table display self.table_reduce, self.rank, = table_reduce, rank self.processing_form = { 'form': processing_form, 'db': lambda x: pd.Timestamp(x) } self.processing_db = { 'upload': lambda x: str(pd.Timestamp(x)), 'download': lambda x: str(x) } self.sn = sn(DateTime(), title=self.title, name=name, widget=self.widget, description=desc, required=self.required, missing_msg=self.missing_msg) if not required: self.sn.missing = missing
class TimeSchema(base_schema.ObjType): # time = SequenceSchema(SchemaNode(DateTime(default_tzinfo=None), missing=drop), missing=drop) filename = SchemaNode(typ=Sequence(accept_scalar=True), children=[SchemaNode(String())], missing=drop) varname = SchemaNode(String(), missing=drop) data = SchemaNode(typ=Sequence(), children=[SchemaNode(DateTime(None))], missing=drop)
String(), ops=('eq', 'contains', 'starts', 'ends'), ), Filter( 'last_name', String(), ops=('eq', 'contains', 'starts', 'ends'), ), Filter( 'token', String(), ops=('eq', ), ), Filter( 'created', DateTime(), ops=('eq', 'gt', 'gte', 'lt', 'lte'), ), ] class UserResource(ModelResource): """ REST API resource for User model. """ name = 'users' model = User schema = UserSchema list_schema = UserListSchema