class IBugBranch(IHasDateCreated, IHasBug, IHasBranchTarget): """A branch linked to a bug.""" export_as_webservice_entry() id = Int(title=_("Bug Branch #")) bug = exported( BugField( title=_("Bug #"), required=True, readonly=True)) branch_id = Int(title=_("Branch ID"), required=True, readonly=True) branch = exported( ReferenceChoice( title=_("Branch"), schema=IBranch, vocabulary="Branch", required=True)) revision_hint = TextLine(title=_("Revision Hint")) bug_task = Object( schema=IBugTask, title=_("The bug task that the branch fixes"), description=_( "the bug task reported against this branch's product or the " "first bug task (in case where there is no task reported " "against the branch's product)."), readonly=True) registrant = Object( schema=IPerson, readonly=True, required=True, title=_("The person who linked the bug to the branch"))
class ITranslatedLanguage(Interface): """Interface for providing translations for context by language. It expects `parent` to provide `IHasTranslationTemplates`. """ language = Object( title=_('Language to gather statistics and POFiles for.'), schema=ILanguage) parent = Object(title=_('A parent with translation templates.'), schema=IHasTranslationTemplates) pofiles = Attribute( _('Iterator over all POFiles for this context and language.')) translation_statistics = Attribute( _('A dict containing relevant aggregated statistics counts.')) def setCounts(total, translated, new, changed, unreviewed): """Set aggregated message counts for ITranslatedLanguage.""" def recalculateCounts(): """Recalculate message counts for this ITranslatedLanguage.""" last_changed_date = Datetime( title=_('When was this translation last changed.'), readonly=False, required=True) last_translator = Object( title=_('Last person that translated something in this context.'), schema=IPerson)
class ISharingJob(IRunnableJob): """A Job for sharing related tasks.""" id = Int( title=_('DB ID'), required=True, readonly=True, description=_("The tracking number for this job.")) job = Object(title=_('The common Job attributes'), schema=IJob, required=True) product = Object( title=_('The product the job is for'), schema=IProduct) distro = Object( title=_('The distribution the job is for'), schema=IDistribution) grantee = Object( title=_('The grantee the job is for'), schema=IPerson) metadata = Attribute('A dict of data about the job.') def destroySelf(): """Destroy this object.""" def getErrorRecipients(self): """See `BaseRunnableJob`.""" def pillar(): """Either product or distro, whichever is not None.""" def requestor(): """The person who initiated the job."""
class ICustomLanguageCode(Interface): """`CustomLanguageCode` interface.""" id = Int(title=_("ID"), required=True, readonly=True) product = Object(title=_("Product"), required=False, readonly=True, schema=IProduct) distribution = Object(title=_("Distribution"), required=False, readonly=True, schema=IDistribution) sourcepackagename = Object(title=_("Source package name"), required=False, readonly=True, schema=ISourcePackageName) language_code = TextLine( title=_("Language code"), description=_("Language code to treat as special."), required=True, readonly=False) language = Choice(title=_("Language"), required=False, readonly=False, vocabulary='Language', description=_( "Language to map this code to. " "Leave empty to drop translations for this code.")) # Reference back to the IHasCustomLanguageCodes. translation_target = Object( title=_("Context this custom language code applies to"), required=True, readonly=True, schema=IObject)
class IUserToUserEmail(Interface): """User to user direct email communications.""" sender = Object( schema=Interface, title=_("The message sender"), required=True, readonly=True) recipient = Object( schema=Interface, title=_("The message recipient"), required=True, readonly=True) date_sent = Datetime( title=_('Date sent'), description=_( 'The date this message was sent from sender to recipient.'), required=True, readonly=True) subject = TextLine( title=_('Subject'), required=True, readonly=True) message_id = TextLine( title=_('RFC 2822 Message-ID'), required=True, readonly=True)
class IMailingListSubscription(Interface): """A mailing list subscription.""" person = PublicPersonChoice( title=_('Person'), description=_('The person who is subscribed to this mailing list.'), vocabulary='ValidTeamMember', required=True, readonly=True) mailing_list = Choice( title=_('Mailing list'), description=_('The mailing list for this subscription.'), vocabulary='ActiveMailingList', required=True, readonly=True) date_joined = Datetime( title=_('Date joined'), description=_("The date this person joined the team's mailing list."), required=True, readonly=True) email_address = Object( schema=IEmailAddress, title=_('Email address'), description=_( "The subscribed email address or None, meaning use the person's " 'preferred email address, even if that changes.'), required=True) subscribed_address = Object( schema=IEmailAddress, title=_('Email Address'), description=_('The IEmailAddress this person is subscribed with.'), readonly=True)
class ICodeImportResult(Interface): """A completed code import job.""" id = Int(readonly=True, required=True) date_created = Datetime(readonly=True, required=True) code_import = Object( schema=ICodeImport, readonly=True, required=True, description=_("The code import for which the job was run.")) machine = Object(schema=ICodeImportMachine, readonly=True, required=True, description=_("The machine the job ran on.")) requesting_user = Object( schema=IPerson, readonly=True, required=False, description=_("The user that requested the import, if any.")) log_excerpt = Text(readonly=True, required=False, description=_( "The last few lines of the partial log, in case it " "is set.")) log_file = Object( schema=ILibraryFileAlias, readonly=True, required=False, description=_("A partial log of the job for users to see. It is " "normally only recorded if the job failed in a step " "that interacts with the remote repository. If a job " "was successful, or failed in a houskeeping step, the " "log file would not contain information useful to the " "user.")) status = Choice(vocabulary=CodeImportResultStatus, readonly=True, required=True, description=_( "How the job ended. Success, some kind of failure, or " "some kind of interruption before completion.")) date_job_started = Datetime(readonly=True, required=True, description=_("When the job started running.")) date_job_finished = Datetime( readonly=True, required=True, description=_("When the job stopped running.")) job_duration = Attribute("How long did the job take to run.")
class IScheduler(IAttributeAnnotatable): """Scheduler interface""" contains(ITask) zodb_name = Choice( title=_("ZODB connection name"), description=_("Name of ZODB defining scheduler connection"), required=False, default='', vocabulary=ZODB_CONNECTIONS_VOCABULARY_NAME) report_mailer = Choice( title=_("Reports mailer"), description=_("Mail delivery utility used to send mails"), required=False, vocabulary=MAILERS_VOCABULARY_NAME) report_source = TextLine( title=_("Reports source"), description=_("Mail address from which reports will be sent"), required=False) notified_host = TextLine( title=_("Notified host"), description=_("If websockets notifications are enabled, this is " "the host (including protocol) which will " "be notified"), required=False) show_home_menu = Bool( title=_("Access menu from home"), description=_("If 'yes', a menu will be displayed to get access to " "tasks scheduler from site admin home page"), required=True, default=False) internal_id = Attribute("Internal ID") def get_socket(self): """Get ZMQ socket matching scheduler utility""" def get_task(self, task_id): """Get task matching given task ID""" def get_jobs(self): """Get text output of running jobs""" tasks = List(title=_("Scheduler tasks"), description=_("List of tasks assigned to this scheduler"), value_type=Object(schema=ITask), readonly=True) history = List(title=_("History"), description=_("Task history"), value_type=Object(schema=ITaskHistory), readonly=True)
class IProvider(interface.Interface): """ A marker interface for a class that provides details on how to retrieve data from a given provider. """ fetcher = Object(IProductFetcher, title="Product Fetcher", required=True) parser = Object(IProductParser, title="Product Parser", required=True) def get_product(identifier, appID): """
class ICategoryContainer(Interface): local_categories = List(title=_(u"Local Categories"), value_type=Object(IPloneRatingCategory, title=_(u"Category")), required=False) acquired_categories = Tuple(title=_(u"Acquired Categories"), value_type=Object(IPloneRatingCategory, title=_(u"Category")), readonly=True, required=False)
class IBugTrackerPerson(IHasBug): """A link between a person and a bugtracker.""" bugtracker = Object( schema=IBugTracker, title=_('The bug.'), required=True) person = Object( schema=IPerson, title=_('Person'), required=True) name = Text( title=_("The name of the person on the bugtracker."), required=True) date_created = Datetime( title=_('Date Created'), required=True, readonly=True)
class IPOTemplateSharingSubset(Interface): """A subset of sharing PO templates.""" distribution = Object( title=_('The `IDistribution` associated with this subset.'), schema=IDistribution) product = Object( title=_('The `IProduct` associated with this subset.'), # Really IProduct, see _schema_circular_imports.py. schema=Interface) sourcepackagename = Object( title=_('The `ISourcePackageName` associated with this subset.'), schema=ISourcePackageName, required=False) def getSharingPOTemplates(potemplate_name): """Find all sharing templates of the given name. For distributions this method requires that sourcepackagename is set. :param potemplate_name: The name of the template for which to find sharing equivalents. :return: A list of all potemplates of the same name from all series. """ def getSharingPOTemplatesByRegex(name_pattern=None): """Find all sharing templates with names matching the given pattern. If name_pattern is None, match is performed on the template name. Use with care as it may return all templates in a distribution! :param name_pattern: A POSIX regular expression that the template is matched against. :return: A list of all potemplates matching the pattern. """ def getSharingPOTemplateIDs(potemplate_name): """Find database ids of all sharing templates of the given name. For distributions this method requires that sourcepackagename is set. This avoids serialization of full POTemplate objects. :param potemplate_name: The name of the template for which to find sharing equivalents. :return: A list of database ids of all potemplates of the same name from all series. """ def groupEquivalentPOTemplates(name_pattern=None): """Within given IProduct or IDistribution, find equivalent templates.
class IArticle(Interface): author = Object(schema=IPerson, title=u"Author", description=u"The author of the article.", required=False) title = TextLine(title=u"Article title", description=u"Please give the title of the article.", required=False) pages = Object(schema=IPages, title=u"Pages", description=u"Start and end page of the article.", required=False)
class IBranchJob(Interface): """A job related to a branch.""" id = Int(title=_('Unique id of BranchScanJob.')) branch = Object(title=_('Branch to use for this job.'), required=False, schema=IBranch) job = Object(schema=IJob, required=True) metadata = Attribute('A dict of data about the job.') def destroySelf(): """Destroy this object."""
class IVPOTExport(Interface): """Database view for efficient POT exports.""" potemplate = Object(title=u"See IPOTemplate", required=True, readonly=True, schema=IPOTemplate) template_header = Text(title=u"See IPOTemplate.header", required=True, readonly=True) potmsgset = Object(title=u"See `IPOTMsgSet`.", required=True, readonly=True, schema=IPOTMsgSet) sequence = Int(title=u"See `IPOTMsgSet`.sequence", required=False, readonly=True) comment = Text(title=u"See `IPOTMsgSet`.commenttext", required=False, readonly=True) source_comment = Text(title=u"See `IPOTMsgSet`.sourcecomment", required=False, readonly=True) file_references = Text(title=u"See `IPOTMsgSet.filereferences`", required=False, readonly=True) flags_comment = Text(title=u"See `IPOTMsgSet`.flagscomment", required=False, readonly=True) context = Text(title=u"See `IPOTMsgSet`.context", required=False, readonly=True) msgid_singular = Text(title=u"See `IPOMsgID`.pomsgid", required=True, readonly=True) msgid_plural = Text(title=u"See `IPOMsgID`.pomsgid", required=False, readonly=True)
class IOAuthToken(Interface): """Base class for `IOAuthRequestToken` and `IOAuthAccessToken`. This class contains the commonalities of the two token classes we actually care about and shall not be used on its own. """ consumer = Object(schema=IOAuthConsumer, title=_('The consumer.'), description=_( "The consumer which will access Launchpad on the " "user's behalf.")) person = Object( schema=IPerson, title=_('Person'), required=False, readonly=False, description=_('The user on whose behalf the consumer is accessing.')) key = TextLine(title=_('Key'), required=True, readonly=True, description=_( 'The key used to identify this token. It is included ' 'by the consumer in each request.')) secret = TextLine(title=_('Secret'), required=True, readonly=True, description=_( 'The secret associated with this token. It is used ' 'by the consumer to sign its requests.')) product = Choice(title=_('Project'), required=False, vocabulary='Product') project = Choice(title=_('Project'), required=False, vocabulary='ProjectGroup') sourcepackagename = Choice(title=_("Package"), required=False, vocabulary='SourcePackageName') distribution = Choice(title=_("Distribution"), required=False, vocabulary='Distribution') context = Attribute("FIXME") is_expired = Bool(title=_("Whether or not this token has expired."), required=False, readonly=True, description=_( "A token may only be usable for a limited time, " "after which it will expire."))
class IPersonNotification(Interface): """A textual message about a change in our records about a person.""" person = Object( title=_("The person who will receive this notification."), schema=IPerson) date_emailed = Datetime( title=_("Date emailed"), description=_("When was the notification sent? None, if it hasn't" " been sent yet."), required=False) date_created = Datetime(title=_("Date created")) body = Text(title=_("Notification body.")) subject = TextLine(title=_("Notification subject.")) can_send = Attribute("Can the notification be sent?") to_addresses = Attribute( "The list of addresses to send the notification to.") def destroySelf(): """Delete this notification.""" def send(): """Send the notification by email."""
class IHasCustomLanguageCodes(Interface): """A context that can have custom language codes attached. Implemented by `Product` and `SourcePackage`. """ custom_language_codes = Set( title=_("Custom language codes"), description=_("Translations for these language codes are re-routed."), value_type=Object(schema=ICustomLanguageCode), required=False, readonly=False) has_custom_language_codes = Bool( title=_("There are custom language codes in this context."), readonly=True, required=True) def getCustomLanguageCode(language_code): """Retrieve `CustomLanguageCode` for `language_code`. :return: a `CustomLanguageCode`, or None. """ def createCustomLanguageCode(language_code, language): """Create `CustomLanguageCode`. :return: the new `CustomLanguageCode` object. """ def removeCustomLanguageCode(language_code): """Remove `CustomLanguageCode`.
class ISpecificationBug(IBugLink): """A link between a Bug and a specification.""" specification = Object(title=_('The specification linked to the bug.'), required=True, readonly=True, schema=ISpecification)
def test_wrong_contained_type_field(self): from zope.schema import Object from zope.schema import List from zope.schema.interfaces import WrongContainedType class IThing(interface.Interface): pass field = List(value_type=Object(IThing)) # This gets us to the second pass, after we run the fromObject # one time. _adapt_sequence fails. with self.assertRaises(WrongContainedType): self._callFUT(field, [object()]) class Conforms(object): def __conform__(self, iface): assert iface is IThing return 'conforms' with self.assertRaises(WrongContainedType) as exc: self._callFUT(field, [Conforms()]) ex = exc.exception assert_that(ex.errors[0], has_property('value', is_(Conforms)))
class ISignableArchive(Interface): """`SignableArchive` interface. `IArchive` adapter for operations that involve signing files. """ archive = Object(title=_('Corresponding IArchive'), required=True, schema=IArchive) can_sign = Attribute("True if this archive is set up for signing.") def signRepository(suite, pubconf=None, suffix='', log=None): """Sign the corresponding repository. :param suite: suite name to be signed. :param pubconf: an optional publisher configuration instance indicating where files should be written (if not passed, uses the archive's defaults). :param suffix: an optional suffix for repository index files (e.g. ".new" to help with publishing files atomically). :param log: an optional logger. :return: A sequence of output paths that were produced, relative to the suite's path, with `suffix` removed. :raises CannotSignArchive: if the context archive is not set up for signing. :raises AssertionError: if there is no Release file in the given suite. """ def signFile(suite, path, log=None): """Sign the corresponding file.
class ISchemaContext(IItem): """ A publishable wrapper of a zope 3 schema """ schema = Object( schema=IInterface ) schemaEditorView = Attribute( """Name of the schema editor view. Optional.""") additionalSchemata = Attribute( """Additional schemas that may modify this one.""") allowedFields = Attribute( """List of field factory ids that may be added to this schema. Or None to allow all fields. """) fieldsWhichCannotBeDeleted = Attribute( """List of field names that may not be deleted from this schema.""" ) enableFieldsets = Attribute( """Enable extra fieldsets.""" )
class IQuestionBug(IBugLink): """A link between an IBug and an IQuestion.""" question = Object(title=_('The question to which the bug is linked to.'), required=True, readonly=True, schema=IQuestion)
class IMyMultiObject(Interface): """Multi-object interface""" list_of_objects = List(title="My list field", value_type=Object( title='my object widget', schema=IMySubObjectMulti)) name = TextLine(title='name')
class ILanguagePack(Interface): """Language pack store.""" id = Int(title=_('Language pack ID.'), required=True, readonly=True) file = Object(title=_('Librarian file where the language pack is stored.'), required=True, schema=ILibraryFileAlias) date_exported = Datetime(title=_('When this language pack was exported.'), required=True) distroseries = Choice( title=_('The distribution series from which it was exported.'), required=True, vocabulary='FilteredDistroSeries') type = Choice(title=_('Language pack type'), required=True, vocabulary=LanguagePackType, description=_(""" The language pack is either a "Full" export, or a "Delta" of changes from the base language pack of the distribution series. """)) updates = Attribute(_('The LanguagePack that this one updates.'))
class ISkin(Interface): def _run(): """ _run() is called from Application.run, to set in motion whatever mechanism the concrete backend uses to display widgets. """ def _quit(): """ _quit() is called from Application.quit to terminate the application; it might never return (or leave the backend in an unspecified state) """ def _schedule(timeout, callback, repeat=False): """ _schedule is called from Application.schedule to actually do the scheduling of the delayed action. """ def _concreteParenter(parent, child): """ _concreteParenter dos the skin-specific magic that `glues' a child with its parent. """ # thanks to Stephan Richter <*****@*****.**> Window = Object( schema=IWindow, title=u'Window', required=True, )
class IProjectGroupSeries(IHasSpecifications, IHasAppointedDriver, IHasIcon, IHasOwner): """Interface for ProjectGroupSeries. This class provides the specifications related to a "virtual project group series", i.e., to those specifications that are assigned to a series of a product which is part of this project group. """ name = TextLine(title=u'The name of the product series.', required=True, readonly=True, constraint=name_validator) displayname = TextLine(title=u'Alias for name.', required=True, readonly=True, constraint=name_validator) title = TextLine(title=u'The title for this project series.', required=True, readonly=True) projectgroup = Object(schema=IProjectGroup, title=u"The project group this series belongs to", required=True, readonly=True)
class ILaunchpadBrowserApplicationRequest( IBasicLaunchpadRequest, IBrowserApplicationRequest): """The request interface to the application for LP browser requests.""" form_ng = Object( title=u'IBrowserFormNG object containing the submitted form data', schema=IBrowserFormNG)
class ISloganSchema(Interface): site_slogan = List(title=_(u"Site Slogan"), description=_(u"Displayed in the portal header. "), default=[], value_type=Object(ITitleLanguagePair, title=u"Slogan by Language"), required=False)
class ICalendarOverlayInfo(Interface): """Information about an overlaid calendar.""" calendar = Object( title=u"Calendar", schema=ISchoolToolCalendar, description=u""" Calendar. """) color1 = TextLine( title=u"Color 1", description=u""" Color for this calendar. This is a string that is acceptable as a CSS color, e.g. '#ccffee'. """) color2 = TextLine( title=u"Color 2", description=u""" Color for this calendar. This is a string that is acceptable as a CSS color, e.g. '#ccffee'. """) show = Bool( title=u"Show", description=u""" An option that controls whether events from this calendar are shown in the calendar views (show=True), or if they are only listed in the portlet (show=False). """)