class IFigshare(IOAuth1Settings): authorization_url = URI( title=u"Authorization url", description=u"Url to start user authorization", default="http://api.figshare.com/v1/pbl/oauth/authorize", required=False, ) request_url = URI( title=u"Request url", description=u"Url to request token", default="http://api.figshare.com/v1/pbl/oauth/request_token", required=False, ) access_url = URI( title=u"Access url", description=u"Url to get access token", default="http://api.figshare.com/v1/pbl/oauth/access_token", required=False, ) revoke_url = URI( title=u"Revoke url", description=u"Url to revoke authorization", default="http://figshare.com/account/applications", required=False, )
class IOAuth2Settings(Interface): id = ASCIILine(title=u"ID", ) title = TextLine( title=u"Name", description=u"Used for display", ) enabled = Bool( title=u"Enabled", default=False, ) scope = List(title=u"Scope", required=False, value_type=TextLine()) client_id = TextLine( title=u"Client id", description=u"ID associated with this application", required=False, ) client_secret = TextLine( title=u"Client secret", description=u"Secret associated with this application", required=False, ) authorization_url = URI( title=u"Authorization url", description=u"Url to start user authorization", required=False, ) token_url = URI( title=u"Token url", description=u"Url to token service", required=False, ) refresh_url = URI( title=u"Refresh url", description=u"Url to token refresh service", required=False, ) redirect_url = URI( title=u"Redirect url", description=u"Url to redirect to after successful authorization", required=False, ) revoke_url = URI( title=u"Revoke url", description=u"Url to revoke authorization", required=False, )
class IOAuth1Settings(Interface): id = ASCIILine(title=u"ID", ) title = TextLine( title=u"Name", description=u"Used for display", ) enabled = Bool( title=u"Enabled", default=False, ) client_key = TextLine( title=u"Client key", description=u"Key associated with this application", required=False, ) client_secret = TextLine( title=u"Client secret", description=u"Secret associated with this application", required=False, ) authorization_url = URI( title=u"Authorization url", description=u"Url to start user authorization", required=False, ) request_url = URI( title=u"Request url", description=u"Url to request token", required=False, ) access_url = URI( title=u"Access url", description=u"Url to get access token", required=False, ) redirect_url = URI( title=u"Redirect url", description=u"Url to redirect to after successful authorization", required=False, ) revoke_url = URI( title=u"Revoke url", description=u"Url to revoke authorization", required=False, )
class IRSSTileData(IPersistentCoverTile): feeds = List( title=u("Feeds"), unique=True, value_type=URI(title=u('URL')), ) items_to_show = Int(title=u("Number of items to show"), ) max_per_feed = Int(title=u("Maximum number of items from a given feed"), ) blacklist = List( title=u("Blacklisted words"), unique=True, value_type=ASCII(title=u('Word')), required=False, missing_value=[], ) whitelist = List( title=u("Whitelisted words"), unique=True, value_type=ASCII(title=u('Word')), required=False, missing_value=[], )
class IJSONMigratorRun(Interface): """ remote source interface """ config = TextLine() remote_url = URI( title=_(u"URL"), description=_(u"URL for the remote site that will provide the " u"content to be imported and migrated "), required=True, ) remote_username = ASCIILine( title=_(u"Username"), description=_(u"Username to log in to the remote site "), required=True, ) remote_password = TextLine( title=_(u"Password"), description=_(u"Password to log in to the remote site "), required=True, ) remote_path = TextLine( title=_(u"Start path"), description=_(u"Path where to start crawling and importing " u"into current location."), required=True, ) remote_crawl_depth = Int( title=_(u"Crawl depth"), description=_(u"How deep should we crawl remote site"), required=True, ) remote_skip_path = List( title=_(u"Paths to skip"), description=_(u"Which paths to skip when crawling."), value_type=TextLine(), required=False, ) catalog_path = TextLine( title=_(u"Catalog Path"), description=_(u"The absolute path of the catalog tool."), required=True, ) catalog_query = Text( title=_(u"Catalog Query"), description=_("Specify query parameters in dict notation. If left " "empty, all items will be returned."), required=False, )
class IOverrideRealm(Interface): active = Bool(title=u'Active', required=False, default=True) url = URI(title=u'URL to the Plone-Site', required=True) username = TextLine(title=u'Zope username', required=True) password = TextLine(title=u'Zope password', required=True)
class IRealm(Interface): active = Bool(title=_(u'label_realm_active', default=u'Active')) url = URI(title=_(u'label_realm_url', u'URL to the Plone-Site')) username = TextLine(title=_(u'label_realm_username', u'Username')) password = Password(title=_(u'label_realm_password', u'Password'))
class IDirectivesInfo(Interface): """Schema for the ``directives`` directive """ namespace = URI( title=u("Namespace"), description=u("The namespace in which directives' names " "will be defined"), )
class IEntityByUrl(IManageableEntity): url = URI( title=_(u"entity_url_title", "Url"), description=_( u"entity_url_description", u"Url from which this entities' metadata can be fetched.", ), required=True, )
class IAvatarURL(Interface): """ Something that features a display URL. """ avatarURL = URI( title=u"URL of your avatar picture", description=u"If not provided, one will be generated for you.", required=False)
class IOAuth2Settings(Interface): id = ASCIILine(title=u"ID", ) title = TextLine(title=u"Name", ) enabled = Bool( title=u"Enabled", default=False, ) client_id = TextLine( title=u"Client id", required=False, ) client_secret = TextLine( title=u"Client secret", required=False, ) authorization_url = URI( title=u"Authorization url", required=False, ) token_url = URI( title=u"Token url", required=False, ) refresh_url = URI( title=u"Refresh url", required=False, ) redirect_url = URI( title=u"Redirect url", required=False, ) revoke_url = URI( title=u"Revoke url", required=False, )
class IGSSetPasswordRegister(ISetPassword): groupId = GroupID( title='Group identifier', description='The identifier for the group that you wish to join.', required=False) came_from = URI( title='Came from', description='The page to return to after registration has finished', required=False)
class IEventSchema(Interface): """Schema for event views. """ title = TextLine( title=_(u'Title'), required=False, missing_value=u'', max_length=100) contact_name = TextLine( title=_(u'Contact Name'), required=False, missing_value=u'', max_length=100) location = TextLine( title=_(u'Location'), required=False, missing_value=u'', max_length=100) contact_email = EmailLine( title=_(u'Contact Email'), required=False) categories = Set( title=_(u'Category'), required=False, missing_value=set(), value_type=Choice(vocabulary="cmf.calendar.AvailableEventTypes")) contact_phone = TextLine( title=_(u'Contact Phone'), required=False, missing_value=u'', max_length=100) event_url = URI( title=_(u'URL'), required=False, missing_value=u'', max_length=100) start_date = Datetime( title=_(u'From'),) stop_date = Datetime( title=_(u'To'),) description = Text( title=_(u'Description'), required=False, missing_value=u'')
class IGSVerifyWait(Interface): """Schema use to define the user-interface presented while the user waits for verification of his or her email address.""" email = EmailAddress(title=_('verify-wait-email-label', 'Email address'), description=_('verify-wait-email-help', 'Your email address.'), required=True) came_from = URI( title='Came from', description='The page to return to after registration has finished', required=False)
class IPartner(form.Schema, IImageScaleTraversable): """Generic container content type for versatile content.""" image = NamedBlobImage( title=_(u'Logo'), description=_(u'Upload your organization logo.'), required=False, ) address = TextLine( title=_(u'Street Address'), required=True, ) city = TextLine( title=_(u'City'), required=False, ) post_code = TextLine( title=_(u'Post Code'), required=False, ) country = Choice( title=_(u'Country'), required=True, vocabulary=countries, default=u'fi', ) email = List( title=_(u'E-mail'), description= _(u"Input e-mail line by line putting representative e-mail on the top." ), value_type=TextLine(), required=True, ) link = URI( title=_(u'Link'), description=_(u'Link to the organization.'), required=False, ) year = Choice( title=_(u'Partner since'), description=_( u'Select the year when the organization became the partner.'), required=True, values=years, default=current_year, )
class IGoogleDrive(IOAuth2Settings): scope = List(title=u"Scope", required=False, default=[u'https://www.googleapis.com/auth/drive'], value_type=TextLine()) authorization_url = URI( title=u"Authorization url", description=u"Url to start user authorization", default="https://accounts.google.com/o/oauth2/auth", required=False, ) token_url = URI( title=u"Token url", description=u"Url to token service", default="https://accounts.google.com/o/oauth2/token", required=False, ) refresh_url = URI( title=u"Refresh url", description=u"Url to token refresh service", default="https://accounts.google.com/o/oauth2/token", required=False, ) redirect_url = URI( title=u"Redirect url", description=u"Url to redirect to after successful authorization", required=False, ) revoke_url = URI( title=u"Revoke url", description=u"Url to revoke authorization", # Google OAuth2 would also have programmatic web endpoint to revoke access default="https://security.google.com/settings/security/permissions", required=False, )
class IGSCoreProfileRegister(IGSCoreProfile): joinable_groups = List(title=u'Joinable Groups', description=u'Groups on this site you can join.', required=False, value_type=Choice(title=u'Group', vocabulary='JoinableGroups'), unique=True, default=[]) came_from = URI( title=u'Came From', description=u'The page to return to after registration has finished', required=False)
class IBrowserMenuItem(Interface): """Menu type An interface that defines a menu. """ title = TextLine( title=_("Menu item title"), description=_("The title provides the basic label for the menu item."), required=True) description = Text( title=_("Menu item description"), description=_("A description of the menu item. This might be shown " "on menu pages or in pop-up help for menu items."), required=False) action = TextLine(title=_("The URL to display if the item is selected"), description=_( "When a user selects a browser menu item, the URL" "given in the action is displayed. The action is " "usually given as a relative URL, relative to the " "object the menu item is for."), required=True) order = Int(title=_("Menu item ordering hint"), description=_( "This attribute provides a hint for menu item ordering." "Menu items will generally be sorted by the `for_`" "attribute and then by the order.")) filter_string = TextLine( title=_("A condition for displaying the menu item"), description=_("The condition is given as a TALES expression. The " "expression has access to the variables:\n" "\n" "context -- The object the menu is being displayed " "for\n" "\n" "request -- The browser request\n" "\n" "nothing -- None\n" "\n" "The menu item will not be displayed if there is a \n" "filter and the filter evaluates to a false value."), required=False) icon = URI(title=_("Icon URI"), description=_("URI of the icon representing this menu item")) def available(): """Test whether the menu item should be displayed
class ILoginSchema(Interface): """Schema for login form. """ came_from = URI(required=False) name = TextLine(title=_(u'Member ID'), description=_(u'Case sensitive')) password = Password(title=_(u'Password'), description=_(u'Case sensitive')) persistent = Bool(title=_(u'Remember my ID.'), description=_(u'Saves your member ID in a cookie.'), default=True)
class IFeedPerson(Interface): """Interface for a person in a feed.""" name = TextLine(title=u"Name", description=u"The person's name.", required=True) email = TextLine(title=u"Email", description=u"The person's email address.", required=False) uri = URI(title=u"URI", description=u"The URI for the person.", required=True)
class IDropbox(IOAuth2Settings): authorization_url = URI( title=u"Authorization url", description=u"Url to start user authorization", default="https://www.dropbox.com/oauth2/authorize", required=False, ) token_url = URI( title=u"Token url", description=u"Url to token service", default="https://api.dropboxapi.com/oauth2/token", required=False, ) refresh_url = URI( title=u"Refresh url", description=u"Url to token refresh service", default="https://api.dropboxapi.com/oauth2/token", required=False, ) redirect_url = URI( title=u"Redirect url", description=u"Url to redirect to after successful authorization", required=False, ) revoke_url = URI( title=u"Revoke url", description=u"Url to revoke authorization", # Google OAuth2 would also have programmatic web endpoint to revoke access default="https://api.dropboxapi.com/2/auth/token/revoke", required=False, )
class ISearchResult(Interface): """An item that matches a search query.""" title = TextLine(title=_('Title'), required=True, description=_('The title of the item.')) url = URI(title=_('URL'), required=True, description=_('The full URL of the item.')) summary = Text( title=_('Title'), required=True, description=_( 'A summary of the item, possibly with information about why the ' 'item is considered to be a valid result for a search.'))
class IBreadcrumbInfo(Interface): """Provides pieces of information about a breadcrumb.""" name = TextLine(title=u'Name', description=u'The name of the breadcrumb.', required=True) url = URI(title=u'URL', description=u'The url of the breadcrumb.', required=True) active = Bool( title=u'Active', description=u'Tells whether the breadcrumb link should active.', required=True, default=True)
class IGSRequestRegistration(Interface): """Schema use to define the user-interface that start the whole registration process""" # Unfortunately the group identifier is not checked against the # joinable groups, because there is no "user" to check with. email = EmailAddress(title=_('request-email-label', 'Email address'), description=_('request-email-help', 'Your email address.'), required=True) groupId = GroupID( title='Group identifier', description='The identifier for the group that you wish to join.', required=False) came_from = URI( title='Came from', description='The page to return to after registration has finished', required=False)
class IMetadataSchema(Interface): """Schema for metadata views. """ allow_discussion = Choice( title=_(u'Enable Discussion?'), required=False, vocabulary=SimpleVocabulary.fromTitleItems(available_settings)) identifier = URI(title=_(u'Identifier'), readonly=True) title = TextLine(title=_(u'Title'), required=False, missing_value=u'') description = Text(title=_(u'Description'), required=False, missing_value=u'') subject = Set(title=_(u'Subject'), required=False, missing_value=set(), value_type=TextLine()) contributors = Tuple(title=_(u'Contributors'), required=False, missing_value=(), value_type=TextLine()) created = Datetime(title=_(u'Creation Date'), readonly=True) modified = Datetime(title=_(u'Last Modified Date'), readonly=True) effective = Datetime(title=_(u'Effective Date'), required=False) expires = Datetime(title=_(u'Expiration Date'), required=False) format = TextLine(title=_(u'Format'), required=False, missing_value=u'') language = TextLine(title=_(u'Language'), required=False, missing_value=u'') rights = TextLine(title=_(u'Rights'), required=False, missing_value=u'')
class IOAuth2Client(Interface): """ Interface to desicreb OAuth clients. """ client_id = TextLine(title=u"client_id", ) type = Choice( title=u"type", values=(u"public", u"confidential"), default=u"public", ) redirect_uris = List(title=u"Redirect URIs", value_type=URI()) title = TextLine(title=u"title", ) description = Text(title=u"description", ) logo_url = TextLine(title=u"logo url", required=False)
class IURIObject(Interface): """An opaque identifier of a role or a relationship type. Roles and relationships are identified by URIs in XML representation. URI objects let the application assign human-readable names to roles and relationship types. URI objects are equal iff their uri attributes are equal. URI objects are hashable. """ uri = URI(title=u"URI", description=u"The URI (as a string).") name = TextLine(title=u"Name", description=u"Human-readable name.") description = Text(title=u"Description", description=u"Human-readable description.") def persist(): """Return persistent version of self to store in DB.""" def __eq__(other): """self == other""" def __ne__(other): """self != other""" def __hash__(): """Hash self (for example, return hash of uri)""" def access(state): """Access relevant portion of shared state.""" def bind(instance, my_role, rel_type, other_role): """Return a relationship property bound to given instance.""" def filter(link): """Default filter."""
class IGitRemoteResourceDirectoryDirective(Interface): """Register resource directories with the global registry. """ uri = URI(title=u'Repository URI', description=u'Valid GIT repository URI', required=True) branch = ASCIILine(title=u'Branch', description=u'Repository branch (defaults to master)', required=False) directory = TextLine( title=u'Directory path', description=u'Optional path relative to the repository root', required=False) name = ASCIILine(title=u'Name', description=u'Unique name for the resource directory', required=True) type = IResourceDirectoryDirective['type']
class IOAuth1Settings(Interface): id = ASCIILine(title=u"ID", ) title = TextLine(title=u"Name", ) enabled = Bool( title=u"Enabled", default=False, ) client_key = TextLine( title=u"Client key", required=False, ) client_secret = TextLine( title=u"Client secret", required=False, ) oauth_url = URI( title=u"OAuth url", required=False, ) authorization_url = URI( title=u"Authorization url", required=False, ) request_url = URI( title=u"Request url", required=False, ) access_url = URI( title=u"Acces url", required=False, ) redirect_url = URI( title=u"Redirect url", required=False, ) revoke_url = URI( title=u"Revoke url", required=False, )
class IGSChangeWebFeed(Interface): feedUri = URI( title=u'Web Feed Address', description=u'The address of the web feed you wish to display', required=False)
def __init__(self, value): # check that it is a valid URI, else URI.validate will raise an error _uri = URI() _uri.fromUnicode(value) self.value=value