class IEnvio(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- inicio = schema.Date( title=_(u"Inicio do envio"), required=True, description=_(u"Field description"), ) # mensagem = schema.TextLine( title=_(u"Mensagem"), required=True, description=_(u"Field description"), ) # grupos = schema.List( title=_(u"Grupos"), required=True, description=_(u"Field description"), ) # icone = schema.Bytes( title=_(u"Icone"), required=False, description=_(u"Field description"), ) # arquivo = schema.Bytes( title=_(u"Arquivo"), required=False, description=_(u"Field description"), )
class IFile(Interface): metadata('extension', 'md5', 'contentType', 'filename') index('contentType', type='text') contentType = schema.BytesLine( title=u'Content Type', description=u'The content type identifies the type of data.', default=b'', required=False ) index('filename', type='text') filename = schema.TextLine(title=u'Filename', required=False, default=None) data = schema.Bytes( title=u'Data', description=u'The actual content.', required=False, ) index('extension', type='text') extension = schema.TextLine( title='Extension of the file', default='') index('md5', type='text') md5 = schema.TextLine( title='MD5', default='') def get_size(): """Return the byte-size of the data of the object."""
class ICard(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- data = schema.Date( title=_(u"Data"), required=True, description=_(u"Field description"), ) # foto = schema.Bytes( title=_(u"Foto"), required=True, description=_(u"Field description"), ) # subtitulo = schema.TextLine( title=_(u"Subtitulo"), required=False, description=_(u"Field description"), ) # downloadlink = schema.TextLine( title=_(u"Download link"), required=False, description=_(u"Field description"), )
class IEvento(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- tempo = schema.Int( title=_(u"Tempo"), required=True, description=_(u"Informe o tempo em segundos."), ) # imagem = schema.Bytes( title=_(u"Foto"), required=True, description=_(u"Field description"), ) # data = schema.TextLine( title=_(u"Data"), required=True, description=_(u"Informe a data"), ) # hora = schema.TextLine( title=_(u"Hora"), required=True, description=_(u"Field description"), ) # local = schema.TextLine( title=_(u"Local"), required=True, description=_(u"Nome do Local - Cidade/UF"), )
class IOAuth2App(component.Interface): ''' Defines fields needed for oauth2 app registration ''' service = schema.Choice(title=u'Service: ', description=u'The OAuth2 authenticator source', vocabulary=u'oauth2.sources') authtype = schema.Choice(title=u'Type:', values=[u'OAuth-1', u'OAuth-2'], default=u'OAuth-2') icon = schema.Bytes(title=u'Display Icon:', required=False) auth_uri = schema.URI( title=u'Auth URI: ', required=False, description=u'Where to send the browser for authentication') token_uri = schema.URI( title=u'Token URI: ', required=False, description=u'Where to exchange auth token for request token') client_id = schema.TextLine(title=u'Client ID: ', required=False, description=u'Our Client/Consumer ID') secret = schema.TextLine(title=u'Secret: ', required=False, description=u'Our client secret if applicable') scope = schema.TextLine( title=u'Scope(s): ', required=False, description=u'List of services we will want to access')
class IProfileForm(interface.Interface): first_name = schema.TextLine(title=_(u"First name")) last_name = schema.TextLine(title=_(u"Last name")) middle_name = schema.TextLine(title=_(u"Middle name"), required=False) email = schema.TextLine(title=_("label_profile_email", default=u"Email"), constraint=check_email) description = schema.Text(title=_(u"Biographical notes"), required=False) gender = schema.Choice(title=_("Gender"), vocabulary=vocabulary.gender) date_of_birth = schema.Date(title=_("Date of Birth")) birth_nationality = schema.Choice(title=_("Nationality at Birth"), source=vocabulary.country_factory) birth_country = schema.Choice(title=_("Country of Birth"), source=vocabulary.country_factory) current_nationality = schema.Choice(title=_("Current Nationality"), source=vocabulary.country_factory) image = schema.Bytes(title=_("Image")) @invariant def checkEmail(self): session = Session() users = session.query(User).filter(User.email == self.email) message = _("error_profile_email_taken", "Email already taken!") if users.count() > 1: raise interface.Invalid(message, "email") if users.count( ) == 1 and users.first().user_id != get_login_user().user_id: raise interface.Invalid(message, "email")
class ISlide(Interface): configuration = schema.Choice( source="slide_configuration_choices", title=_(u"Layout"), description=_(u"Choose a layout for this slide."), required=False) heading = schema.TextLine( title=_(u"Heading"), required=False, ) image = schema.Bytes(title=_(u"Image"), required=False) slide = schema.Text(title=_(u"Text"), required=False) link_reference = schema.Choice( title=_(u"Link to content"), description=_(u"Choose a content item to link this slide to."), source=SearchableTextSourceBinder({}, default_query='path:'), required=False, ) url = schema.URI( title=_(u'External link'), description=_( u'Please enter a full URL. Has precedence before the above field.' ), required=False, ) index = schema.Int(title=u'', required=False)
class IPSTImportFromEcomptesSchema(model.Schema): ecomptes_xml = schema.Bytes( title=_c(u"XML document exported from eComptes"), description=u'', required=True, )
class IDefinitionBase(form.Schema, ISchemaProvider, IAttributeUUID): """Base for form, form-group definitions""" form.omitted('signature') # instance attribute, not editable form field signature = schema.BytesLine( title=_(u'Schema signature'), description=_(u'MD5 hexidecimal digest hash of entry_schema XML.'), default=DEFAULT_SIGNATURE, required=False, ) form.omitted('signature_history') # attribute, not editable form field signature_history = schema.List( title=_(u'Signature history stack'), description=_(u'Chronologically-ordered list of MD5 hexidecimal ' u'digest hashes of entry_schema XML.'), value_type=schema.BytesLine(), defaultFactory=list, ) title = schema.TextLine( title=u'Title', description=u'Name of definition; this is used as a label displayed ' u'when binding forms to this definition, and also is ' u'used to help create a unique short name for the ' u'definition used in its URL.', required=True, ) description = schema.Text( title=u'Description', description=u'Optional description of this form definition.', required=False, ) form.widget(entry_schema=TextAreaFieldWidget) entry_schema = schema.Bytes( title=_(u'Form schema XML'), description=_(u'Serialized form schema XML.'), constraint=valid_xml_schema, default=DEFAULT_MODEL_XML, required=False, ) # NOTE: this field must be last in interface code: identifier collision form.omitted('schema') # instance attribute, but not editable form field schema = schema.Object( title=_(u'Form schema'), description=_(u'Form schema based upon entry_schema XML, usually ' u'a reference to a transient interface object ' u'looked up from persistent attribute self.signature.'), schema=IInterface, required=True, # implementations should provide empty default readonly=True, # read-only property, though object returned is mutable ) def schema_version(signature): """
class IVinheta(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- video = schema.Bytes( title=_(u"Video"), required=True, description=_(u"Field description"), )
class ITestSchemaIndexes(Interface): """Interface wtih schema fields for index enumeration tests""" name = schema.TextLine() url = schema.BytesLine() ignore = schema.Bytes() biography = schema.Text() number = schema.Int() date = schema.Date() subjects = schema.List(value_type=schema.TextLine())
class IAlbum(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- trilha = schema.Bytes( title=_(u"Trilha"), required=True, description=_(u"Field description"), )
class IPrograma(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- imagem = schema.Bytes( title=_(u"Imagem"), required=False, description=_(u"Field description"), )
class IPerguntaResposta(Interface): """ """ # -*- schema definition goes here -*- nomepergunta = schema.TextLine( title=_(u"Nome - Pergunta"), required=False, description=_(u"Field description"), ) # creditopergunta = schema.TextLine( title=_(u"Credito - Pergunta"), required=False, description=_(u"Field description"), ) # videopergunta = schema.Bytes( title=_(u"Video - Pergunta"), required=False, description=_(u"Field description"), ) # nomeresposta = schema.TextLine( title=_(u"Nome - Resposta"), required=True, description=_(u"Field description"), ) # creditoresposta = schema.TextLine( title=_(u"Credito - Resposta"), required=False, description=_(u"Field description"), ) # videoresposta = schema.Bytes( title=_(u"Video - Resposta"), required=True, description=_(u"Field description"), )
class ISimMap(Interface): """SimMap version 2""" # -*- schema definition goes here -*- simImage = schema.Bytes( title=_(u"GIS Layer"), required=True, description=_(u"GIS layer or zipfile containing GIS layer"), ) mapFile = schema.Bytes( title=_(u"Map File"), required=False, description=_(u"Mapserver Map File"), ) details = schema.Text( title=_(u"Details"), required=False, description=_(u"A detailed description of the SimMap"), ) transparency = schema.Float( title=_(u"Transparency"), required=False, description=_(u"Transparency of the overlay (1.0 = opaque)"), ) latlong = schema.TextLine( title=_(u"Latitude Longitude"), required=False, description=_(u"lat/long in decimal degrees"), ) zoom = schema.Int( title=_(u"Zoom level"), required=False, description=_(u"Zoom level (1-20)"), )
class ITransferJob(Interface): """Content type for a Transfer Position""" # -*- schema definition goes here -*- positiondescription = schema.Bytes( title=_(u"Position Description"), required=True, description=_(u""), ) # postdate = schema.TextLine( title=_(u"Posting Date"), required=True, description=_(u""), ) # department = schema.TextLine( title=_(u"Department"), required=True, description=_(u""), ) # schedule = schema.Text( title=_(u"Work Schedule"), required=True, description=_(u""), ) # qualifications = schema.Text( title=_(u"Special Qualifications"), required=True, description=_(u""), ) # payrange = schema.TextLine( title=_(u"Pay Range"), required=True, description=_(u""), ) # deadline = schema.TextLine( title=_(u"Application Deadline"), required=True, description=_(u""), ) # howtoapply = schema.Text( title=_(u"How to Apply"), required=True, description=_(u""), )
class IVinheta(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- downloadlink = schema.TextLine( title=_(u"Download Link"), required=False, description=_(u"Field description"), ) # video = schema.Bytes( title=_(u"Video"), required=True, description=_(u"Field description"), )
class IInformationPage(Interface): """A page to hold the information as HTML and downloadable file. """ text = schema.Text( title=_(u'Text'), description=_(u"The information as HTML"), default=u'', required=False, ) text = schema.Bytes( title=_(u'File'), description=_(u"The information as downloadable file."), required=False, )
class IFoto(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- legenda = schema.TextLine( title=_(u"Legenda"), required=False, description=_(u"Field description"), ) # legenda = schema.Bytes( title=_(u"Arquivo"), required=True, description=_(u"Field description"), )
class IColuna(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- autor = schema.TextLine( title=_(u"Autor"), required=True, description=_(u"Field description"), ) # foto = schema.Bytes( title=_(u"Foto"), required=True, description=_(u"Field description"), )
class IFile(Interface): contentType = schema.BytesLine( title=u'Content Type', description=u'The content type identifies the type of data.', default='', required=False, missing_value='') data = schema.Bytes( title=u'Data', description=u'The actual content of the object.', default='', missing_value='', required=False, ) def getSize(): """Return the byte-size of the data of the object."""
class IProfileForm(interface.Interface): first_name = schema.TextLine(title=_(u"First name")) last_name = schema.TextLine(title=_(u"Last name")) middle_name = schema.TextLine(title=_(u"Middle name"), required=False) email = schema.TextLine(title=_(u"Email"), constraint=check_email) description = schema.Text(title=_(u"Biographical notes"), required=False) gender = schema.Choice(title=_("Gender"), vocabulary=vocabulary.Gender) date_of_birth = schema.Date(title=_("Date of Birth"), min = datetime.datetime.now().date() - \ datetime.timedelta(MAX_AGE*365), max = datetime.datetime.now().date() - \ datetime.timedelta(MIN_AGE*365)) birth_nationality = schema.Choice(title=_("Nationality at Birth"), source=countries) birth_country = schema.Choice(title=_("Country of Birth"), source=countries) current_nationality = schema.Choice(title=_("Current Nationality"), source=countries) image = schema.Bytes(title=_("Image"))
class IFbShareSettings(Interface): """ Settings used in the control panel for Facebook (opengraph) share """ image_to_share = schema.Choice( title=_(u"Default site image to share"), description=_('help_image_to_share', default=u"You can choose to provide a custom image or use the site logo.\n" u"If you choose a custom image without providing it, it will not provide any og:image meta content."), required=True, default=u'custom_image', vocabulary='collective.fbshare.imageChoiceVocabulary', ) default_image = schema.Bytes( title=_(u"Custom image for Open Graph sharing"), description=_('help_default_image', default=u"Images for Facebook must be at least 50px by 50px (though minimum 200px by 200px is preferred) " u"and have a maximum aspect ratio of 3:1. Supported format are PNG, JPEG and GIF formats."), default=None, required=False, ) content_use_own_image = schema.Bool( title=_(u"Contents use own image"), description=_('help_content_use_own_image', default=u"If checked, content types that behave an image field will provide the image in the og:image attribute.\n" u"The product contentleadimage is also supported."), default=True, required=False, ) content_image_size = schema.Choice( title=_(u"Content image size to be used"), description=_('help_content_image_size', default=u"Resized version of contents images to be used."), required=True, default=u'mini', vocabulary='collective.fbshare.imageSizeVocabulary', )
class IClassifiedJob(Interface): """A Classified Job Post""" # -*- schema definition goes here -*- # positiondescription = schema.Bytes( title=_(u"Position Description"), required=True, description=_(u"Upload a position description PDF"), ) # jobinfo = schema.SourceText( title=_(u"Job Information"), required=True, description=_(u""), ) # jobsummary = schema.SourceText( title=_(u"Summary"), required=True, description=_(u""), ) # jobduties = schema.SourceText( title=_(u"Job Duties"), required=True, description=_(u""), ) # jobskills = schema.SourceText( title=_(u"Job Knowledge, Skills and Abilities"), required=True, description=_(u""), ) # howtoapply = schema.SourceText( title=_(u"How to Apply"), required=True, description=_(u""), )
class IGN6DadesAltaForm(IGN6UrlHelperForm): """Define the fields where the user inputs the contents for a new tiquet""" assumpte = schema.TextLine( title=_(u"Assumpte"), description=_(u"Descripció curta de la raó de la sol·licitud."), ) descripcio = schema.Text( title=_(u"Descripció"), description=_(u"Descripció detallada de la raó de la sol·licitud.") ) annexe = schema.Bytes( title=_(u'Annexe'), description=_(u"Fitxer que s'afegirà com annexe a la sol·licitud. Podreu annexar més arxius, un cop creat el tiquet, des del gestor e-serveiscbl."), required=False ) redirect = schema.Text( title=_(u"Redirect"), description=_(u"Url a la que es retornarà en cas d'èxit.") )
def fields(self): subscriberdata = schema.Bytes( __name__='subscriberdata', title=_(u"Subscribers"), description=_( u"Upload a CSV file with a list of subscribers here. " u"Subscribers already present in the database will " u"be overwritten. Each line should contain: " u"${columns}.", mapping=dict(columns=';'.join( field.Fields(self.context.composer.schema).keys())))) onlyremove = schema.Bool( __name__='onlyremove', title=_(u"Remove subscribers in list."), description=_(u"Only purge subscribers present in this list."), default=False) remove = schema.Bool(__name__='removenonexisting', title=_(u"Purge list."), description=_(u"Purge list before import."), default=False) header_row_present = schema.Bool( __name__='header_row_present', title=_(u"CSV contains a header row"), description=_(u"Select this if you want to use the csv " u"header row to designate document variables." u"The header row must contain one 'email' field."), default=False) csv_delimiter = schema.TextLine( __name__='csv_delimiter', title=_(u"CSV delimiter"), description=_( u"The delimiter in your CSV file. " u"(Usually ',' or ';', but no quotes are necessary.)"), default=u',') return field.Fields(subscriberdata, remove, onlyremove, header_row_present, csv_delimiter)
class IFile(Interface): """Defines a file that is aware of its filename. """ filename = schema.TextLine(title=u"Name of file", required=False, default=u'') content_type = schema.TextLine( title=u'Content type', description=u'The content type identifies the type of data.', default='', required=False, missing_value='') data = schema.Bytes(title=u'Data', description=u'The actual content of the object.', default=b'', missing_value=b'', required=False) size = schema.Int(title=u"Size", description=u"Size in bytes", readonly=True, required=True)
class IHWCImportForm(form.Schema): json = schema.Bytes(title=u"JSON file", )
class IProbmap(Interface): """a Land Use Change probability map""" # -*- schema definition goes here -*- probview = schema.Object( title=_(u"Simmap view of the probmap."), required=False, description=_(u"A SimMap view visualzing the Probmap."), schema=Interface, # specify the interface(s) of the addable types here ) # probfile = schema.Bytes( title=_(u"Probmap File"), required=False, description=_(u"Precomputed version of the probability map."), ) # year = schema.Int( title=_(u"Effective Year"), required=True, description=_(u"First year the probmap will be used."), ) # roads = schema.Object( title=_(u"Additional Roads"), required=False, description=_(u"Select a GIS layer that contains any roads not included in the TDM network."), schema=Interface, # specify the interface(s) of the addable types here ) # # transit = schema.Object( # title=_(u"Transit Networks"), # required=False, # description=_(u"Select one or more GIS layers containing regional or local transit networks."), # schema=Interface, # specify the interface(s) of the addable types here # ) # tdm = schema.Object( title=_(u"Travel Demand Model Transportation Network"), required=True, description=_(u"Select a transportation network that has been generated from a travel demand model."), schema=Interface, # specify the interface(s) of the addable types here ) trans_w = schema.Int( title=_(u"Transportation Weight"), required=False, description=_(u"Weight of Transportation"), ) # nogrowth = schema.Object( title=_(u"No Growth Maps"), required=False, description=_(u"Select one or more GIS layers. These areas will be protected from model development."), schema=Interface, # specify the interface(s) of the addable types here ) # empcenters = schema.Object( title=_(u"Employment Centers"), required=True, description=_(u"Select a GIS layer containing employeers and employmment centers."), schema=Interface, # specify the interface(s) of the addable types here ) emp_w = schema.Int( title=_(u"Employment Weight"), required=False, description=_(u"Weight of Employment Centers"), ) # popcenters = schema.Object( title=_(u"City and Population Centers"), required=True, description=_(u"Select the GIS layer with city centers."), schema=Interface, # specify the interface(s) of the addable types here ) pop_w = schema.Int( title=_(u"Population Weight"), required=False, description=_(u"Weight of Population Centers"), ) # dem = schema.Object( title=_(u"Digital Elevation Map"), required=True, description=_(u"Select a GIS layer that provides regional elevation."), schema=Interface, # specify the interface(s) of the addable types here ) # landuse = schema.Object( title=_(u"Initial Land Use Map"), required=True, description=_(u"Provide an initial land use map for the scenario. Unused if a Starting Scenario is provided."), schema=Interface, # specify the interface(s) of the addable types here )
class IDXTestDocumentSchema(model.Schema): # zope.schema fields test_ascii_field = schema.ASCII(required=False) test_asciiline_field = schema.ASCIILine(required=False) test_bool_field = schema.Bool(required=False) test_bytes_field = schema.Bytes(required=False) test_bytesline_field = schema.BytesLine(required=False) test_choice_field = schema.Choice(values=[u"foo", u"bar"], required=False) test_choice_field_with_vocabulary = schema.Choice( vocabulary=SimpleVocabulary([ SimpleTerm(u"value1", "token1", u"title1"), SimpleTerm(u"value2", "token2", u"title2"), ]), required=False, ) test_date_field = schema.Date(required=False) test_datetime_field = schema.Datetime(required=False) test_datetime_tz_field = schema.Datetime( required=False, defaultFactory=lambda: timezone("Europe/Zurich").localize( datetime(2017, 10, 31, 10, 0)), ) test_decimal_field = schema.Decimal(required=False) test_dict_field = schema.Dict(required=False) test_float_field = schema.Float(required=False) test_frozenset_field = schema.FrozenSet(required=False) test_int_field = schema.Int(required=False) test_list_field = schema.List(required=False) test_list_field_with_choice_with_vocabulary = schema.List( value_type=schema.Choice(vocabulary=SimpleVocabulary([ SimpleTerm(u"value1", "token1", u"title1"), SimpleTerm(u"value2", "token2", u"title2"), SimpleTerm(u"value3", "token3", u"title3"), ])), required=False, ) test_set_field = schema.Set(required=False) test_text_field = schema.Text(required=False) test_textline_field = schema.TextLine(required=False) test_time_field = schema.Time(required=False) test_timedelta_field = schema.Timedelta(required=False) test_tuple_field = schema.Tuple(required=False) test_nested_list_field = schema.List(required=False, value_type=schema.Tuple()) test_nested_dict_field = schema.Dict(required=False, key_type=schema.ASCIILine(), value_type=schema.Tuple()) test_list_choice_with_context_vocabulary_field = schema.List( title=u"Field", value_type=schema.Choice( vocabulary="plone.restapi.testing.context_vocabulary"), required=False, ) # plone.app.textfield test_richtext_field = RichText( required=False, allowed_mime_types=["text/html", "text/plain"]) # plone.namedfile fields test_namedfile_field = namedfile.NamedFile(required=False) test_namedimage_field = namedfile.NamedImage(required=False) test_namedblobfile_field = namedfile.NamedBlobFile(required=False) test_namedblobimage_field = namedfile.NamedBlobImage(required=False) # z3c.relationfield test_relationchoice_field = RelationChoice( required=False, source=CatalogSource(id=["doc1", "doc2"])) test_relationlist_field = RelationList( required=False, value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), ) # Test fields for validation test_required_field = schema.TextLine(required=True) test_readonly_field = schema.TextLine(required=False, readonly=True) test_maxlength_field = schema.TextLine(required=False, max_length=10) test_constraint_field = schema.TextLine(required=False, constraint=lambda x: u"00" in x) test_datetime_min_field = schema.Datetime(required=False, min=datetime(2000, 1, 1)) test_time_min_field = schema.Time(required=False, min=time(1)) test_timedelta_min_field = schema.Timedelta(required=False, min=timedelta(100)) test_list_value_type_field = schema.List(required=False, value_type=schema.Int()) test_dict_key_type_field = schema.Dict(required=False, key_type=schema.Int()) read_permission(test_read_permission_field="cmf.ManagePortal") test_read_permission_field = schema.TextLine(required=False) write_permission(test_write_permission_field="cmf.ManagePortal") test_write_permission_field = schema.TextLine(required=False) read_permission(test_read_permission_field="cmf.ManagePortal") test_read_permission_field = schema.TextLine(required=False) test_invariant_field1 = schema.TextLine(required=False) test_invariant_field2 = schema.TextLine(required=False) test_missing_value_field = schema.TextLine(required=False, missing_value=u"missing", default=u"default") test_missing_value_required_field = schema.TextLine( required=True, missing_value=u"missing", default=u"some value") @invariant def validate_same_value(data): if data.test_invariant_field1 != data.test_invariant_field2: raise Invalid(u"Must have same values") # Test fields with default values test_default_value_field = schema.TextLine(required=True, default=u"Default") @provider(IContextAwareDefaultFactory) def default_factory(context): return u"DefaultFactory" test_default_factory_field = schema.TextLine( required=True, defaultFactory=default_factory)