class IBinaryPackageBuildView(IPackageBuild): """A Build interface for items requiring launchpad.View.""" id = Int(title=_('ID'), required=True, readonly=True) # Overridden from IBuildFarmJob to ensure required is True. processor = Reference( title=_("Processor"), schema=IProcessor, required=True, readonly=True, description=_("The Processor where this build should be built.")) source_package_release = Reference( title=_('Source'), schema=ISourcePackageRelease, required=True, readonly=True, description=_("The SourcePackageRelease requested to build.")) source_package_release_id = Int() distro_arch_series = Reference( title=_("Architecture"), # Really IDistroArchSeries schema=Interface, required=True, readonly=True, description=_("The DistroArchSeries context for this build.")) distro_arch_series_id = Int() arch_indep = Bool(title=_("Build architecture independent packages"), required=False, readonly=True) # Properties current_source_publication = exported( Reference( title=_("Source publication"), schema=ISourcePackagePublishingHistory, required=False, readonly=True, description=_("The current source publication for this build."))) api_source_package_name = exported(TextLine(title=_("Source package name"), required=False, readonly=True), exported_as="source_package_name") distro_series = Attribute("Direct parent needed by CanonicalURL") arch_tag = exported(Text(title=_("Architecture tag"), required=False)) distributionsourcepackagerelease = Attribute( "The page showing the " "details for this sourcepackagerelease in this distribution.") binarypackages = Attribute( "A list of binary packages that resulted from this build, " "not limited and ordered by name.") distroarchseriesbinarypackages = Attribute( "A list of distroarchseriesbinarypackages that resulted from this" "build, ordered by name.") can_be_rescored = exported( Bool(title=_("Can Be Rescored"), required=False, readonly=True, description=_("Whether or not this build record can be rescored " "manually."))) can_be_retried = exported( Bool( title=_("Can Be Retried"), required=False, readonly=True, description=_("Whether or not this build record can be retried."))) can_be_cancelled = exported( Bool(title=_("Can Be Cancelled"), required=False, readonly=True, description=_( "Whether or not this build record can be cancelled."))) upload_changesfile = Attribute( "The `LibraryFileAlias` object containing the changes file which " "was originally uploaded with the results of this build. It's " "'None' if it is build imported by Gina.") changesfile_url = exported( TextLine(title=_("Changes File URL"), required=False, description=_( "The URL for the changes file for this build. " "Will be None if the build was imported by Gina."))) buildinfo = Attribute( "The `LibraryFileAlias` object containing build information for " "this build, if any.") package_upload = Attribute( "The `PackageUpload` record corresponding to the original upload " "of the binaries resulted from this build. It's 'None' if it is " "a build imported by Gina.") api_score = exported(Int( title=_("Score of the related job (if any)"), readonly=True, ), exported_as="score") def updateDependencies(): """Update the build-dependencies line within the targeted context.""" def __getitem__(name): """Mapped to getBinaryPackageRelease.""" def getBinaryPackageRelease(name): """Return the binary package from this build with the given name, or raise NotFoundError if no such package exists. """ def createBinaryPackageRelease(binarypackagename, version, summary, description, binpackageformat, component, section, priority, installedsize, architecturespecific, shlibdeps=None, depends=None, recommends=None, suggests=None, conflicts=None, replaces=None, provides=None, pre_depends=None, enhances=None, breaks=None, essential=False, debug_package=None, user_defined_fields=None, homepage=None): """Create and return a `BinaryPackageRelease`. The binarypackagerelease will be attached to this specific build. """ def getFileByName(filename): """Return the corresponding `ILibraryFileAlias` in this context. The following file types (and extension) can be looked up in the archive context: * Binary changesfile: '.changes'; * Build logs: '.txt.gz'; * Build upload logs: '_log.txt'; :param filename: exactly filename to be looked up. :raises AssertionError if the given filename contains a unsupported filename and/or extension, see the list above. :raises NotFoundError if no file could not be found. :return the corresponding `ILibraryFileAlias` if the file was found. """ def getBinaryPackageFileByName(filename): """Return the corresponding `IBinaryPackageFile` in this context. :param filename: the filename to look up. :return: the corresponding `IBinaryPackageFile` if it was found. """ def getBinaryPackageNamesForDisplay(): """Retrieve the build's binary package names for display purposes. :return: a result set of (`IBinaryPackageRelease`, `IBinaryPackageName`) ordered by name and `IBinaryPackageRelease.id`. """ def getBinaryFilesForDisplay(): """Retrieve the build's `IBinaryPackageFile`s for display purposes. Also prefetches other related objects needed for display. :return: a result set of (`IBinaryPackageRelease`, `IBinaryPackageFile`, `ILibraryFileAlias`, `ILibraryFileContent`). """ @operation_returns_entry(ISourcePackagePublishingHistory) @export_read_operation() @operation_for_version("devel") def getLatestSourcePublication(): """The latest source publication corresponding to this build.
class IObjectManager(IZopeObject, ICopyContainer, INavigation, IManageable, IAcquirer, IPersistent, ITraversable, IPossibleSite, IContainer): """Generic object manager This interface provides core behavior for collections of heterogeneous objects.""" meta_types = Tuple( title=u"Meta types", description=u"Sub-object types that are specific to this object", ) isAnObjectManager = Bool(title=u"Is an object manager", ) manage_main = Attribute(""" """) manage_index_main = Attribute(""" """) manage_addProduct = Attribute(""" """) manage_importExportForm = Attribute(""" """) def all_meta_types(interfaces=None): """ """ def _subobject_permissions(): """ """ def filtered_meta_types(user=None): """Return a list of the types for which the user has adequate permission to add that type of object. """ def _setOb(id, object): """ """ def _delOb(id): """ """ def _getOb(id, default=None): """ """ def _setObject(id, object, roles=None, user=None, set_owner=1): """ """ def _delObject(id, dp=1): """ """ def hasObject(id): """Indicate whether the folder has an item by ID. """ def objectIds(spec=None): """List the IDs of the subobjects of the current object. If 'spec' is specified, returns only objects whose meta_types match 'spec'. """ def objectValues(spec=None): """List the subobjects of the current object. If 'spec' is specified, returns only objects whose meta_types match 'spec'. """ def objectItems(spec=None): """List (ID, subobject) tuples for subobjects of the current object. If 'spec' is specified, returns only objects whose meta_types match 'spec'. """ def objectMap(): """Return a tuple of mappings containing subobject meta-data. """ def superValues(t): """Return all of the objects of a given type located in this object and containing objects. """ def manage_delObjects(ids=[], REQUEST=None): """Delete a subordinate object The objects specified in 'ids' get deleted. """ def tpValues(): """Return a list of subobjects, used by tree tag. """ def manage_exportObject(id='', download=None, RESPONSE=None, REQUEST=None): """Exports an object to a file and returns that file.""" def manage_importObject(file, REQUEST=None, set_owner=1): """Import an object from a file""" def _importObjectFromFile(filepath, verify=1, set_owner=1): """
class IBoolTest(Interface): b1 = Bool(required=True) b2 = Bool(required=False)
class IDistroArchSeriesPublic(IHasBuildRecords, IHasOwner): """Public attributes for a DistroArchSeries.""" id = Attribute("Identifier") distroseries = exported( Reference(IDistroSeries, title=_("The context distroseries"), required=False, readonly=False)) processor = exported( ReferenceChoice(title=_("Processor"), required=True, readonly=True, vocabulary='Processor', schema=IProcessor)) architecturetag = exported(TextLine( title=_("Architecture Tag"), description=_( "The architecture tag, or short piece of text that " "identifies this architecture. All binary packages in the " "archive will use this tag in their filename. Please get it " "correct. It should really never be changed!"), required=True, constraint=name_validator), exported_as="architecture_tag") official = exported( Bool(title=_("Official Support"), description=_("Indicate whether or not this port has official " "support from the vendor of the distribution."), required=True)) owner = exported( Reference(IPerson, title=_('The person who registered this port.'), required=True)) package_count = exported( Int(title=_("Package Count"), description=_('A cache of the number of packages published ' 'in the RELEASE pocket of this port.'), readonly=False, required=False)) supports_virtualized = exported( Bool(title=_("PPA support available"), description=_("Indicate whether or not this port has support " "for building PPA packages."), readonly=True, required=False)) enabled = exported(Bool( title=_("Enabled"), description=_( "Whether or not this DistroArchSeries is enabled for build " "creation and publication."), readonly=False, required=False), as_of="devel") # Joins. packages = Attribute('List of binary packages in this port.') # Page layouts helpers. title = exported( TextLine(title=_('Title'), description=_("The title of this distroarchseries."))) displayname = exported(TextLine( title=_("Display name"), description=_("The display name of this distroarchseries.")), exported_as="display_name") # Other useful bits. isNominatedArchIndep = exported(Bool( title=_("Is Nominated Arch Independent"), description=_( 'True if this distroarchseries is the NominatedArchIndep ' 'one.')), exported_as="is_nominated_arch_indep") main_archive = exported( Reference( Interface, # Really IArchive, circular import fixed below. title=_('Main Archive'), description=_("The main archive of the distroarchseries."))) chroot_url = exported( TextLine(title=_("Build chroot URL"), description=_("The URL to the current build chroot for this " "distroarchseries."), readonly=True)) def updatePackageCount(): """Update the cached binary package count for this distro arch series. """ def getPocketChroot(pocket, exact_pocket=False, image_type=None): """Return the PocketChroot for this series, pocket, and image type. If exact_pocket is False, this follows pocket dependencies and finds the chroot for the closest pocket that exists: for example, if no chroot exists for SECURITY, then it will choose the one for RELEASE. If exact_pocket is True, this only finds chroots for exactly the given pocket. The image type defaults to `BuildBaseImageType.CHROOT`. """ def getChroot(default=None, pocket=None, image_type=None): """Return the Chroot for this series, pocket, and image type. It uses getPocketChroot and if not found returns 'default'. The pocket defaults to `PackagePublishingPocket.RELEASE`; the image type defaults to `BuildBaseImageType.CHROOT`. """ @operation_parameters(pocket=Choice(vocabulary=PackagePublishingPocket, required=False), image_type=Choice(vocabulary=BuildBaseImageType, required=False)) @export_read_operation() @operation_for_version("devel") def getChrootURL(pocket=None, image_type=None): """Return the chroot URL for this series, pocket, and image type. The pocket defaults to "Release"; the image type defaults to "Chroot tarball". """ def addOrUpdateChroot(chroot, pocket=None, image_type=None): """Return the just added or modified PocketChroot. The pocket defaults to `PackagePublishingPocket.RELEASE`; the image type defaults to `BuildBaseImageType.CHROOT`. """ def searchBinaryPackages(text): """Search BinaryPackageRelease published in this series for those matching the given text.""" def __getitem__(name): """Getter""" def getBinaryPackage(name): """Return the DistroArchSeriesBinaryPackage with the given name in
class IDAVResource(IWriteLock): """Provide basic WebDAV support for non-collection objects.""" __dav_resource__ = Bool( title=u"Is DAV resource" ) __http_methods__ = Tuple( title=u"HTTP methods", description=u"Sequence of valid HTTP methods" ) def dav__init(request, response): """Init expected HTTP 1.1 / WebDAV headers which are not currently set by the base response object automagically. Also, we sniff for a ZServer response object, because we don't want to write duplicate headers (since ZS writes Date and Connection itself). """ def dav__validate(object, methodname, REQUEST): """ """ def dav__simpleifhandler(request, response, method='PUT', col=0, url=None, refresh=0): """ """ def HEAD(REQUEST, RESPONSE): """Retrieve resource information without a response body.""" def PUT(REQUEST, RESPONSE): """Replace the GET response entity of an existing resource. Because this is often object-dependent, objects which handle PUT should override the default PUT implementation with an object-specific implementation. By default, PUT requests fail with a 405 (Method Not Allowed).""" def OPTIONS(REQUEST, RESPONSE): """Retrieve communication options.""" def TRACE(REQUEST, RESPONSE): """Return the HTTP message received back to the client as the entity-body of a 200 (OK) response. This will often usually be intercepted by the web server in use. If not, the TRACE request will fail with a 405 (Method Not Allowed), since it is not often possible to reproduce the HTTP request verbatim from within the Zope environment.""" def DELETE(REQUEST, RESPONSE): """Delete a resource. For non-collection resources, DELETE may return either 200 or 204 (No Content) to indicate success.""" def PROPFIND(REQUEST, RESPONSE): """Retrieve properties defined on the resource.""" def PROPPATCH(REQUEST, RESPONSE): """Set and/or remove properties defined on the resource.""" def MKCOL(REQUEST, RESPONSE): """Create a new collection resource. If called on an existing resource, MKCOL must fail with 405 (Method Not Allowed).""" def COPY(REQUEST, RESPONSE): """Create a duplicate of the source resource whose state and behavior match that of the source resource as closely as possible. Though we may later try to make a copy appear seamless across namespaces (e.g. from Zope to Apache), COPY is currently only supported within the Zope namespace.""" def MOVE(REQUEST, RESPONSE): """Move a resource to a new location. Though we may later try to make a move appear seamless across namespaces (e.g. from Zope to Apache), MOVE is currently only supported within the Zope namespace.""" def LOCK(REQUEST, RESPONSE): """Lock a resource""" def UNLOCK(REQUEST, RESPONSE): """Remove an existing lock on a resource.""" def manage_DAVget(): """Gets the document source""" def listDAVObjects(): """
class IItem(Interface): """TODO item""" subject = Text(required=False) closed = Bool(default=False, required=False)
class IDistributionPublic( IBugTarget, ICanGetMilestonesDirectly, IHasAppointedDriver, IHasBuildRecords, IHasDrivers, IHasMilestones, IHasSharingPolicies, IHasOOPSReferences, IHasOwner, IHasSprints, IHasTranslationImports, ITranslationPolicy, IKarmaContext, ILaunchpadUsage, IMakesAnnouncements, IOfficialBugTagTargetPublic, IPillar, IServiceUsage, ISpecificationTarget, IHasExpirableBugs): """Public IDistribution properties.""" id = Attribute("The distro's unique number.") name = exported( DistributionNameField( title=_("Name"), constraint=name_validator, description=_("The distro's name."), required=True)) displayname = exported( TextLine( title=_("Display Name"), description=_("The displayable name of the distribution."), required=True), exported_as='display_name') title = exported( Title( title=_("Title"), description=_("The distro's title."), required=True)) summary = exported( Summary( title=_("Summary"), description=_( "A short paragraph to introduce the goals and highlights " "of the distribution."), required=True)) homepage_content = exported( Text( title=_("Homepage Content"), required=False, description=_( "The content of this distribution's home page. Edit this and " "it will be displayed for all the world to see. It is NOT a " "wiki so you cannot undo changes."))) icon = exported( IconImageUpload( title=_("Icon"), required=False, default_image_resource='/@@/distribution', description=_( "A small image of exactly 14x14 pixels and at most 5kb in " "size, that can be used to identify this distribution. The " "icon will be displayed everywhere we list the distribution " "and link to it."))) logo = exported( LogoImageUpload( title=_("Logo"), required=False, default_image_resource='/@@/distribution-logo', description=_( "An image of exactly 64x64 pixels that will be displayed in " "the heading of all pages related to this distribution. It " "should be no bigger than 50kb in size."))) mugshot = exported( MugshotImageUpload( title=_("Brand"), required=False, default_image_resource='/@@/distribution-mugshot', description=_( "A large image of exactly 192x192 pixels, that will be " "displayed on this distribution's home page in Launchpad. " "It should be no bigger than 100kb in size. "))) description = exported( Description( title=_("Description"), description=_( "Details about the distributions's work, highlights, goals, " "and how to contribute. Use plain text, paragraphs are " "preserved and URLs are linked in pages. Don't repeat the " "Summary."), required=True)) domainname = exported( TextLine( title=_("Web site URL"), description=_("The distro's web site URL."), required=True), exported_as='domain_name') owner = exported( PublicPersonChoice( title=_("Owner"), required=True, vocabulary='ValidPillarOwner', description=_("The restricted team, moderated team, or person " "who maintains the distribution information in " "Launchpad."))) registrant = exported( PublicPersonChoice( title=_("Registrant"), vocabulary='ValidPersonOrTeam', description=_("The distro's registrant."), required=True, readonly=True)) date_created = exported( Datetime(title=_('Date created'), description=_("The date this distribution was registered."))) driver = exported( PublicPersonChoice( title=_("Driver"), description=_( "The person or team responsible for decisions about features " "and bugs that will be targeted for any series in this " "distribution. Note that you can also specify a driver " "on each series whose permissions will be limited to that " "specific series."), required=False, vocabulary='ValidPersonOrTeam')) drivers = Attribute( "Presents the distro driver as a list for consistency with " "IProduct.drivers where the list might include a project driver.") members = exported(PublicPersonChoice( title=_("Members"), description=_("The distro's members team."), required=True, vocabulary='ValidPersonOrTeam')) mirror_admin = exported(PublicPersonChoice( title=_("Mirror Administrator"), description=_("The person or team that has the rights to review and " "mark this distribution's mirrors as official."), required=True, vocabulary='ValidPersonOrTeam')) archive_mirrors = exported(doNotSnapshot( CollectionField( description=_("All enabled and official ARCHIVE mirrors " "of this Distribution."), readonly=True, value_type=Object(schema=IDistributionMirror)))) archive_mirrors_by_country = doNotSnapshot(CollectionField( description=_("All enabled and official ARCHIVE mirrors " "of this Distribution."), readonly=True, value_type=Object(schema=IDistributionMirror))) cdimage_mirrors = exported(doNotSnapshot( CollectionField( description=_("All enabled and official RELEASE mirrors " "of this Distribution."), readonly=True, value_type=Object(schema=IDistributionMirror)))) cdimage_mirrors_by_country = doNotSnapshot(CollectionField( description=_("All enabled and official ARCHIVE mirrors " "of this Distribution."), readonly=True, value_type=Object(schema=IDistributionMirror))) disabled_mirrors = Attribute( "All disabled and official mirrors of this Distribution.") unofficial_mirrors = Attribute( "All unofficial mirrors of this Distribution.") pending_review_mirrors = Attribute( "All mirrors of this Distribution that haven't been reviewed yet.") series = exported(doNotSnapshot( CollectionField( title=_("DistroSeries inside this Distribution"), # Really IDistroSeries, see _schema_circular_imports.py. value_type=Reference(schema=Interface)))) derivatives = exported(doNotSnapshot( CollectionField( title=_("This Distribution's derivatives"), # Really IDistroSeries, see _schema_circular_imports.py. value_type=Reference(schema=Interface)))) architectures = List( title=_("DistroArchSeries inside this Distribution")) uploaders = Attribute(_( "ArchivePermission records for uploaders with rights to upload to " "this distribution.")) package_derivatives_email = TextLine( title=_("Package Derivatives Email Address"), description=_( "The email address to send information about updates to packages " "that are derived from another distribution. The sequence " "{package_name} is replaced with the actual package name."), required=False) # properties currentseries = exported( Reference( # Really IDistroSeries, see _schema_circular_imports.py. Interface, title=_("Current series"), description=_( "The current development series of this distribution. " "Note that all maintainerships refer to the current " "series. When people ask about the state of packages " "in the distribution, we should interpret that query " "in the context of the currentseries.")), exported_as="current_series") full_functionality = Attribute( "Whether or not we enable the full functionality of Launchpad for " "this distribution. Currently only Ubuntu and some derivatives " "get the full functionality of LP") translation_focus = Choice( title=_("Translation focus"), description=_( "The release series that translators should focus on."), required=False, vocabulary='FilteredDistroSeries') language_pack_admin = Choice( title=_("Language Pack Administrator"), description=_("The distribution language pack administrator."), required=False, vocabulary='ValidPersonOrTeam') main_archive = exported( Reference( title=_('Distribution Main Archive.'), readonly=True, # Really IArchive, see _schema_circular_imports.py. schema=Interface)) all_distro_archives = exported(doNotSnapshot( CollectionField( title=_( "A sequence of the distribution's primary, " "partner and debug archives."), readonly=True, required=False, value_type=Reference(schema=Interface))), # Really IArchive, see _schema_circular_imports.py. exported_as='archives') all_distro_archive_ids = Attribute( "A list containing the IDs of all the non-PPA archives.") has_published_binaries = Bool( title=_("Has Published Binaries"), description=_("True if this distribution has binaries published " "on disk."), readonly=True, required=False) has_published_sources = Bool( title=_("Has Published Sources"), description=_("True if this distribution has sources published."), readonly=True, required=False) redirect_release_uploads = exported(Bool( title=_("Redirect release pocket uploads"), description=_("Redirect release pocket uploads to proposed pocket"), readonly=False, required=True)) development_series_alias = exported(DistroSeriesNameField( title=_("Alias for development series"), description=_( "If set, an alias for the current development series in this " "distribution."), constraint=name_validator, readonly=False, required=False)) def getArchiveIDList(archive=None): """Return a list of archive IDs suitable for sqlvalues() or quote(). If the archive param is supplied, just its ID will be returned in a list of one item. If it is not supplied, return a list of all the IDs for all the archives for the distribution. """ def __getitem__(name): """Returns a DistroSeries that matches name, or raises and exception if none exists.""" def __iter__(): """Iterate over the series for this distribution.""" @operation_parameters( name=TextLine(title=_("Archive name"), required=True)) @operation_returns_entry(Interface) @export_read_operation() def getArchive(name): """Return the distribution archive with the given name. Only distribution archives are considered -- PPAs will not be found. :param name: The name of the archive, e.g. 'partner' """ # Really IDistroSeries, see _schema_circular_imports.py. @operation_returns_collection_of(Interface) @export_operation_as(name="getDevelopmentSeries") @export_read_operation() def getDevelopmentSeries(): """Return the DistroSeries which are marked as in development.""" def resolveSeriesAlias(name): """Resolve a series alias. :param name: The name to resolve. :raises NoSuchDistroSeries: If there is no match. """ @operation_parameters( name_or_version=TextLine(title=_("Name or version"), required=True)) # Really IDistroSeries, see _schema_circular_imports.py. @operation_returns_entry(Interface) @call_with(follow_aliases=True) @export_read_operation() def getSeries(name_or_version, follow_aliases=False): """Return the series with the name or version given. :param name_or_version: The `IDistroSeries.name` or `IDistroSeries.version`. """ # This API is specifically for Ensemble's Principia. It does not scale # well to distributions of Ubuntu's scale, and is not intended for it. # Therefore, this should probably never be exposed for a webservice # version other than "devel". @operation_parameters( since=Datetime( title=_("Time of last change"), description=_( "Return branches that have new tips since this timestamp."), required=False)) @call_with(user=REQUEST_USER) @export_operation_as(name="getBranchTips") @export_read_operation() @operation_for_version('devel') def getBranchTips(user=None, since=None): """Return a list of branches which have new tips since a date. Each branch information is a tuple of (branch_unique_name, tip_revision, (official_series*)). So for each branch in the distribution, you'll get the branch unique name, the revision id of tip, and if the branch is official for some series, the list of series name. :param: user: If specified, shows the branches visible to that user. if not specified, only branches visible to the anonymous user are shown. :param since: If specified, limits results to branches modified since that date and time. """ @operation_parameters( name=TextLine(title=_("Name"), required=True)) @operation_returns_entry(IDistributionMirror) @export_read_operation() def getMirrorByName(name): """Return the mirror with the given name for this distribution or None if it's not found. """ @operation_parameters( country=copy_field(IDistributionMirror['country'], required=True), mirror_type=copy_field(IDistributionMirror['content'], required=True)) @operation_returns_entry(IDistributionMirror) @export_read_operation() def getCountryMirror(country, mirror_type): """Return the country DNS mirror for a country and content type.""" def newMirror(owner, speed, country, content, displayname=None, description=None, http_base_url=None, ftp_base_url=None, rsync_base_url=None, enabled=False, official_candidate=False, whiteboard=None): """Create a new DistributionMirror for this distribution. At least one of http_base_url or ftp_base_url must be provided in order to create a mirror. """ @operation_parameters( name=TextLine(title=_("Package name"), required=True)) # Really returns IDistributionSourcePackage, see # _schema_circular_imports.py. @operation_returns_entry(Interface) @export_read_operation() def getSourcePackage(name): """Return a DistributionSourcePackage with the given name for this distribution, or None. """ def getSourcePackageRelease(sourcepackagerelease): """Returns an IDistributionSourcePackageRelease Receives a sourcepackagerelease. """ def getCurrentSourceReleases(source_package_names): """Get the current release of a list of source packages. :param source_package_names: a list of `ISourcePackageName` instances. :return: a dict where the key is a `IDistributionSourcePackage` and the value is a `IDistributionSourcePackageRelease`. """ def getDistroSeriesAndPocket(distroseriesname, follow_aliases=False): """Return a (distroseries,pocket) tuple which is the given textual distroseriesname in this distribution.""" def getSeriesByStatus(status): """Query context distribution for distroseries with a given status. :param status: Series status to look for :return: list of `IDistroSeries` """ @rename_parameters_as(text="source_match") @operation_parameters( text=TextLine(title=_("Source package name substring match"), required=True)) # Really returns IDistributionSourcePackage, see # _schema_circular_imports.py. @operation_returns_collection_of(Interface) @export_read_operation() def searchSourcePackages( text, has_packaging=None, publishing_distroseries=None): """Search for source packages that correspond to the given text. This method just decorates the result of searchSourcePackageCaches() to return DistributionSourcePackages. """ def searchSourcePackageCaches( text, has_packaging=None, publishing_distroseries=None): """Search for source packages that correspond to the given text. :param text: The text that will be matched. :param has_packaging: If True, it will filter out packages with no packaging (i.e. no link to the upstream project). False will do the reverse filtering, and None will do no filtering on this field. :param publishing_distroseries: If it is not None, then it will filter out source packages that do not have a publishing history for the given distroseries. :return: A result set containing (DistributionSourcePackageCache, SourcePackageName, rank) tuples ordered by rank. """ def searchBinaryPackages(package_name, exact_match=False): """Search for binary packages in this distribution. :param package_name: The binary package name to match. :param exact_match: If False, substring matches are done on the binary package names; if True only a full string match is returned. :return: A result set containing appropriate DistributionSourcePackage objects for the matching source. The returned results will consist of source packages that match (a substring of) their binary package names. """ def guessPublishedSourcePackageName(pkgname): """Return the "published" SourcePackageName related to pkgname. If pkgname corresponds to a source package that was published in any of the distribution series, that's the SourcePackageName that is returned. If there is any official source package branch linked, then that source package name is returned. Otherwise, try to find a published binary package name and then return the source package name from which it comes from. :raises NotFoundError: when pkgname doesn't correspond to either a published source or binary package name in this distribution. """ def getAllPPAs(): """Return all PPAs for this distribution.""" def searchPPAs(text=None, show_inactive=False): """Return all PPAs matching the given text in this distribution. 'text', when passed, will restrict results to Archives with matching description (using substring) or matching Archive.owner (using available person fti/ftq). 'show_inactive', when False, will restrict results to Archive with at least one source publication in PENDING or PUBLISHED status. """ def getPendingAcceptancePPAs(): """Return only pending acceptance PPAs in this distribution.""" def getPendingPublicationPPAs(): """Return all PPAs in this distribution that are pending publication. A PPA is said to be pending publication if it has publishing records in the pending state or if it had packages deleted from it. """ def getArchiveByComponent(component_name): """Return the archive most appropriate for the component name. Where different components may imply a different archive (e.g. partner), this method will return the archive for that component. If the component_name supplied is unknown, None is returned. """ def getAllowedBugInformationTypes(): """Get the information types that a bug in this distribution can have. :return: A sequence of `InformationType`s. """ def getDefaultBugInformationType(): """Get the default information type of a new bug in this distro. :return: The `InformationType`. """ def userCanEdit(user): """Can the user edit this distribution?"""
class IWebActionSchema(Interface): """Schema to describe WebActions. This is used by the storage as well as the REST API to validate dictionaries or PersistentMappings when adding webactions, or updating existing ones. """ title = TextLine( title=u'Title', description=u'Title of the webaction', required=True) unique_name = TextLine( title=u'Unique Name', description=u'Unique, client-controlled label', required=False) target_url = URI( title=u'Target URL', description=u'Target URL of the 3rd party application', required=True) enabled = Bool( title=u'Enabled', description=u'Whether this webaction is enabled or not', required=False, missing_value=True) icon_name = ASCIILine( title=u'Icon Name', description=u'Name of a "Font Awesome" icon for this webaction', required=False) icon_data = Base64DataURI( title=u'Icon Data URI', description=u'A complete data URI (Base64 encoded) with the icon for this webaction', required=False) display = Choice( title=u'Display Location', description=u'Where in the UI the webaction should be displayed.', values=[ 'action-buttons', 'actions-menu', 'add-menu', 'title-buttons', 'user-menu', ], required=True) mode = Choice( title=u'Mode', description=u'How the target_url will be opened', values=[ 'self', 'blank', # TODO: 'modal' ], required=True) order = Int( title=u'Order', description=u'Ordering hint [0-100] (0 means first, 100 means last)', min=0, max=100, required=True) scope = Choice( title=u'Scope', description=u'Where the webaction applies.', values=[ 'global', # TODO: 'context' (needs more discussion) # TODO: 'recursive' ], required=True) types = List( title=u'Types', description=u'On which portal_types the webaction should be available', # These should possibly be made dynamic at some point. # Maybe factor out some of the definitions from # opengever.base.schemadump.config into vocabularies? value_type=Choice(values=GEVER_TYPES), required=False, missing_value=list()) groups = List( title=u'Groups', description=u'List of groups this action is to be shown for. The ' u'action is only shown when the user is in at least one ' u'of these groups, as determined by querying the OGDS.', value_type=ASCIILine(), required=False) permissions = List( title=u'Permissions', description=u'List of permissions this action makes sense for. The ' u'action is only shown when the user has at least one ' u'of those permissions on the respective context.', value_type=Choice(values=ACTION_PERMISSIONS), required=False, missing_value=list()) comment = TextLine( title=u'Comment', description=u'Comment for this webaction', required=False) @invariant def icon_present_for_display_types_that_need_it(self): display = self.display has_icon = any(getattr(self, key, None) not in ('', None) for key in (ICON_PROPERTIES)) icon_required = ('title-buttons', 'add-menu') icon_forbidden = ('actions-menu', 'user-menu') icon_optional = ('action-buttons', ) # noqa if display in icon_forbidden: if has_icon: raise Invalid("Display location %r doesn't allow an icon." % display) elif display in icon_required: if not has_icon: raise Invalid('Display location %r requires an icon.' % display) @invariant def no_more_than_one_icon(self): icons = filter(None, (getattr(self, key, None) for key in (ICON_PROPERTIES))) if len(icons) > 1: raise Invalid( 'Icon properties %r are mutually exclusive. ' 'At most one icon allowed.' % ICON_PROPERTIES)
class IPackagesetSet(IPackagesetSetEdit): """An interface for multiple package sets.""" export_as_webservice_collection(IPackageset) @operation_parameters( name=TextLine(title=_('Package set name'), required=True), distroseries=Reference( IDistroSeries, title=_("Distroseries"), required=False, readonly=True, description=_("The distribution series to which the packageset " "is related."))) @operation_returns_entry(IPackageset) @export_read_operation() def getByName(name, distroseries=None): """Return the single package set with the given name (if any). :param name: the name of the package set sought. :param distroseries: the distroseries to which the new packageset is related. Defaults to the current Ubuntu series. :return: An `IPackageset` instance. :raise NoSuchPackageSet: if no package set is found. """ @collection_default_content() def get(): """Return all of the package sets in Launchpad. :return: A (potentially empty) sequence of `IPackageset` instances. """ def getByOwner(owner): """Return the package sets belonging to the given owner (if any). :param owner: the owner of the package sets sought. :return: A (potentially empty) sequence of `IPackageset` instances. """ @operation_parameters(distroseries=copy_field( IPackageset['distroseries'], description=_("The distribution series to which the packagesets " "are related."))) @operation_returns_collection_of(IPackageset) @export_read_operation() @operation_for_version("beta") def getBySeries(distroseries): """Return the package sets associated with the given distroseries. :param distroseries: A `DistroSeries`. :return: An iterable collection of `IPackageset` instances. """ def getForPackages(distroseries, sourcepackagename_ids): """Get `Packagesets` that directly contain the given packages. :param distroseries: `DistroSeries` to look in. Only packagesets for this series will be returned. :param sourcepackagename_ids: A sequence of `SourcePackageName` ids. Only packagesets for these package names will be returned. :return: A dict mapping `SourcePackageName` ids to lists of their respective packagesets, in no particular order. """ @operation_parameters(sourcepackagename=TextLine( title=_('Source package name'), required=True), distroseries=copy_field(IPackageset['distroseries'], required=False), direct_inclusion=Bool(required=False)) @operation_returns_collection_of(IPackageset) @export_read_operation() def setsIncludingSource(sourcepackagename, distroseries=None, direct_inclusion=False): """Get the package sets that include this source package. Return all package sets that directly or indirectly include the given source package name. :param sourcepackagename: the included source package name; can be either a string or a `ISourcePackageName`. :param distroseries: the `IDistroSeries` in which to look for sets. If omitted, matching package sets from all series will be returned. :param direct_inclusion: if this flag is set to True, then only package sets that directly include this source package name will be considered. :raises NoSuchSourcePackageName: if a source package with the given name cannot be found. :return: A (potentially empty) sequence of `IPackageset` instances. """ def __getitem__(name): """Retrieve a package set by name."""
class ISolrSchema(Interface): active = Bool( title=_('label_active', default=u'Active'), description=_( 'help_active', default=u'Check this to enable the Solr integration, i.e. ' u'indexing and searching using the below settings.'), default=False, ) host = TextLine( title=_('label_host', default=u'Host'), description=_( 'help_host', default=u'The host name of the Solr instance to be used.')) port = Int(title=_('label_port', default=u'Port'), description=_( 'help_port', default=u'The port of the Solr instance to be used.')) base = TextLine( title=_('label_base', default=u'Base'), description=_( 'help_base', default=u'The base prefix of the Solr instance to be used.')) async = Bool( title=_('label_async', default=u'Asynchronous indexing'), default=False, description=_( 'help_async', default=u'Check to enable asynchronous indexing operations, ' u'which will improve Zope response times in return for ' u'not having the Solr index updated immediately.')) auto_commit = Bool( title=_('label_auto_commit', default=u'Automatic commit'), default=True, description=_( 'help_auto_commit', default=u'If enabled each index operation will cause a commit ' u'to be sent to Solr, which causes it to update its ' u'index. If you disable this, you need to configure ' u'commit policies on the Solr server side.')) commit_within = Int( title=_('label_commit_within', default=u'Commit within'), default=0, description=_( 'help_commit_within', default=u'Maximum number of milliseconds after which adds ' u'should be processed by Solr. Defaults to 0, meaning ' u'immediate commits. Enabling this feature implicitly ' u'disables automatic commit and you should configure ' u'commit policies on the Solr server side. Otherwise ' u'large numbers of deletes without adds will not be ' u'processed. This feature requires a Solr 1.4 server.')) index_timeout = Float( title=_('label_index_timeout', default=u'Index timeout'), description=_( 'help_index_timeout', default=u'Number of seconds after which an index request will ' u'time out. Set to "0" to disable timeouts.')) search_timeout = Float( title=_('label_search_timeout', default=u'Search timeout'), description=_( 'help_search_timeout', default=u'Number of seconds after which a search request will ' u'time out. Set to "0" to disable timeouts.')) max_results = Int( title=_('label_max_results', default=u'Maximum search results'), description=_( 'help_max_results', default=u'Specify the maximum number of matches to be returned ' u'when searching. Set to "10000000" or some other ' u'ridiculously large value that is higher than the ' u'possible number of rows that are expected.'), default=1000000, ) required = List( title=_('label_required', default=u'Required query parameters'), description=_( 'help_required', default=u'Specify required query parameters, one per line. ' u'Searches will only get dispatched to Solr if any ' u'of the listed parameters is present in the query. ' u'Leave empty to dispatch all searches.'), value_type=TextLine(), default=[], missing_value=[], required=False) search_pattern = Text( title=_('label_search_pattern', default=u'Pattern for simple search queries'), description=_( 'help_search_pattern', default=u'Specify a query pattern used for simple queries ' u'consisting only of words and numbers, i.e. not ' u'using any of Solr\'s advanced query expressions. ' u'{value} and {base_value} are available in the ' u'pattern and will be replaced by the search word ' u'and the search word stripped of wildcard symbols.')) facets = List( title=_('label_facets', default=u'Default search facets'), description=_( 'help_facets', default=u'Specify catalog indexes that should be queried for ' u'facet information, one per line.'), value_type=TextLine(), default=[], required=False) filter_queries = List( title=_('label_filter_queries', default=u'Filter query parameters'), description=_( 'help_filter_queries', default=u'Specify query parameters for which filter queries ' u'should be used, one per line. You can use several ' u'indices in one filter query separated by space. ' u'Typical examples are ' u'"effective expires allowedRolesAndUsers" or ' u'"review_state portal_type".'), value_type=TextLine(), default=[], required=False) slow_query_threshold = Int( title=_('label_slow_query_threshold', default=u'Slow query threshold'), description=_( 'help_slow_query_threshold', default=u'Specify a threshold (in milliseconds) after which ' u'queries are considered to be slow causing them to ' u'be logged. Set to "0" to prevent any logging.'), default=0, ) effective_steps = Int( title=_('label_effective_steps', default=u'Effective date steps'), default=1, description=_('help_effective_steps', default=u'Specify the effective date steps in seconds. ' u'Using 900 seconds (15 minutes) means the effective ' u'date sent to Solr changes every 15 minutes.')) exclude_user = Bool( title=_('label_exclude_user', default=u'Exclude user from allowedRolesAndUsers'), description=_( 'help_exclude_user', default=u'Specify whether the user:userid should be excluded ' u'from allowedRolesAndUsers to improve cacheability ' u'on the expense of finding content with local roles' u'given to specific users.'), default=False) highlight_fields = List( title=_(u'Highlighting fields'), description=_(u'Fields that should be used for highlighting. ' u'Snippets of text will be generated from the contents ' u' of these fields, with the search keywords that' u'matched highlighted inside the text.'), value_type=TextLine(), default=[], required=False) highlight_formatter_pre = TextLine( title=_(u'Highlight formatter: pre'), description=_(u'The text to insert before the highlighted keyword.'), default=u'[', required=False) highlight_formatter_post = TextLine( title=_(u'Highlight formatter: post'), description=_(u'The text to insert after the highlighted keyword.'), default=u']', required=False) highlight_fragsize = Int( title=_(u'Highlight Fragment Size'), default=100, description=_(u'The size, in characters, of the snippets (aka ' U'fragments) created by the highlighter.')) field_list = List( title=_(u'Default fields to be returned'), description=_(u'Specify metadata fields that should be returned for ' u'items in the result set, one per line. Defaults to ' u'all available plus ranking score.'), value_type=TextLine(), default=[], required=False) levenshtein_distance = Float( title=_('label_levenshtein_distance', default=u'Levenshtein distance'), description=_( 'help_levenshtein_distance', default=u'The Levenshtein distance is a string metric for ' u'measuring the difference between two strings. It allows' u'you to perform fuzzy searches by specifying a value ' u'between 0 and 1.'), required=False, default=0.0, ) atomic_updates = Bool( title=_('label_atomic_updates', default=u'Enable atomic updates'), description=_( 'help_atomic_updates', default=u'Atomic updates allows you to update only specific ' u'indexes, like "reindexObject(idxs=["portal_type"])".' u'Unfortunately atomic updates are not compatible with ' u'index time boosting. If you enable atomic updates, ' u'index time boosting no longer works.'), default=True, required=False, )
class IPOFile(IRosettaStats): """A translation file.""" export_as_webservice_entry( singular_name="translation_file", plural_name="translation_files") id = exported(Int( title=_('The translation file id.'), required=True, readonly=True)) potemplate = Object( title=_('The translation file template.'), required=True, readonly=True, schema=IPOTemplate) language = Choice( title=_('Language of this PO file.'), vocabulary='Language', required=True) title = TextLine( title=_('The translation file title.'), required=True, readonly=True) description = Text( title=_('The translation file description.'), required=True) topcomment = Text( title=_('A comment about this translation file.'), required=True) header = Text( title=_('Header'), description=_( 'The standard translation header in its native format.'), required=False) fuzzyheader = Bool( title=_('A flag indicating whether the header is fuzzy.'), required=True) lasttranslator = Object( title=_('Last person that translated a message.'), schema=IPerson) date_changed = Datetime( title=_('When this file was last changed.'), readonly=False, required=True) lastparsed = Datetime(title=_('Last time this pofile was parsed.')) owner = Choice( title=_('Translation file owner'), required=True, description=_(''' The owner of the translation file in Launchpad can edit its translations and upload new versions. '''), vocabulary="ValidOwner") path = TextLine( title=_('The path to the file that was imported'), required=True) datecreated = Datetime( title=_('When this translation file was created.'), required=True) translators = List( title=_('Translators that have edit permissions.'), description=_(''' Translators designated as having permission to edit these files in this language. '''), required=True, readonly=True) contributors = List( title=_('Translators who have made any contribution to this file.'), required=True, readonly=True) translationpermission = Choice( title=_('Translation permission'), required=True, description=_(''' The permission system which is used for this translation file. This is inherited from the product, project and/or distro in which the pofile is found. '''), vocabulary=TranslationPermission) from_sourcepackagename = Field( title=_('The source package this pofile comes from.'), description=_(''' The source package this pofile comes from (set it only if it\'s different from IPOFile.potemplate.sourcepackagename). '''), required=False) translation_messages = Attribute(_( "All `ITranslationMessage` objects related to this " "translation file.")) plural_forms = Int( title=_('Number of plural forms for the language of this PO file.'), description=_(''' Number of plural forms is a number of translations provided for each plural form message. If `IPOFile.language` does not specify plural forms, it defaults to 2, which is the most common number of plural forms. '''), required=True, readonly=True) def getOtherSidePOFile(): """Get the POFile for the same language on the other side. Follow the packaging link to find in the sharing template on the other side and get the POFile from there. Returns None if no link exists. """ def translatedCount(): """ Returns the number of message sets which this PO file has current translations for. """ def untranslatedCount(): """ Return the number of messages which this PO file has no translation for. """ def hasPluralFormInformation(): """Do we know the plural-forms information for this `POFile`?""" def getHeader(): """Return an `ITranslationHeaderData` representing its header.""" def findPOTMsgSetsContaining(text): """Get POTMsgSets where English text or translation contain `text`.""" def getPOTMsgSetTranslated(): """Get pot messages that are translated for this translation file.""" def getPOTMsgSetUntranslated(): """Get pot message sets that are untranslated for this file.""" def getPOTMsgSetWithNewSuggestions(): """Get pot message sets with suggestions submitted after last review. """ def getPOTMsgSetDifferentTranslations(): """Get pot message sets with different translations on both sides. """ def getTranslationsFilteredBy(person): """Get TranslationMessages in this `IPOFile` contributed by `person`. Returned messages are ordered by the `POTMsgSet`, and then by `date_created` with newest first. """ def getTranslationMessages(condition=None): """Get TranslationMessages in this `IPOFile`. If condition is None, return all messages, else narrow the result set down using the condition. """ def export(ignore_obsolete=False, export_utf8=False): """Export this PO file as string. :param ignore_obsolete: Whether the exported PO file does not have obsolete entries. :param export_utf8: Whether the exported PO file should be exported as UTF-8. """ def prepareTranslationCredits(potmsgset): """Add Launchpad contributors to translation credit strings. It adds to the translation for `potmsgset` if it exists, trying not to repeat same people who are already credited. """ def canEditTranslations(person): """Whether the given person is able to add/edit translations.""" def canAddSuggestions(person): """Whether the given person is able to add new suggestions.""" def getStatistics(): """Summarize this file's cached translation statistics. :return: tuple of (`currentcount`, `updatescount`, `rosettacount`, `unreviewed_count`), as collected by `updateStatistics`. """ def updateStatistics(): """Update the cached statistics fields. :return: a tuple (`currentcount`, `updatescount`, `rosettacount`, `unreviewed_count`), as for `getStatistics`.""" def updateHeader(new_header): """Update the header information. new_header is a POHeader object. """ def isTranslationRevisionDateOlder(header): """Whether given header revision date is newer then self one.""" def setPathIfUnique(path): """Set path to given one, provided it's a valid, unique path. A `POFile`'s path must be unique within its context, i.e. for either the same `DistroSeries` and `SourcePackageName`, or for the same `ProductSeries`, depending on which the `POFile` is attached to. If the new path is not unique, the old path will be retained instead. """ def importFromQueue(entry_to_import, logger=None, txn=None): """Import given queue entry. :param entry_to_import: `TranslationImportQueueEntry` specifying an approved import for this `POFile` :param logger: optional logger to report problems to. :param txn: optionally, a transaction manager. It will not be used; it's here only for API symmetry with `IPOTemplate`. :return: a tuple of the subject line and body for a notification email to be sent to the uploader. """ def getFullLanguageCode(): """Return the language code.""" def getFullLanguageName(): """Return the language name.""" def getTranslationRows(): """Return exportable rows of translation data. :return: a list of `VPOExport` objects. """ def getChangedRows(): """Return exportable rows that differ from upstream translations. :return: a list of `VPOExport` objects. """ def markChanged(translator=None, timestamp=None): """Note a change to this `POFile` or its contents.
class IPOTemplateSubset(Interface): """A subset of POTemplate.""" sourcepackagename = Object( title=_('The `ISourcePackageName` associated with this subset.'), schema=ISourcePackageName) distroseries = Object( title=_('The `IDistroSeries` associated with this subset.'), # Really IDistroSeries, see _schema_circular_imports.py. schema=Interface) productseries = Object( title=_('The `IProductSeries` associated with this subset.'), # Really IProductSeries, see _schema_circular_imports.py. schema=Interface) iscurrent = Bool( title=_("Filter for iscurrent flag."), description=_( "The filter for the iscurrent flag that this subset should " "apply. The filter is disabled if it is None"), required=False) title = TextLine(title=_('The translation file title.'), required=True, readonly=True) def __iter__(): """Return an iterator over all POTemplate for this subset.""" def __len__(): """Return the number of `IPOTemplate` objects in this subset.""" def __getitem__(name): """Get a POTemplate by its name.""" def isNameUnique(name): """Is the IPOTemplate name unique to the series (and package). The subset may only include active `IPOTemplate` objects (iscurrent=True), but the full set that constrains creating new templates includes inactive templates too. Use this method to verify that an `IPOTemplate` can be created before calling new(). """ def new(name, translation_domain, path, owner, copy_pofiles=True): """Create a new template for the context of this Subset. The name must be unique to the full subset of active and inactive templates in a series (and package). See `isNameUnique`. """ def getPOTemplateByName(name): """Return the `IPOTemplate` with the given name or None. The `IPOTemplate` is restricted to this concrete `IPOTemplateSubset`. """ def getPOTemplatesByTranslationDomain(translation_domain): """Return the `IPOTemplate`s with the given translation_domain. The search is restricted to this concrete `IPOTemplateSubset`. :return: An ORM result set containing the templates in the given `IPOTemplateSubset` with the given translation_domain. """ def getPOTemplateByPath(path): """Return the `IPOTemplate` from this subset that has the given path. Return None if there is no such `IPOTemplate`. """ def getAllOrderByDateLastUpdated(): """Return an iterator over all POTemplate for this subset. The iterator will give entries sorted by modification. """ def getClosestPOTemplate(path): """Return a `IPOTemplate` with a path closer to given path, or None. If there is no `IPOTemplate` with a common path with the given, argument or if there are more than one `IPOTemplate` with the same common path, and both are the closer ones, returns None. """ def findUniquePathlessMatch(filename): """Find the one `POTemplate` with given filename, if there is one.
class IPOTemplate(IRosettaStats): """A translation template.""" export_as_webservice_entry(singular_name='translation_template', plural_name='translation_templates') id = exported( Int(title=u"The translation template id.", required=True, readonly=True)) name = exported( TextLine(title=_("Template name"), description=_( "The name of this PO template, for example " "'evolution-2.2'. Each translation template has a " "unique name in its package. It's important to get this " "correct, because Launchpad will recommend alternative " "translations based on the name."), constraint=valid_name, required=True)) translation_domain = exported( TextLine( title=_("Translation domain"), description=_( "The translation domain for a translation template. " "Used with PO file format when generating MO files for inclusion " "in language pack or MO tarball exports."), required=True)) description = exported( Text( title=_("Description"), description=_( "Please provide a brief description of the content " "of this translation template, for example, telling translators " "if this template contains strings for end-users or other " "developers."), required=False)) header = Text( title=_('Header'), description=_("The standard template header in its native format."), required=True) iscurrent = exported(Bool( title=_("Template is active"), description=_( "If unchecked, people can no longer change the template's " "translations."), required=True, default=True), exported_as='active') owner = exported( PersonChoice( title=_("Owner"), required=True, description=_( "The owner of the template in Launchpad can edit the template " "and change it's status, and can also upload new versions " "of the template when a new release is made or when the " "translation strings have been changed during development."), vocabulary="ValidOwner")) productseries = Choice(title=_("Series"), required=False, vocabulary="ProductSeries") distroseries = Choice(title=_("Series"), required=False, vocabulary="DistroSeries") sourcepackagename = Choice( title=_("Source Package Name"), description=_("The source package that uses this template."), required=False, vocabulary="SourcePackageName") sourcepackagenameID = Int( title=_("Source Package Name ID"), description=_("The ID of the source package that uses this template."), required=False, readonly=True) sourcepackage = Reference( ISourcePackage, title=u"Source package this template is for, if any.", required=False, readonly=True) from_sourcepackagename = Choice( title=_("From Source Package Name"), description=_( "The source package this template comes from (set it only if it's" " different from the previous 'Source Package Name'."), required=False, vocabulary="SourcePackageName") sourcepackageversion = TextLine(title=_("Source Package Version"), required=False) languagepack = exported(Bool( title=_("Include translations for this template in language packs?"), description=_( "Check this box if this template is part of a language pack so " "its translations should be exported that way."), required=True, default=False), exported_as='exported_in_languagepacks') path = exported( TextLine(title=_( "Path of the template in the source tree, including filename."), required=True)) source_file = Object(title=_('Source file for this translation template'), readonly=True, schema=ILibraryFileAlias) source_file_format = exported(Choice( title=_("File format for the source file"), required=False, vocabulary=TranslationFileFormat), exported_as='format') priority = exported( Int(title=_('Priority'), required=True, default=0, description=_( 'A number that describes how important this template is. Often ' 'there are multiple templates, and you can use this as a way ' 'of indicating which are more important and should be ' 'translated first. Pick any number - higher priority ' 'templates will generally be listed first.'))) datecreated = Datetime( title=_('When this translation template was created.'), required=True, readonly=True) translationgroups = Attribute( _(''' The `ITranslationGroup` objects that handle translations for this template. There can be several because they can be inherited from project to product, for example. ''')) translationpermission = Choice(title=_('Translation permission'), required=True, readonly=True, description=_(''' The permission system which is used for this translation template. This is inherited from the product, project and/or distro in which the translation template is found. '''), vocabulary='TranslationPermission') pofiles = exported( CollectionField( title=_("All translation files that exist for this template."), # Really IPOFile, see _schema_circular_imports.py. value_type=Reference(schema=Interface)), exported_as='translation_files') relatives_by_source = Attribute( _('''All `IPOTemplate` objects that have the same source. For example those that came from the same productseries or the same source package. ''')) displayname = TextLine(title=_('The translation template brief name.'), required=True, readonly=True) title = TextLine(title=_('The translation template title.'), required=True, readonly=True) product = Object( title=_('The `IProduct` to which this translation template belongs.'), required=False, readonly=True, # Really IProduct, see _schema_circular_imports.py. schema=Interface) distribution = Object(title=_( 'The `IDistribution` to which this translation template ' 'belongs.'), readonly=True, schema=IDistribution) messagecount = exported(Int( title=_('The number of translation messages for this template.'), required=True, readonly=True), exported_as='message_count') language_count = exported( Int(title=_('The number of languages for which we have translations.'), required=True, readonly=True)) translationtarget = Attribute( _(''' The direct object in which this template is attached. This will either be an `ISourcePackage` or an `IProductSeries`. ''')) date_last_updated = exported( Datetime(title=_('Date for last update'), required=True)) uses_english_msgids = Bool(title=_("Uses English strings as msgids"), readonly=True, description=_(""" Some formats, such as Mozilla's XPI, use symbolic msgids where gettext uses the original English strings to identify messages. """)) translation_side = Int(title=_("Translation side"), required=True, readonly=True) def __iter__(): """Return an iterator over current `IPOTMsgSet` in this template.""" def clearPOFileCache(): """Clear `POFile`-related cached data. As you work with a `POTemplate`, some data about its `POFile`s gets cached. But if you're iterating over the template's translations one `POFile` at a time, you can drop any cached data about a `POFile` as soon as you're done with it. Use this method to do that. """ def setActive(active): """Toggle the iscurrent flag. Takes care of updating the suggestive potempalte cache when the template is disabled. """ def getHeader(): """Return an `ITranslationHeaderData` representing its header.""" def getPOTMsgSetByMsgIDText(singular_text, plural_text=None, only_current=False, context=None): """Return `IPOTMsgSet` indexed by `singular_text` from this template. If the key is a string or a unicode object, returns the `IPOTMsgSet` in this template that has a primary message ID with the given text. If `only_current` is True, then get only current message sets. If `context` is not None, look for a message set with that context value. If `plural_text` is not None, also filter by that plural text. If no `IPOTMsgSet` is found, return None. """ def getPOTMsgSetBySequence(sequence): """Return the `IPOTMsgSet` with the given sequence or None. :arg sequence: The sequence number when the `IPOTMsgSet` appears. The sequence number must be > 0. """ def getPOTMsgSets(current=True, prefetch=True): """Return an iterator over `IPOTMsgSet` objects in this template. :param current: Whether to limit the search to current POTMsgSets. :param prefetch: Whether to prefetch the `POMsgID`s attached to the POTMsgSets. This is for optimization only. :return: All current POTMsgSets for the template if `current` is True, or all POTMsgSets for the template otherwise. """ def getTranslationCredits(): """Return an iterator over translation credits. Return all `IPOTMsgSet` objects in this template that are translation credits. """ def getPOTMsgSetsCount(current=True): """Return the number of POTMsgSet objects related to this object. The current argument is used to select only current POTMsgSets or all of them. """ def __getitem__(key): """Same as getPOTMsgSetByMsgIDText(), with only_current=True """ def sharingKey(): """A key for determining the sharing precedence of a template. Active templates have precedence over inactive ones. Development foci have precendence over non-development foci. Product development foci have precedence over Package development foci. """ def getPOTMsgSetByID(id): """Return the POTMsgSet object related to this POTemplate with the id. If there is no POTMsgSet with that id and for that POTemplate, return None. """ def languages(): """This Return the set of languages for which we have POFiles for this POTemplate. """ def getPOFileByPath(path): """Get the PO file of the given path. Return None if there is no such `IPOFile`. """ def getPOFileByLang(language_code): """Get the PO file of the given language. Return None if there is no such POFile. """ def getOtherSidePOTemplate(): """Get the POTemplate with the same name on the other side of a packaging link. """ def hasPluralMessage(): """Test whether this template has any message sets which are plural message sets.""" def export(): """Return a serialized version as a string using its native format.""" def exportWithTranslations(): """Return an ExportedTranslationFile using its native format. It include all translations available. """ def expireAllMessages(): """Mark all of our message sets as not current (sequence=0)""" def newPOFile(language_code, create_sharing=True): """Return a new `IPOFile` for the given language. Raise LanguageNotFound if the language does not exist in the database. We should not have already an `IPOFile` for the given language_code. :param language_code: The code of the language for which to create the IPOFile. :param requester: The requester person. If given and will have edit permissions on the IPOFile, it becomes the owner. Otherwise rosetta_experts own the file. :param create_sharing: Whether the IPOFile should be created in all sharing templates, too. Should only be set to False to avoid loops when creating a new IPOTemplate. """ def getDummyPOFile(language, requester=None, check_for_existing=True): """Return a DummyPOFile if there isn't already a persistent `IPOFile` Raise `LanguageNotFound` if the language does not exist in the database. This method is designed to be used by read only actions. This way you only create a POFile when you actually need to store data. We should not have already a POFile for the given language: if check_for_existing is set to False, no check will be done for this. """ def createPOTMsgSetFromMsgIDs(msgid_singular, msgid_plural=None, context=None, sequence=0): """Creates a new template message in the database. :param msgid_singular: A reference to a singular msgid. :param msgid_plural: A reference to a plural msgid. Can be None if the message is not a plural message. :param context: A context for the template message differentiating it from other template messages with exactly the same `msgid`. :param sequence: The sequence number of this POTMsgSet within this POTemplate. If 0, it is considered obsolete. :return: The newly created message set. """ def createMessageSetFromText(singular_text, plural_text, context=None, sequence=0): """Creates a new template message in the database using strings. Similar to createMessageSetFromMessageID, but takes text objects (unicode or string) along with textual context, rather than a message IDs. :param singular_text: The string for the singular msgid. :param msgid_plural: The string for the plural msgid. Must be None if the message is not a plural message. :param context: A context for the template message differentiating it from other template messages with exactly the same `msgid`. :param sequence: The sequence number of this POTMsgSet within this POTemplate. If 0, it is considered obsolete. :return: The newly created message set. """ def getOrCreateSharedPOTMsgSet(singular_text, plural_text, context=None, initial_file_references=None, initial_source_comment=None): """Finds an existing shared POTMsgSet to use or creates a new one. :param singular_text: string containing singular form. :param plural_text: string containing plural form. :param context: context to differentiate between two messages with same singular_text and plural_text. :param initial_file_references: Initializer for file_references if a new POTMsgSet needs to be created. Will not be set on an existing POTMsgSet. :param initial_source_comment: Initializer for source_comment if a new POTMsgSet needs to be created. Will not be set on an existing POTMsgSet. :return: existing or new shared POTMsgSet with a sequence of 0 in this POTemplate. """ def importFromQueue(entry_to_import, logger=None, txn=None): """Import given queue entry. :param entry_to_import: `TranslationImportQueueEntry` specifying an approved import for this `POTemplate` :param logger: optional logger to report problems to. :param txn: optional transaction manager for intermediate commits. Used to prevent long-running transactions that can lead to deadlocks. :return: a tuple of the subject line and body for a notification email to be sent to the uploader. """ def getTranslationRows(): """Return the `IVPOTexport` objects for this template.""" def awardKarma(person, action_name): """Award karma for a translation action on this template.""" def getTranslationPolicy(): """Return the applicable `ITranslationPolicy` object.
class ICORSPolicyDirective(Interface): """Directive for defining CORS policies""" for_ = GlobalObject( title=u"The interface this CORS policy is for.", description=u"""Specifies the interface for which the CORS policy is registered. If this attribute is not specified, the CORS policy applies to all objects.""", required=False, ) layer = GlobalInterface( title=u"The browser layer for which this CORS policy is registered.", description=u"""Useful for overriding existing policies or for making them available only if a specific add-on has been installed.""", required=False, default=IDefaultBrowserLayer, ) allow_origin = TextLine( title=u"Origins", description=u"""Origins that are allowed access to the resource. Either a comma separated list of origins, e.g. "http://example.net, http://mydomain.com" or "*".""", ) allow_methods = TextLine( title=u"Methods", description=u"""A comma separated list of HTTP method names that are allowed by this CORS policy, e.g. "DELETE,GET,OPTIONS,PATCH,POST,PUT". """, required=False, ) allow_headers = TextLine( title=u"Headers", description=u"""A comma separated list of request headers allowed to be sent by the client, e.g. "X-My-Header".""", required=False, ) expose_headers = TextLine( title=u"Exposed Headers", description=u"""A comma separated list of response headers clients can access, e.g. "Content-Length,X-My-Header".""", required=False, ) allow_credentials = Bool( title=u"Support Credentials", description=u"""Indicates whether the resource supports user credentials in the request.""", default=False, ) max_age = TextLine( title=u"Max Age", description=u"""Indicates how long the results of a preflight request can be cached.""", required=False, )
class ICKEditorBaseSchema(Interface): """ CKEditor Base fieldset schema """ forcePasteAsPlainText = Bool( title=_(u"Force paste as plain text"), description=_(u"Choose if you want to remove format on copy/paste, " "and paste only text and CR/LF"), default=False, required=False) toolbar = Choice( title=_(u"Toolbar"), description=_(u"Choose the editor toolbar, " "edit the next field if you choose a Custom toolbar'."), required=True, default='Plone', vocabulary="collective.ckeditor.vocabularies.toolbar") toolbar_Custom = Text( title=_(u"Customized Toolbar"), description=_(u"Build your own CKEditor Toolbar. " "Take care with the javascript syntax. " "If you want to add new plugins, " "add new buttons here if needed."), required=False) filtering = Choice( title=_(u"Filtering"), description=_( u"Setup of Advanced Content Filter. " u"Read documentation at " u"http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter" ), required=True, default='default', vocabulary="collective.ckeditor.vocabularies.filtering") customAllowedContent = Text( title=_(u"Custom Allowed Content"), description=_( u"Configuration of custom filtering. " u"Taken in account only if Filtering option is 'Custom'. " u"Use Javascript syntax. Read documentation at " u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules" ), required=False) extraAllowedContent = Text( title=_(u"Extra Allowed Content"), description=_( u"Extra rules on top of automatic filtering. " u"Taken in account only if Filtering option is 'Automatic'. " u"Use Javascript syntax. Read documentation at " u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules" ), required=False) menuStyles = Text( title=_(u"Menu styles"), description=_(u"Build your own CKEditor menu styles Combo box. " u"Take care with the javascript syntax. " u"If you want to use css classes or ids, " u"the attributes must exist in your css."), required=True) bodyId = TextLine( title=_(u"Area Body Id"), description=_(u"Enter the css id applied to the " "body tag of the editor area"), default=u'content', required=False) plugins = List( title=_(u"Plugins"), description=_(u"Plugin format is 'id;relative path'."), value_type=TextLine(), required=False) removePlugins = List( title=_(u"Plugins to remove"), description=_(u"Plugin format is 'id'."), value_type=TextLine(), required=False) bodyClass = TextLine( title=_(u"Area Body Class"), description=_(u"Enter the css class name applied to the " "body tag of the editor area"), required=False) customTemplates = List( title=_(u"Custom templates"), description=_(u"URLs of Javascript " "files that register custom templates"), value_type=TextLine(), required=False) templatesReplaceContent = Bool( title=_(u"Templates will replace the current contents " "of the visual editor window"), description=_(u"Choose if you want templates to replace " "the contents when inserted"), default=False, required=False) enableScaytOnStartup = Bool( title=_(u"Enable SCAYT on startup"), description=_(u"Choose if you want SCAYT to be automatically " "enabled while the editor is loaded. This will only " "be the case if a relevant language can be used " "in SCAYT availble ones."), default=False, required=False) defaultTableWidth = TextLine( title=_(u"Default Table Width"), description=_(u"Enter the default table width"), default=u"500px", required=False)
class IPackagesetViewOnly(IHasOwner): """A read-only interface for package sets.""" export_as_webservice_entry(publish_web_link=False) id = exported(Int(title=_('ID'), required=True, readonly=True)) date_created = exported( Datetime(title=_("Date Created"), required=True, readonly=True, description=_( "The creation date/time for the package set at hand."))) owner = exported( Reference(IPerson, title=_("Person"), required=True, description=_("The person who owns this package set."))) name = exported( TextLine(title=_('Valid package set name'), required=True, constraint=name_validator)) description = exported( TextLine( title=_("Description"), required=True, description=_("The description for the package set at hand."))) distroseries = exported( Reference( IDistroSeries, title=_("Distribution series"), required=True, readonly=True, description=_( "The distroseries to which this package set is related."))) packagesetgroup = Reference( IPackagesetGroup, title=_('Package set group'), required=True, readonly=True, description=_( 'Used internally to link package sets across distro series.')) def sourcesIncluded(direct_inclusion=False): """Get all source names associated with this package set. This method returns the source package names that are directly or indirectly associated with the package set at hand. Indirect associations may be defined through package set successors. :param direct_inclusion: if this flag is set to True only sources directly included by this package set will be considered. :return: A (potentially empty) sequence of `ISourcePackageName` instances. """ @operation_parameters(direct_inclusion=Bool(required=False)) @operation_returns_collection_of(Interface) @export_read_operation() def setsIncludedBy(direct_inclusion=False): """Get all package sets that include this one. Return all package sets that directly or indirectly include this one. :param direct_inclusion: if this flag is set to True only sets directly including this one will be considered. :return: A (potentially empty) sequence of `IPackageset` instances. """ @operation_parameters(direct_inclusion=Bool(required=False)) @operation_returns_collection_of(Interface) @export_read_operation() def setsIncluded(direct_inclusion=False): """Get all package sets that are included by this one. Return all package sets that are directly or indirectly included by this one. :param direct_inclusion: if this flag is set to True only sets directly included by this one will be considered. :return: A (potentially empty) sequence of `IPackageset` instances. """ def sourcesSharedBy(other_package_set, direct_inclusion=False): """Get source package names also included by another package set. What source package names does this package set have in common with the `other_package_set`? :param other_package_set: the other package set :param direct_inclusion: if this flag is set to True only directly included sources will be considered. :return: A (potentially empty) sequence of `ISourcePackageName` instances. """ def sourcesNotSharedBy(other_package_set, direct_inclusion=False): """Get source package names not included by another package set. Which source package names included by this package are *not* included by the `other_package_set`? :param other_package_set: the other package set :param direct_inclusion: if this flag is set to True only directly included sources will be considered. :return: A (potentially empty) sequence of `ISourcePackageName` instances. """ @operation_parameters(direct_inclusion=Bool(required=False)) @export_read_operation() def getSourcesIncluded(direct_inclusion=False): """Get all source names associated with this package set. This method returns the source package names that are directly or indirectly associated with the package set at hand. Indirect associations may be defined through package set successors. Please note: this method was mainly introduced in order to facilitate the listing of source package names via the LP web services API. It returns string names as opposed to `ISourcePackageName` instances. :param direct_inclusion: if this flag is set to True only sources directly included by this package set will be considered. :return: A (potentially empty) sequence of string source package names. """ @operation_parameters(other_package_set=Reference( Interface, title=_('The package set we are comparing to.'), required=True), direct_inclusion=Bool(required=False)) @export_read_operation() def getSourcesSharedBy(other_package_set, direct_inclusion=False): """Get source package names also included by another package set. What source package names does this package set have in common with the `other_package_set`? Please note: this method was mainly introduced in order to facilitate the listing of source package names via the LP web services API. It returns string names as opposed to `ISourcePackageName` instances. :param other_package_set: the other package set :param direct_inclusion: if this flag is set to True only directly included sources will be considered. :return: A (potentially empty) sequence of string source package names. """ @operation_parameters(other_package_set=Reference( Interface, title=_('The package set we are comparing to.'), required=True), direct_inclusion=Bool(required=False)) @export_read_operation() def getSourcesNotSharedBy(other_package_set, direct_inclusion=False): """Get source package names not included by another package set. Which source package names included by this package are *not* included by the `other_package_set`? Please note: this method was mainly introduced in order to facilitate the listing of source package names via the LP web services API. It returns string names as opposed to `ISourcePackageName` instances. :param other_package_set: the other package set :param direct_inclusion: if this flag is set to True only directly included sources will be considered. :return: A (potentially empty) sequence of string source package names. """ @operation_returns_collection_of(Interface) @export_read_operation() def relatedSets(): """Get all other package sets in this set's `PackagesetGroup`.
class IPackageCopyRequest(Interface): """A Build interface""" id = Int(title=_('ID'), required=True, readonly=True) target_archive = Object( title=_("Target archive"), schema=IArchive, required=True, readonly=True, description=_("The archive to which packages will be copied.")) target_distroseries = Object(title=_("Target distroseries"), schema=IDistroSeries, required=False, readonly=True, description=_("The target DistroSeries.")) target_component = Object(title=_("Target component"), schema=IComponent, required=False, readonly=True, description=_("The target component.")) target_pocket = Choice(title=_('Target pocket'), required=False, vocabulary=PackagePublishingPocket, description=_("The target pocket.")) copy_binaries = Bool( title=_('Copy binaries'), required=True, default=False, description=_("Whether binary packages should be copied as well.")) source_archive = Object( title=_("Source archive"), schema=IArchive, required=True, readonly=True, description=_("The archive from which packages will be copied.")) source_distroseries = Object(title=_("Source distroseries"), schema=IDistroSeries, required=False, readonly=True, description=_("The source DistroSeries.")) source_component = Object(title=_("Source component"), schema=IComponent, required=False, readonly=True, description=_("The source component.")) source_pocket = Choice(title=_('Source pocket'), required=False, vocabulary=PackagePublishingPocket, description=_("The source pocket.")) requester = Object( title=_("Requester"), schema=IPerson, required=True, readonly=True, description=_("The person who requested the package copy operation.")) status = Choice(title=_('Copy status'), required=True, vocabulary=PackageCopyStatus, description=_("The current status of the copy operation.")) reason = Text(title=_('Reason'), required=False, description=_("The reason for this package copy operation.")) date_created = Datetime( title=_('Date created'), required=True, readonly=True, description=_("The time when the package copy request was created.")) date_started = Datetime( title=_('Date started'), required=False, readonly=False, description=_("The time when the copy request processing started.")) date_completed = Datetime( title=_('Date completed'), required=False, readonly=False, description=_("The time when the copy request processing completed.")) def __str__(): """Return a textual representation of the package copy request.""" def markAsInprogress(): """Mark this request as being in progress. Update the 'status' and 'date_started' properties as appropriate. """ def markAsCompleted(): """Mark this request as completed. Update the 'status' and 'date_completed' properties as appropriate. """ def markAsFailed(): """Mark this request as failed. Update the 'status' and 'date_completed' properties as appropriate. """ def markAsCanceling(): """Mark this request as canceling. Update the 'status' as appropriate. """ def markAsCancelled(): """Mark this request as cancelled.
class ILibraryFileAlias(Interface): id = Int( title=_('Library File Alias ID'), required=True, readonly=True, ) date_created = Datetime(title=_('Date created'), required=True, readonly=True) content = Attribute('Library file content') filename = TextLine(title=_('Filename'), required=True, readonly=True) mimetype = TextLine(title=_('MIME type'), required=True, readonly=True) expires = Datetime(title=_('Expiry time'), required=False, readonly=True, description=_(''' When file can be removed. Set to None if the file should only be removed when it is no longer referenced in the database. Set it to NEVER_EXPIRES to keep it in the Librarian permanently. ''')) hits = Int(title=_('Number of times this file has been downloaded'), required=False, readonly=True) last_downloaded = Datetime(title=_('When this file was last downloaded'), required=False, readonly=True) restricted = Bool(title=_('Is this file alias restricted.'), required=True, readonly=True, description=_( 'If the file is restricted, it can only be ' 'retrieved through the restricted librarian.')) deleted = Attribute('Is this file deleted.') # XXX Guilherme Salgado, 2007-01-18 bug=80487: # We can't use TextLine here because they return # byte strings. http_url = Attribute(_("The http URL to this file")) https_url = Attribute(_("The https URL to this file")) private_url = Attribute(_("The secure URL to this file (private files)")) def getURL(secure=True, include_token=False): """Return this file's http or https URL. If the file is a restricted file, the private_url will be returned, which is on https and uses unique domains per file alias. :param secure: generate HTTPS URLs if the use_https config variable is set, in order to prevent warnings about insecure objects from happening in some browsers (this is used for, e.g., branding). :param include_token: create a time-limited token and include it in the URL to authorise access to restricted files. """ def open(timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT): """Open this file for reading. :param timeout: The number of seconds the method retries to open a connection to the Librarian server. If the connection cannot be established in the given time, a LibrarianServerError is raised. :return: None """ def read(chunksize=None, timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT): """Read up to `chunksize` bytes from the file. :param chunksize: The maximum number of bytes to be read. Defaults to the entire file. :param timeout: The number of seconds the method retries to open a connection to the Librarian server. If the connection cannot be established in the given time, a LibrarianServerError is raised. :return: the data read from the Librarian file. """ def close(): """Close this file.""" def updateDownloadCount(day, country, count): """Update this file's download count for the given country and day.
class IPortalConfig(Interface): """Schema for portal configuration form. """ email_from_name = TextLine( title=_(u"Portal 'From' name"), description=_(u"When the portal generates mail, it uses this name as " u"its (apparent) sender."), required=False, missing_value=u'') email_from_address = TextLine( title=_(u"Portal 'From' address"), description=_(u"When the portal generates mail, it uses this address " u"as its (apparent) return address."), required=False, missing_value=u'') smtp_server = TextLine( title=_(u"SMTP server"), description=_(u"This is the address of your local SMTP (out-going " u"mail) server."), required=False, missing_value=u'') title = TextLine( title=_(u"Portal title"), description=_(u"This is the title which appears at the top of every " u"portal page."), required=False, missing_value=u'') description = TextLine( title=_(u"Portal description"), description=_(u"This description is made available via syndicated " u"content and elsewhere. It should be fairly brief."), required=False, missing_value=u'') validate_email = Choice( title=_(u"Password policy"), vocabulary=SimpleVocabulary.fromTitleItems(available_policies), default=False) default_charset = ASCIILine( title=_(u"Portal default encoding"), description=_(u"Charset used to decode portal content strings. If " u"empty, 'utf-8' is used."), required=False, constraint=check_encoding, default="utf-8") email_charset = ASCIILine( title=_(u"Portal email encoding"), description=_(u"Charset used to encode emails send by the portal. If " u"empty, 'utf-8' is used if necessary."), required=False, constraint=check_encoding, default="utf-8") enable_actionicons = Bool( title=_(u"Action icons"), description=_(u"Actions available to the user are shown as textual " u"links. With this option enabled, they are also shown " u"as icons if the action definition specifies one."), required=False) enable_permalink = Bool( title=_(u"Permalinks"), description=_(u"If permalinks are enabled then a unique identifier is " u"assigned to every item of content independent of it's " u"id or position in a site. This requires the CMFUid " u"tool to be installed."), required=False)
class IMailingList(Interface): """A mailing list.""" team = PublicPersonChoice( title=_('Team'), description=_('The team that this mailing list is associated with.'), vocabulary='ValidTeam', required=True, readonly=True) registrant = PublicPersonChoice( title=_('Registrant'), description=_('The person who registered the mailing list.'), vocabulary='ValidPersonOrTeam', required=True, readonly=True) date_registered = Datetime( title=_('Registration date'), description=_('The date on which this mailing list was registered.'), required=True, readonly=True) # Mailing lists are auto-approved now so these fields are no longer used, # but we won't drop the columns from the database because they might be # useful for the historical record. reviewer = PublicPersonChoice( title=_('Reviewer'), description=_( 'The person who reviewed this mailing list registration, or ' 'None if the registration has not yet been reviewed.'), vocabulary='ValidPersonOrTeam') date_reviewed = Datetime( title=_('Review date'), description=_('The date on which this mailing list registration was ' 'reviewed, or None if the registration has not yet ' 'been reviewed.')) date_activated = Datetime( title=_('Activation date'), description=_('The date on which this mailing list was activated, ' 'meaning that the Mailman process has successfully ' 'created it. This may be None if the mailing list ' 'has not yet been activated, or that its activation ' 'has failed.')) status = Choice( title=_('Status'), description=_('The status of the mailing list.'), vocabulary='MailingListStatus', required=True, ) welcome_message = Text( title=_('Welcome message text'), description=_('Any instructions or links that should be sent to new ' 'subscribers to this mailing list.'), required=False, ) address = TextLine( title=_("This list's email address."), description=_( "The text representation of this team's email address."), required=True, readonly=True) archive_url = TextLine( title=_("The url to the list's archives"), description=_( 'This is the url to the archive if the mailing list has ever ' 'activated. Such a list, even if now inactive, may still have ' 'an archive. If the list has never been activated, this will ' 'be None.'), readonly=True) is_public = Bool( title=_('Is this mailing list, and its team, public?'), readonly=True) is_usable = Bool( title=_('Is this mailing list in a state to accept messages?'), description=_( "This doesn't necessarily mean that the list is in perfect " 'shape; its status might be `MailingListStatus.MOD_FAILED`. But ' 'it should be able to handle messages.'), readonly=True) def startConstructing(): """Set the status to the `MailingListStatus.CONSTRUCTING` state. This state change happens when Mailman pulls the list approved mailing lists and begins constructing them. :raises AssertionError: When prior to constructing, the status of the mailing list is not `MailingListStatus.APPROVED`. """ def startUpdating(): """Set the status to the `MailingListStatus.UPDATING` state. This state change happens when Mailman pulls the list of modified mailing lists and begins updating them. :raises AssertionError: When prior to updating, the status if the mailing list is not `MailingListStatus.MODIFIED`. """ def transitionToStatus(target_state): """Transition the list's state after a remote action has taken place. This sets the status of the mailing list to reflect the results of action by Mailman. It handles various state changes, updating other attributes such as the activate date as necessary. :param target_state: The new state. :raises AssertionError: When an invalid state transition is made. """ def deactivate(): """Deactivate the mailing list. This sets the status to `MailingListStatus.INACTIVE`. :raises AssertionError: When prior to deactivation, the status of the mailing list is not `MailingListStatus.ACTIVE`. """ def reactivate(): """Reactivate the mailing list. This sets the status to `MailingListStatus.APPROVED`. :raises AssertionError: When prior to reactivation, the status of the mailing list is not `MailingListStatus.INACTIVE`. """ def getSubscription(person): """Get a person's subscription details for the mailing list. :param person: The person whose subscription details to get. :return: If the person is subscribed to this mailing list, an IMailingListSubscription. Otherwise, None. """ def subscribe(person, address=None): """Subscribe a person to the mailing list. :param person: The person to subscribe to the mailing list. The person must be a member (either direct or indirect) of the team linked to this mailing list. :param address: The `IEmailAddress` to use for the subscription. The address must be owned by `person`. If None (the default), then the person's preferred email address is used. If the person's preferred address changes, their subscription address will change as well. :raises CannotSubscribe: Raised when the person is not allowed to subscribe to the mailing list with the given address. For example, this is raised when the person is not a member of the team linked to this mailing list, when `person` is a team, or when `person` does not own the given email address. """ def unsubscribe(person): """Unsubscribe the person from the mailing list. :param person: A member of the mailing list. :raises CannotUnsubscribe: Raised when the person is not a member of the mailing list. """ def changeAddress(person, address): """Change the address a person is subscribed with. :param person: The mailing list subscriber. :param address: The new IEmailAddress to use for the subscription. The address must be owned by `person`. If None, the person's preferred email address is used. If the person's preferred address changes, their subscription address will change as well. :raises CannotChangeSubscription: Raised when the person is not a allowed to change their subscription address. For example, this is raised when the person is not a member of the team linked to this mailing list, when `person` is a team, or when `person` does not own the given email address. """ def getSubscribers(): """Return the set of subscribers. :return: a result set of the subscribers sorted by full name. These are the people who will receive messages posted to the mailing list. """ def holdMessage(message): """Hold a message for approval on this mailing list. :param message: The IMessage to hold. :return: The IMessageApproval representing the held message. """ def getReviewableMessages(message_id_filter=None): """Return the set of all held messages for this list requiring review. :param message_id_filter: If supplied only messages with message ids in the filter are returned. :return: A sequence of `IMessageApproval`s for this mailing list, where the status is `PostedMessageStatus.NEW`. The returned set is ordered first by the date the message was posted, then by Message-ID. """ def purge(): """Place the mailing list into the PURGED state, if safe to do so.
class ITingIndexSchema(zope.catalog.interfaces.IAttributeIndex): default_fields = BytesLine( title=_(u"Default fields"), description=_( "Look in these fields by default (consider dedicated_storage=True)" ), required=True, default='') storage = Choice( title=_(u"Storage"), description=_(u"Component for storing wordID-to-documentID-mappings"), required=True, default=config.DEFAULT_STORAGE, vocabulary="TextIndexNG3 Storages") dedicated_storage = Bool( title=_(u"Dedicated storage"), description=_( u"Use seperate index for each field (allows per field search)"), required=True, default=config.defaults['dedicated_storage']) languages = BytesLine( title=_(u"Languages"), description=_( u"Languages supported by this index (space seperated list)"), default=config.DEFAULT_LANGUAGE, constraint=re.compile('[a-z]+(\s+[a-z]+)*').match) use_stemmer = Bool( title=_(u"Stemming"), description= _(u"Compare words according to their word stems (a kind of similarity search)" ), default=False, required=config.defaults['use_stemmer']) use_stopwords = Bool( title=_(u"Stopwords"), description= _(u"Enable to prvent looking for words like 'and' or 'a' which are unlike to be useful in search queries" ), required=True, default=config.defaults['use_stopwords']) use_normalizer = Bool( title=_(u"Normalize"), description= _(u"Enable to normalize words language specific (e.g. À -> ae , Ú -> e)" ), required=True, default=config.defaults['use_normalizer']) ranking = Bool( title=_(u"Ranking"), description= _(u"Enable ranking according to word frequency of documents (selects different storage)" ), required=True, default=config.defaults['ranking']) autoexpand_limit = Int( title=_(u"Autoexpand limit"), description=_(u"Lower limit for automatic right-*-wildcard-search"), required=True, default=config.defaults['autoexpand_limit']) splitter = Choice( title=_(u"Splitter"), description=_(u"Splitter to be used to turn text into words"), required=True, default=config.DEFAULT_SPLITTER, vocabulary="TextIndexNG3 Splitters") lexicon = Choice( title=_(u"Lexicon"), description=_(u"Component to be used for storing word-to-id-mappings"), required=True, default=config.DEFAULT_LEXICON, vocabulary="TextIndexNG3 Lexicons") index_unknown_languages = Bool( title=_(u"Index unknown languages"), description= _(u"Assigns unknown languages the first language of the languages selected for this index" ), required=True, default=config.defaults['index_unknown_languages'], ) splitter_additional_chars = BytesLine( title=_(u"Non-seperators"), description=_( u"Characters that should *not* be threaded as separators"), required=True, default=config.defaults['splitter_additional_chars']) splitter_casefolding = Bool( title=_(u"Case-insensitive"), description=_(u"Make this index case insensitive"), required=True, default=config.defaults['splitter_casefolding']) query_parser = Choice(title=_(u"Query Parser"), description=_(u"Parser to be used for this index"), required=True, default=config.DEFAULT_PARSER, vocabulary="TextIndexNG3 Query Parsers")
class IAceProject(form.Schema, IImageScaleTraversable): """ Defines content-type schema for Ace Project """ title = TextLine( title=_(u"Title"), description=_(u"Project title or name"), required=True, ) acronym = TextLine( title=_(u"Acronym"), description=_(u"Acronym of the project"), required=True, ) lead = TextLine( title=_(u"Lead"), description=_(u"Lead organisation of the project"), required=False, ) website = TextLine( title=_(u"Website"), description=_(u"Project website"), required=False, ) dexteritytextindexer.searchable('abstracts') abstracts = RichText( title=_(u"Abstracts"), description=_(u"Project abstracts"), required=False, ) dexteritytextindexer.searchable('partners') partners = RichText( title=_(u"Partners"), description=_(u"Information about project partners"), required=False, ) dexteritytextindexer.searchable('keywords') keywords = RichText( title=_(u"Keywords"), description=_(u"Keywords related to the project"), required=False, ) sectors = List( title=_(u"Sectors"), description=_(u"EU policy sectors"), required=False, value_type=Choice(vocabulary="eea.climateadapt.aceitems_sectors", ), ) elements = List( title=_(u"Elements"), description=_(u"Adaptation element"), required=False, value_type=Choice(vocabulary="eea.climateadapt.aceitems_elements", ), ) climate_impacts = List( title=_(u"Climate impacts"), description=_(u"Climate impacts"), required=False, value_type=Choice( vocabulary="eea.climateadapt.aceitems_climateimpacts", ), ) funding = TextLine( title=_(u"Funding"), description=_(u"Source of funding"), required=False, ) duration = TextLine( title=_(u"Duration"), description=_(u"Duration of project"), required=False, ) dexteritytextindexer.searchable('source') source = RichText( title=_(u"Source"), description=_(u"Source from which project was retrieved"), required=False) specialtagging = TextLine( title=_(u"Special Tagging"), description=_(u"Special tags that allow for linking the item"), required=False) geochars = Text(title=_(u"Geochars"), description=_(u"Characterisation of the area"), required=False) comments = TextLine(title=_(u"Source"), description=_(u"Any comments provided with the item"), required=False) important = Bool(title=_(u"Important"), required=False, default=False) rating = Int(title=_(u"Rating"), required=True, default=0) spatial_layer = TextLine(title=_(u"Spatial Layer"), required=False, default=u"") spatial_values = List( title=_(u"Countries"), description=_(u"European countries"), required=False, value_type=Choice(vocabulary="eea.climateadapt.ace_countries"))
class IAceMeasure(form.Schema, IImageScaleTraversable): """ Defines content-type schema for Ace Measure """ # company - this is always liferay in the data # group - same value for all # title - Provided by behaviour. Imported value comes from name column title = TextLine(title=_(u"Title"), required=True) # description - Provided by behaviour. Imported value comes from # description column dexteritytextindexer.searchable('long_description') long_description = RichText(title=_(u"description"), required=True) implementation_type = Choice( title=_(u"Implementation Type"), required=False, default=None, vocabulary="eea.climateadapt.acemeasure_implementationtype" ) dexteritytextindexer.searchable('implementation_time') implementation_time = RichText( title=_(u"Implementation Time"), required=False, default=None, ) dexteritytextindexer.searchable('challenges') challenges = RichText( title=_(u"Challenges"), required=False, default=None, ) dexteritytextindexer.searchable('lifetime') lifetime = RichText(title=_(u"Lifetime"), required=False, default=u"") spatial_layer = TextLine( title=_(u"Spatial Layer"), required=False, default=u"") spatial_values = List(title=_(u"Countries"), description=_(u"European countries"), required=False, value_type=Choice( vocabulary="eea.climateadapt.ace_countries")) dexteritytextindexer.searchable('legal_aspects') legal_aspects = RichText(title=_(u"Legal aspects"), required=False, default=u"") dexteritytextindexer.searchable('stakeholder_participation') stakeholder_participation = RichText( title=_(u"Stakeholder participation"), required=False, default=u"") dexteritytextindexer.searchable('contact') contact = RichText(title=_(u"Contact"), required=False, default=u"") dexteritytextindexer.searchable('success_limitations') success_limitations = RichText( title=_(u"Success / limitations"), required=False, default=u"") dexteritytextindexer.searchable('cost_benefit') cost_benefit = RichText( title=_(u"Cost / Benefit"), required=False, default=u"") websites = List(title=_(u"Websites"), description=_(u"A list of relevant website links"), required=False, value_type=URI(title=_("A link")), ) # keywords = List(title=_(u"Keywords"), # description=_(u"Keywords related to the project"), # required=False, # value_type=TextLine(title=_(u"Tag")) # ) keywords = RichText(title=_(u"Keywords"), description=_(u"Keywords related to the project"), required=False, ) # TODO: startdate, enddate, publicationdate have no values in DB # TODO: specialtagging is not used in any view jsp, only in add and edit # views sectors = List(title=_(u"Sectors"), description=_(u"TODO: Sectors description here"), required=False, value_type=Choice( vocabulary="eea.climateadapt.aceitems_sectors",), ) elements = List(title=_(u"Elements"), description=_(u"TODO: Elements description here"), required=False, value_type=Choice( vocabulary="eea.climateadapt.aceitems_elements",), ) climate_impacts = List( title=_(u"Climate impacts"), description=_(u"TODO: Climate impacts description here"), required=False, value_type=Choice( vocabulary="eea.climateadapt.aceitems_climateimpacts",), ) dexteritytextindexer.searchable('source') source = RichText(title=_(u"Source"), required=True,) # TODO: special tagging implement as related geochars = Text(title=_(u"Geographic characterization"), required=False, default=u"") measure_type = Choice(title=_(u"Measure Type"), required=True, default="A", vocabulary="eea.climateadapt.acemeasure_types") comments = TextLine(title=_(u"Comments"), required=False, default=u"") important = Bool(title=_(u"High importance"), required=False, default=False) rating = Int(title=_(u"Rating"), required=True, default=0) dexteritytextindexer.searchable('objectives') objectives = RichText(title=_(u"Objectives"), required=False, default=u"") dexteritytextindexer.searchable('solutions') solutions = RichText(title=_(u"Solutions"), required=False, default=u"") adaptationoptions = List( title=_(u"Adaptation Options"), required=False, value_type=Int(), # TODO: leave it like that, until we figure it out ) # TODO: reimplement as list relevance = List( title=_(u"Relevance"), required=False, value_type=Choice( vocabulary="eea.climateadapt.aceitems_relevance",), ) primephoto = RelationChoice( title=_(u"Prime photo"), source=ObjPathSourceBinder(object_provides=IImage.__identifier__), required=False, ) supphotos = RelationList( title=u"Gallery", default=[], value_type=RelationChoice( title=_(u"Related"), source=ObjPathSourceBinder( object_provides=IImage.__identifier__) ), required=False, )
class IPhysicalLink(Interface): """A PhysicalConnector object.""" length = PhysicalQuantity( max_length = 10, title = _(u"Length"), description = _(u"The length of the physical link."), required = False) maxLength = PhysicalQuantity( max_length = 10, title = _(u"Maximum length"), description = _(u"The maximum length of the physical link."), required = False) mediaType = Choice( title=_(u"Media type"), description=_(u"The MediaType property defines the particular type " u"of Media through which transmission signals pass."), default=6, required = True, vocabulary = "PhysicalLinkMediaTypes") wired = Bool( title = _(u"Physical link is cable"), description = _(u"Boolean indicating whether the PhysicalLink is an " u"actual cable (TRUE) or a " u"wireless connection (FALSE)."), default = True, required = False) connectorPinout = TextLine( max_length = 80, title = _(u"Connector pinout"), required = False) # room = Choice( # title=_(u'Room'), # vocabulary='AllRooms', # required=False # ) # local = Choice( # title=_(u'Connected from'), # vocabulary='AllPhysicalConnectors', # required=False # ) connectors = List( title=_(u'Connected to'), value_type=Choice(vocabulary='AllUnusedOrUsedPhysikalLinkPhysicalConnectors'), default=[], required = False) @invariant def ensureLengthUnit(link): if link.length is not None: physicalInput = convertQuantity(link.length) if not physicalInput.isLength(): raise Invalid( "No length specification: '%s'." % \ (link.length)) @invariant def ensureMaxLength4LinkType(link): if link.length is not None: physicalInput = convertQuantity(link.length) physicalMaxLength = maxLength4LinkType(link.mediaType) if physicalInput > physicalMaxLength: raise Invalid( "Length over: '%s'." % \ (physicalMaxLength))
def makeField(self): return self.setUpField(Bool(title=unicode(self.title)))
class ISignedSessionCookieConfig(Interface): """Schema for <sessioncookie> directive. """ secret = TextLine( title=u"Secret", description=u"Secret used to sign the cookie value", required=True, ) salt = TextLine( title=u"Salt", description=u"Salt used to sign the cookie value", required=False, ) cookie_name = TextLine( title=u"Cookie Name", description=u"Name of the session cookie", required=False, ) max_age = Int( title=u"Max Age", description=u"Max age (in seconds) of the session cookie", required=False, ) path = TextLine( title=u"Cookie Path", description=u"Path of the session cookie", required=False, ) domain = TextLine( title=u"Cookie Domain", description=u"Domain of the session cookie", required=False, ) secure = Bool( title=u"Secure", description=u"Return the session cookie only over HTTPS?", required=False, ) http_only = Bool( title=u"HTTP Only", description=u"Mark the session cookie invisible to Javascript?", required=False, ) hash_algorithm = TextLine( title=u"Hash Algorithm", description=u"Name of algorithm used to sign cookie state", default=u"sha512", required=False, ) timeout = Int( title=u"Timeout", description=u"Timeout (in seconds) for the session cookie value", required=False, ) reissue_time = Int( title=u"Reissue Time", description=u"Time (in seconds) for updating cookie value on access", required=False, ) encrypt = Bool( title=u"Encrypt Cookie", description=u"Encrypt cookie text (requires ``pyCrypto``)?", required=False, )
class IBuildFarmJob(Interface): """Operations that jobs for the build farm must implement.""" export_as_webservice_entry(as_of='beta') id = Attribute('The build farm job ID.') build_farm_job = Attribute('Generic build farm job record') processor = Reference( IProcessor, title=_("Processor"), required=False, readonly=True, description=_( "The Processor required by this build farm job. " "This should be None for processor-independent job types.")) virtualized = Bool( title=_('Virtualized'), required=False, readonly=True, description=_( "The virtualization setting required by this build farm job. " "This should be None for job types that do not care whether " "they run virtualized.")) date_created = exported( Datetime(title=_("Date created"), required=True, readonly=True, description=_( "The timestamp when the build farm job was created.")), ("1.0", dict(exported_as="datecreated")), as_of="beta", ) date_started = exported(Datetime( title=_("Date started"), required=False, readonly=True, description=_("The timestamp when the build farm job was started.")), as_of="devel") date_finished = exported( Datetime(title=_("Date finished"), required=False, readonly=True, description=_( "The timestamp when the build farm job was finished.")), ("1.0", dict(exported_as="datebuilt")), as_of="beta", ) duration = exported(Timedelta(title=_("Duration"), required=False, readonly=True, description=_( "Duration interval, calculated when the " "result gets collected.")), as_of="devel") date_first_dispatched = exported( Datetime(title=_("Date finished"), required=False, readonly=True, description=_( "The actual build start time. Set when the build " "is dispatched the first time and not changed in " "subsequent build attempts."))) builder = exported( Reference(title=_("Builder"), schema=IBuilder, required=False, readonly=True, description=_("The builder assigned to this job."))) buildqueue_record = Reference( # Really IBuildQueue, set in _schema_circular_imports to avoid # circular import. schema=Interface, required=True, title=_("Corresponding BuildQueue record")) status = exported( Choice(title=_('Status'), required=True, vocabulary=BuildStatus, description=_("The current status of the job.")), ("1.0", dict(exported_as="buildstate")), as_of="beta", ) log = Reference( schema=ILibraryFileAlias, required=False, title=_( "The LibraryFileAlias containing the entire log for this job.")) log_url = exported( TextLine(title=_("Build Log URL"), required=False, description=_("A URL for the build log. None if there is no " "log available.")), ("1.0", dict(exported_as="build_log_url")), as_of="beta", ) is_private = Bool( title=_("is private"), required=False, readonly=True, description=_("Whether the build should be treated as private.")) job_type = Choice(title=_("Job type"), required=True, readonly=True, vocabulary=BuildFarmJobType, description=_("The specific type of job.")) build_cookie = Attribute( "A string which uniquely identifies the job in the build farm.") failure_count = Int( title=_("Failure Count"), required=False, readonly=True, default=0, description=_("Number of consecutive failures for this job.")) def setLog(log): """Set the `LibraryFileAlias` that contains the job log.""" def updateStatus(status, builder=None, slave_status=None, date_started=None, date_finished=None, force_invalid_transition=False): """Update job metadata when the build status changes. This automatically handles setting status, date_finished, builder, dependencies. Later it will manage the denormalised search schema. date_started and date_finished override the default (now). Only sensible transitions are permitted unless force_invalid_transition is set. The override only exists for tests and as an escape hatch for buildd-manager's failure counting. You do not want to use it. """ def gotFailure(): """Increment the failure_count for this job.""" def calculateScore(): """Calculate the build queue priority for this job.""" def estimateDuration(): """Estimate the build duration.""" def queueBuild(suspended=False): """Create a BuildQueue entry for this build. :param suspended: Whether the associated `Job` instance should be created in a suspended state. """ title = exported(TextLine(title=_("Title"), required=False), as_of="beta") was_built = Attribute("Whether or not modified by the builddfarm.") # This doesn't belong here. It really belongs in IPackageBuild, but # the TAL assumes it can read this directly. dependencies = exported(TextLine( title=_('Dependencies'), required=False, description=_( 'Debian-like dependency line that must be satisfied before ' 'attempting to build this request.')), as_of="beta") # Only really used by IBinaryPackageBuild, but # get_sources_list_for_building looks up this attribute for all build # types. external_dependencies = Attribute( "Newline-separated list of repositories to be used to retrieve any " "external build-dependencies when performing this build.")
class ICKEditorBrowserSchema(Interface): """ CKEditor Browser fieldset schema """ allow_link_byuid = Bool( title=_(u"Allow link objects by UID"), description=_(u"Check if you want url with Unique ID " "(no more 404 errors when moving objects). " "Notice that portal_transforms in standard " "configuration transforms uid links in absolute urls " "in view displays."), default=True, required=False) allow_relative_links = Bool( title=_(u"Allow relative urls transformation"), description=_(u"Check if you want relative urls after saving forms. " "Useful when link by uid is not checked."), default=False, required=False) allow_server_browsing = Bool( title=_(u"Allow browsing for links"), description=_(u"Check to allow server browsing" "used for medias linking."), default=True, required=False) allow_file_upload = Bool( title=_(u"Allow file upload"), description=_(u"Check to allow files upload in link dialog boxes)."), default=False, required=False) allow_image_upload = Bool( title=_(u"Allow image upload"), description=_(u"Check to allow upload for images."), default=False, required=False) allow_flash_upload = Bool( title=_(u"Allow flash upload"), description=_(u"Check to allow upload for flash content."), default=False, required=False) allow_folder_creation = Bool( title=_(u"Allow folder creation"), description=_(u"Check to allow folder creation in browser."), default=False, required=False) file_portal_type = Choice( title=_(u"File portal type"), description=_(u"Choose the portal type used for file upload."), required=True, default='File', vocabulary="collective.ckeditor.vocabularies.FileTypeUpload") file_portal_type_custom = List( title=_(u"Custom File portal type for upload"), description=_(u"Add list of pairs CONTAINER_TYPE|FILE_TYPE. " "The file portal type choosen for upload will depend " "on contextual container portal type. " "* means any portal type." "Take care, no control is done over this field value."), required=False, value_type=TextLine(), default=['*|File', 'Folder|File', ]) browse_images_portal_types = Tuple( title=_(u"Portal Types for images linking"), description=_(u"Choose the types used " "for images selection in browser."), required=True, missing_value=tuple(), default=('Image', 'News Item',), value_type=Choice( vocabulary="collective.ckeditor.vocabularies.ImageTypes")) image_portal_type = Choice( title=_(u"Image portal type"), description=_(u"Choose the portal type used for image upload."), required=True, default='auto', vocabulary="collective.ckeditor.vocabularies.ImageTypeUpload") image_portal_type_custom = List( title=_(u"Custom Image portal type for upload"), description=_(u"Add list of pairs CONTAINER_TYPE|IMAGE_TYPE. " "The image portal type choosen for upload will depend " "on contextual container portal type. " "* means any portal type." "Take care, no control is done over this field value."), required=False, value_type=TextLine(), default=['*|Image', 'Folder|Image', ]) browse_flashs_portal_types = Tuple( title=_(u"Portal Types for flash contents linking"), description=_(u"Choose the types used " "for flash contents selection in browser."), required=True, missing_value=tuple(), default=('File',), value_type=Choice( vocabulary="collective.ckeditor.vocabularies.FileTypes")) flash_portal_type = Choice( title=_(u"Flash portal type"), description=_(u"Choose the portal type used for flash content upload"), required=True, default='File', vocabulary="collective.ckeditor.vocabularies.FileTypeUpload") flash_portal_type_custom = List( title=_(u"Custom Flash portal type for upload"), description=_(u"Add list of pairs CONTAINER_TYPE|FLASH_TYPE. " "The flash portal type choosen for upload will depend " "on contextual container portal type. " "* means any portal type. " "Take care, no control is done over this field value."), required=False, value_type=TextLine(), default=['*|File', 'Folder|File', ]) folder_portal_type = Choice( title=_(u"Folder portal type"), description=_(u"Choose the portal type used for folder creation"), required=True, default='Folder', vocabulary="collective.ckeditor.vocabularies.FolderTypes") folder_portal_type_custom = List( title=_(u"Custom portal type for folder creation"), description=_(u"Add list of pairs CONTAINER_TYPE|FOLDER_TYPE. " "The folder portal type choosen for folders creation " "will depend on contextual container portal type. " "* means any portal type. " "Take care, no control is done over this field value."), required=False, value_type=TextLine(), default=['*|Folder', 'Large Plone Folder|Large Plone Folder', ])
class IViewDirective(Interface): context = GlobalObject(title=u('The interface or class this view is for.'), required=False) for_ = GlobalObject(title=u( 'The interface or class this view is for (alternate spelling ' 'of ``context``).'), required=False) permission = TextLine( title=u('Permission'), description=u('The permission needed to use the view.'), required=False) view = GlobalObject( title=_BLANK, description=u('The view function'), required=False, ) name = TextLine( title=u('The name of the view'), description=u( 'Shows up in URLs/paths. For example "foo" or "foo.html".'), required=False, ) attr = TextLine(title=u( 'The callable attribute of the view object(default is __call__)'), description=_BLANK, required=False) renderer = TextLine(title=u('The renderer asssociated with the view'), description=_BLANK, required=False) wrapper = TextLine(title=u( 'The *name* of the view that acts as a wrapper for this view.'), description=_BLANK, required=False) request_type = GlobalObject( title=u('The dotted name interface for the request type'), description=u( 'The view will be called if the interface represented by ' '"request_type" is implemented by the request. The ' 'default request type is pyramid.interfaces.IRequest'), required=False) route_name = TextLine( title=u('The route that must match for this view to be used'), required=False) containment = GlobalObject( title=u('Dotted name of a containment class or interface'), required=False) request_method = TextLine( title=u('Request method name that must be matched (e.g. GET/POST)'), description=u('The view will be called if and only if the request ' 'method (``request.method``) matches this string.'), required=False) request_param = TextLine( title=u('Request parameter name that must exist in ' '``request.params`` for this view to match'), description=u('The view will be called if and only if the request ' 'parameter exists which matches this string.'), required=False) xhr = Bool( title=u('True if request has an X-Requested-With header with the ' 'value "XMLHttpRequest"'), description=u('Useful for detecting AJAX requests issued from ' 'jQuery, Protoype and other JavaScript libraries'), required=False) accept = TextLine( title=u('Mimetype(s) that must be present in "Accept" HTTP header ' 'for the view to match a request'), description=u('Accepts a mimetype match token in the form ' '"text/plain", a wildcard mimetype match token in the ' 'form "text/*" or a match-all wildcard mimetype match ' 'token in the form "*/*".'), required=False) header = TextLine( title=u('Header name/value pair in the form "name=<regex>"'), description=u('Regular expression matching for header values'), required=False) path_info = TextLine(title=u( 'Regular expression which must match the ``PATH_INFO`` ' 'header for the view to match a request'), description=u('Accepts a regular expression.'), required=False) decorator = GlobalObject(title=u('View decorator'), required=False) mapper = GlobalObject(title=u('View mapper'), required=False) custom_predicates = Tokens( title=u( "One or more custom dotted names to custom predicate callables"), description=u( 'A list of dotted name references to callables that ' 'will be used as predicates for this view configuration'), required=False, value_type=GlobalObject())
class IBugTracker(Interface): """A remote bug system. Launchpadlib example: What bug tracker is used for a distro source package? :: product = source_package.upstream_product if product: tracker = product.bug_tracker if not tracker: project = product.project_group if project: tracker = project.bug_tracker if tracker: print "%s at %s" %(tracker.bug_tracker_type, tracker.base_url) """ export_as_webservice_entry() id = Int(title=_('ID')) bugtrackertype = exported(Choice(title=_('Bug Tracker Type'), vocabulary=BugTrackerType, default=BugTrackerType.BUGZILLA), exported_as='bug_tracker_type') name = exported( BugTrackerNameField(title=_('Name'), constraint=name_validator, description=_( 'A URL-friendly name for the bug tracker, ' 'such as "mozilla-bugs".'))) title = exported( TextLine(title=_('Title'), description=_('A descriptive label for this tracker to show ' 'in listings.'))) summary = exported( Text(title=_('Summary'), description=_('A brief introduction or overview of this bug ' 'tracker instance.'), required=False)) baseurl = exported(BugTrackerURL( title=_('Location'), allowed_schemes=LOCATION_SCHEMES_ALLOWED, description=_( 'The top-level URL for the bug tracker, or an upstream email ' 'address. This must be accurate so that Launchpad can link ' 'to external bug reports.')), exported_as='base_url') aliases = exported(List( title=_('Location aliases'), description=_('A list of URLs or email addresses that all lead to the ' 'same bug tracker, or commonly seen typos, separated by ' 'whitespace.'), value_type=BugTrackerURL(allowed_schemes=LOCATION_SCHEMES_ALLOWED), required=False), exported_as='base_url_aliases') owner = exported(Reference(title=_('Owner'), schema=Interface), exported_as='registrant') contactdetails = exported(Text( title=_('Contact details'), description=_( 'The contact details for the external bug tracker (so that, ' 'for example, its administrators can be contacted about a ' 'security breach).'), required=False), exported_as='contact_details') watches = doNotSnapshot( exported( CollectionField(title=_('The remote watches on this bug tracker.'), value_type=Reference(schema=IObject)))) has_lp_plugin = exported( Bool(title=_('This bug tracker has a Launchpad plugin installed.'), required=False, default=False)) products = Attribute('The products that use this bug tracker.') latestwatches = Attribute('The last 10 watches created.') imported_bug_messages = Attribute( 'Bug messages that have been imported from this bug tracker.') multi_product = Attribute( "This bug tracker tracks multiple remote products.") active = exported( Bool(title=_('Updates for this bug tracker are enabled'), required=True, default=True)) watches_ready_to_check = Attribute( "The set of bug watches that are scheduled to be checked.") watches_with_unpushed_comments = Attribute( "The set of bug watches that have unpushed comments.") watches_needing_update = Attribute( "The set of bug watches that need updating.") def getBugFilingAndSearchLinks(remote_product, summary=None, description=None, remote_component=None): """Return the bug filing and search links for the tracker. :param remote_product: The name of the product on which the bug is to be filed or searched for. :param summary: The string with which to pre-filly the summary field of the upstream bug tracker's search and bug filing forms. :param description: The string with which to pre-filly the description field of the upstream bug tracker's bug filing form. :param remote_component: The name of the component on which the bug is to be filed or search for. :return: A dict of the absolute URL of the bug filing form and the search form for `remote_product` on the remote tracker, in the form {'bug_filing_url': foo, 'search_url': bar}. If either or both of the URLs is unavailable for the current BugTrackerType the relevant values in the dict will be set to None. If the bug tracker requires a `remote_product` but None is passed, None will be returned for both values in the dict. """ def getBugsWatching(remotebug): """Get the bugs watching the given remote bug in this bug tracker.""" def getLinkedPersonByName(name): """Return the `IBugTrackerPerson` for a given name on a bugtracker. :param name: The name of the person on the bugtracker in `bugtracker`. :return: an `IBugTrackerPerson`. """ def linkPersonToSelf(name, person): """Link a Person to the BugTracker using a given name. :param name: The name used for person on bugtracker. :param person: The `IPerson` to link to bugtracker. :raise BugTrackerPersonAlreadyExists: If `name` has already been used to link a person to `bugtracker`. :return: An `IBugTrackerPerson`. """ def ensurePersonForSelf(display_name, email, rationale, creation_comment): """Return the correct `IPerson` for a given name on a bugtracker. :param bugtracker: The `IBugTracker` for which we should have a given Person. :param display_name: The name of the Person on `bugtracker`. :param email: The Person's email address if available. If `email` is supplied a Person will be created or retrieved using that email address and no `IBugTrackerPerson` records will be created. :param rationale: The `PersonCreationRationale` used to create a new `IPerson` for this `name` and `bugtracker`, if necessary. :param creation_comment: The creation comment for the `IPerson` if one is created. """ def destroySelf(): """Delete this bug tracker.""" def resetWatches(new_next_check=None): """Reset the next_check times of this BugTracker's `BugWatch`es. :param new_next_check: If specified, contains the datetime to which to set the BugWatches' next_check times. If not specified, the watches' next_check times will be set to a point between now and 24 hours hence. """ @operation_parameters(component_group_name=TextLine( title=u"The name of the remote component group", required=True)) @operation_returns_entry(Interface) @export_write_operation() def addRemoteComponentGroup(component_group_name): """Adds a new component group to the bug tracker""" @export_read_operation() @operation_returns_collection_of(Interface) def getAllRemoteComponentGroups(): """Return collection of all component groups for this bug tracker""" @operation_parameters(component_group_name=TextLine( title=u"The name of the remote component group", required=True)) @operation_returns_entry(Interface) @export_read_operation() def getRemoteComponentGroup(component_group_name): """Retrieve a given component group registered with the bug tracker. :param component_group_name: Name of the component group to retrieve. """ @operation_parameters( distribution=TextLine(title=u"The distribution for the source package", required=True), sourcepackagename=TextLine(title=u"The source package name", required=True)) @operation_returns_entry(Interface) @export_read_operation() @operation_for_version('devel') def getRemoteComponentForDistroSourcePackageName(distribution, sourcepackagename): """Returns the component linked to this source package, if any. If no components have been linked, returns value of None. """ def getRelatedPillars(user=None): """Returns the `IProduct`s and `IProjectGroup`s that use this tracker.