Beispiel #1
0
class IA1314MemberStates(Interface):
    member_states = List(
        title=u"Country",
        value_type=Choice(vocabulary="wise_search_a1314_member_states"),
        required=False,
    )
Beispiel #2
0
class IMemberStatesArt7(Interface):
    member_states = List(
        title=u"Country",
        value_type=Choice(vocabulary="wise_search_member_states_art7"),
        required=False,
    )
Beispiel #3
0
class IBugView(Interface):
    """IBug attributes that require launchpad.View permission."""

    name = exported(
        BugNameField(title=_('Nickname'),
                     required=False,
                     description=_("""A short and unique name.
                Add one only if you often need to retype the URL
                but have trouble remembering the bug number."""),
                     constraint=bug_name_validator))
    title = exported(
        Title(title=_('Summary'),
              required=True,
              description=_("""A one-line summary of the problem.""")))
    description = exported(
        Description(title=_('Description'),
                    required=True,
                    description=_("""A detailed description of the problem,
                 including the steps required to reproduce it."""),
                    strip_text=True,
                    trailing_only=True,
                    min_length=1,
                    max_length=50000))
    ownerID = Int(title=_('Owner'), required=True, readonly=True)
    owner = exported(
        Reference(IPerson, title=_("The owner's IPerson"), readonly=True))
    bugtasks = exported(CollectionField(title=_(
        'BugTasks on this bug, sorted upstream, then '
        'by ubuntu, then by other distroseries.'),
                                        value_type=Reference(schema=IBugTask),
                                        readonly=True),
                        exported_as='bug_tasks')
    default_bugtask = Reference(
        title=_("The first bug task to have been filed."), schema=IBugTask)
    duplicateof = exported(DuplicateBug(title=_('Duplicate Of'),
                                        required=False,
                                        readonly=True),
                           exported_as='duplicate_of')
    datecreated = exported(Datetime(title=_('Date Created'),
                                    required=True,
                                    readonly=True),
                           exported_as='date_created')
    displayname = TextLine(title=_("Text of the form 'Bug #X"), readonly=True)
    activity = exported(
        doNotSnapshot(
            CollectionField(
                title=_('Log of activity that has occurred on this bug.'),
                value_type=Reference(schema=IBugActivity),
                readonly=True)))
    affected_pillars = Attribute(
        'The "pillars", products or distributions, affected by this bug.')
    permits_expiration = Bool(
        title=_("Does the bug's state permit expiration?"),
        description=_(
            "Expiration is permitted when the bug is not valid anywhere, "
            "a message was sent to the bug reporter, and the bug is "
            "associated with pillars that have enabled bug expiration."),
        readonly=True)
    can_expire = exported(Bool(title=_(
        "Can the Incomplete bug expire? "
        "Expiration may happen when the bug permits expiration, "
        "and a bugtask cannot be confirmed."),
                               readonly=True), ('devel', dict(exported=False)),
                          exported=True)
    subscriptions = exported(
        doNotSnapshot(
            CollectionField(title=_('Subscriptions'),
                            value_type=Reference(schema=Interface),
                            readonly=True)))
    date_last_updated = exported(
        Datetime(title=_('Date Last Updated'), required=True, readonly=True))
    is_complete = Bool(
        title=_("Is Complete?"),
        description=_(
            "True or False depending on whether this bug is considered "
            "completely addressed. A bug in Launchpad is completely "
            "addressed when there are no tasks that are still open for "
            "the bug."),
        readonly=True)
    official_tags = Attribute("The official bug tags relevant to this bug.")
    who_made_private = exported(
        PublicPersonChoice(
            title=_('Who Made Private'),
            required=False,
            vocabulary='ValidPersonOrTeam',
            description=_("The person who set this bug private."),
            readonly=True))
    date_made_private = exported(
        Datetime(title=_('Date Made Private'), required=False, readonly=True))
    heat = exported(
        Int(title=_("The 'heat' of the bug"), required=False, readonly=True))
    watches = exported(CollectionField(
        title=_("All bug watches associated with this bug."),
        value_type=Object(schema=IBugWatch),
        readonly=True),
                       exported_as='bug_watches')
    cves = exported(
        CollectionField(title=_('CVE entries related to this bug.'),
                        value_type=Reference(schema=ICve),
                        readonly=True))
    has_cves = Bool(title=u"True if the bug has cve entries.")
    duplicates = exported(
        doNotSnapshot(
            CollectionField(
                title=_("MultiJoin of bugs which are dupes of this one."),
                value_type=BugField(),
                readonly=True)))
    # See lp.bugs.model.bug.Bug.attachments for why there are two similar
    # properties here.
    # attachments_unpopulated would more naturally be attachments, and
    # attachments be attachments_prepopulated, but lazr.resful cannot
    # export over a non-exported attribute in an interface.
    # https://bugs.launchpad.net/lazr.restful/+bug/625102
    attachments_unpopulated = CollectionField(
        title=_("List of bug attachments."),
        value_type=Reference(schema=IBugAttachment),
        readonly=True)
    attachments = doNotSnapshot(
        exported(
            CollectionField(title=_("List of bug attachments."),
                            value_type=Reference(schema=IBugAttachment),
                            readonly=True)))
    security_related = exported(
        Bool(title=_("This bug is a security vulnerability."),
             required=False,
             readonly=True))
    has_patches = Attribute("Does this bug have any patches?")
    latest_patch_uploaded = exported(
        Datetime(title=_('Date when the most recent patch was uploaded.'),
                 required=False,
                 readonly=True))
    latest_patch = Attribute("The most recent patch of this bug.")
    initial_message = Attribute(
        "The message that was specified when creating the bug")
    questions = Attribute("List of questions related to this bug.")
    specifications = Attribute("List of related specifications.")
    tags = exported(
        List(title=_("Tags"),
             description=_("Space-separated keywords for classifying "
                           "this bug report."),
             value_type=Tag(),
             required=False))
    messages = doNotSnapshot(
        CollectionField(title=_(
            "The messages related to this object, in reverse "
            "order of creation (so newest first)."),
                        readonly=True,
                        value_type=Reference(schema=IMessage)))
    followup_subject = Attribute("The likely subject of the next message.")
    date_last_message = exported(
        Datetime(title=_("Date of last bug message"),
                 required=False,
                 readonly=True))
    number_of_duplicates = exported(
        Int(title=_('The number of bugs marked as duplicates of this bug'),
            required=True,
            readonly=True))
    message_count = exported(
        Int(title=_('The number of comments on this bug'),
            required=True,
            readonly=True))
    users_affected_count = exported(
        Int(title=_('The number of users affected by this bug '
                    '(not including duplicates)'),
            required=True,
            readonly=True))
    users_unaffected_count = exported(
        # We don't say "(not including duplicates)" here because
        # affected and unaffected are asymmetrical that way.  If a dup
        # affects you, then the master bug affects you; but if a dup
        # *doesn't* affect you, the master bug may or may not affect
        # you, since a dup is often a specific symptom of a more
        # general master bug.
        Int(title=_('The number of users unaffected by this bug'),
            required=True,
            readonly=True))
    users_affected = exported(
        doNotSnapshot(
            CollectionField(title=_('The number of users affected by this bug '
                                    '(not including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    users_unaffected = exported(
        doNotSnapshot(
            CollectionField(title=_('Users explicitly marked as unaffected '
                                    '(not including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    users_affected_count_with_dupes = exported(
        Int(title=_('The number of users affected by this bug '
                    '(including duplicates)'),
            required=True,
            readonly=True))
    other_users_affected_count_with_dupes = exported(
        Int(title=_('The number of users affected by this bug '
                    '(including duplicates), excluding the current user'),
            required=True,
            readonly=True))
    users_affected_with_dupes = exported(
        doNotSnapshot(
            CollectionField(title=_('Users affected (including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    # Adding related BugMessages provides a hook for getting at
    # BugMessage.message.visible when building bug comments.
    bug_messages = Attribute('The bug messages related to this object.')
    comment_count = Attribute(
        "The number of comments on this bug, not including the initial "
        "comment.")
    indexed_messages = doNotSnapshot(
        exported(CollectionField(title=_(
            "The messages related to this object, in reverse "
            "order of creation (so newest first)."),
                                 readonly=True,
                                 value_type=Reference(schema=IMessage)),
                 exported_as='messages'))

    def getSpecifications(user):
        """List of related specifications that the user can view."""

    def _indexed_messages(include_content=False, include_parents=False):
        """Low level query for getting bug messages.

        :param include_content: If True retrieve the content for the messages
            too.
        :param include_parents: If True retrieve the object for parent
            messages too. If False the parent attribute will be *forced* to
            None to prevent lazy evaluation triggering database lookups.
        """

    def isSubscribed(person):
        """Is person subscribed to this bug?

        Returns True if the user is explicitly subscribed to this bug
        (no matter what the type of subscription), otherwise False.

        If person is None, the return value is always False.
        """

    def isSubscribedToDupes(person):
        """Is person directly subscribed to dupes of this bug?

        Returns True if the user is directly subscribed to at least one
        duplicate of this bug, otherwise False.
        """

    def isMuted(person):
        """Does person have a muted subscription on this bug?

        :returns: True if the user has muted all email from this bug.
        """

    def getDirectSubscriptions():
        """A sequence of IBugSubscriptions directly linked to this bug."""

    def getDirectSubscribers(recipients=None, level=None):
        """A list of IPersons that are directly subscribed to this bug.

        Direct subscribers have an entry in the BugSubscription table.
        """

    def getDirectSubscribersWithDetails():
        """Get direct subscribers and their subscriptions for the bug.

        Those with muted bug subscriptions are excluded from results.

        :returns: A ResultSet of tuples (Person, BugSubscription)
            representing a subscriber and their bug subscription.
        """

    def getIndirectSubscribers(recipients=None, level=None):
        """Return IPersons that are indirectly subscribed to this bug.

        Indirect subscribers get bugmail, but don't have an entry in the
        BugSubscription table. This subscribers from dupes, etc.
        """

    def getAlsoNotifiedSubscribers(recipients=None, level=None):
        """Return IPersons in the "Also notified" subscriber list.

        This includes assignees, but not subscribers from duplicates.
        """

    def getSubscriptionsFromDuplicates():
        """Return IBugSubscriptions subscribed from dupes of this bug."""

    def getSubscribersFromDuplicates():
        """Return IPersons subscribed from dupes of this bug."""

    def getSubscribersForPerson(person):
        """Find the persons or teams by which person is subscribed.

        This call should be quite cheap to make and performs a single query.

        :return: An IResultSet.
        """

    def getSubscriptionForPerson(person):
        """Return the `BugSubscription` for a `Person` to this `Bug`.

        If no such `BugSubscription` exists, return None.
        """

    def getSubscriptionInfo(level=None):
        """Return a `BugSubscriptionInfo` at the given `level`.

        :param level: A member of `BugNotificationLevel`. Defaults to
            `BugSubscriptionLevel.LIFECYCLE` if unspecified.
        """

    def getBugNotificationRecipients(level=BugNotificationLevel.LIFECYCLE):
        """Return a complete INotificationRecipientSet instance.

        The INotificationRecipientSet instance will contain details of
        all recipients for bug notifications sent by this bug; this
        includes email addresses and textual and header-ready
        rationales. See `BugNotificationRecipients` for
        details of this implementation.
        """

    def clearBugNotificationRecipientsCache():
        """Clear the bug notification recipient BugNotificationLevel cache.

        Call this when a change to a bug or bugtask would change the
        notification recipients. Changing a a bugtask's milestone or
        target is such a case.
        """

    def canBeAQuestion():
        """Return True of False if a question can be created from this bug.

        A Question can be created from a bug if:
        1. There is only one bugtask with a status of New, Incomplete,
           Confirmed, or Wont Fix. Any other bugtasks must be Invalid.
        2. The bugtask's target uses Launchpad to track bugs.
        3. The bug was not made into a question previously.
        """

    def getQuestionCreatedFromBug():
        """Return the question created from this Bug, or None."""

    def getMessagesForView(slice_info):
        """Return BugMessage,Message,MessageChunks for renderinger.

        This eager loads message.owner validity associated with the
        bugmessages.

        :param slice_info: Either None or a list of slices to constraint the
            returned rows. The step parameter in each slice is ignored.
        """

    @operation_parameters(target=Reference(schema=Interface,
                                           title=_('Target')))
    @export_read_operation()
    def canBeNominatedFor(target):
        """Can this bug nominated for this target?

        :nomination_target: An IDistroSeries or IProductSeries.

        Returns True or False.
        """

    @operation_parameters(target=Reference(schema=Interface,
                                           title=_('Target')))
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getNominationFor(target):
        """Return the IBugNomination for the target.

        If no nomination is found, a NotFoundError is raised.

        :param nomination_target: An IDistroSeries or IProductSeries.
        """

    @operation_parameters(
        target=Reference(schema=Interface, title=_('Target'), required=False),
        nominations=List(
            title=_("Nominations to search through."),
            value_type=Reference(schema=Interface),  # IBugNomination
            required=False))
    @operation_returns_collection_of(Interface)  # IBugNomination
    @export_read_operation()
    def getNominations(target=None, nominations=None):
        """Return a list of all IBugNominations for this bug.

        The list is ordered by IBugNominations.target.bugtargetdisplayname.

        :param target: An IProduct or IDistribution. Only nominations
            for this target are returned.
        :param nominations: The list of nominations to search through.
            If none is given, the bug's nominations are looked through.
            This can be useful when having to call this method multiple
            times, to avoid getting the list of nominations each time.
        """

    def getBugWatch(bugtracker, remote_bug):
        """Return the BugWatch that has the given bugtracker and remote bug.

        Return None if this bug doesn't have such a bug watch.
        """

    def getBugTask(target):
        """Return the bugtask with the specified target.

        Return None if no such bugtask is found.
        """

    def getBugTasksByPackageName(bugtasks):
        """Return a mapping from `ISourcePackageName` to its bug tasks.

        This mapping is suitable to pass as the bugtasks_by_package
        cache to getConjoinedMaster().

        The mapping is from a `ISourcePackageName` to all the bug tasks
        that are targeted to such a package name, no matter which
        distribution or distro series it is.

        All the tasks that don't have a package will be available under
        None.
        """

    @call_with(user=REQUEST_USER)
    @export_write_operation()
    def isUserAffected(user):
        """Is :user: marked as affected by this bug?"""

    def userCanSetCommentVisibility(user):
        """Return True if `user` can set bug comment visibility.

        This method is called by security adapters for authenticated users.

        Users who can set bug comment visibility are:
        - Admins and registry admins
        - users in project roles on any bugtask:
          - maintainer
          - driver
          - bug supervisor

        Additionally, the comment owners can hide their own comments but that
        is not checked here - this method is to see if arbitrary users can
        hide comments they did not make themselves.

        """

    @call_with(user=REQUEST_USER)
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getHWSubmissions(user=None):
        """Return HWDB submissions linked to this bug.

        :return: A sequence of HWDB submissions linked to this bug.
        :param user: The user making the request.

        Only those submissions are returned which the user can access.
        Public submissions are always included; private submisisons only
        if the user is the owner or an admin.
        """

    @operation_parameters(days_old=Int(
        title=_('Number of days of inactivity for which to check.'),
        required=False))
    @export_read_operation()
    def isExpirable(days_old=None):
        """Is this bug eligible for expiration and was it last updated
        more than X days ago?

        If days_old is None the default number of days without activity
        is used.

        Returns True or False.
        """

    def getActivityForDateRange(start_date, end_date):
        """Return all the `IBugActivity` for this bug in a date range.

        :param start_date: The earliest date for which activity can be
            returned.
        :param end_date: The latest date for which activity can be
            returned.
        """

    def shouldConfirmBugtasks():
        """Should we try to confirm this bug's bugtasks?

        Return True if more than one user is affected."""

    def maybeConfirmBugtasks():
        """Maybe try to confirm our new bugtasks."""

    def personIsDirectSubscriber(person):
        """Return True if the person is a direct subscriber to this `IBug`.

        Otherwise, return False.
        """

    def personIsAlsoNotifiedSubscriber(person):
        """Return True if the person is an indirect subscriber to this `IBug`.

        Otherwise, return False.
        """

    def personIsSubscribedToDuplicate(person):
        """Return True if the person subscribed to a duplicate of this `IBug`.

        Otherwise, return False.
        """

    def getAllowedInformationTypes(user):
        """Get a list of acceptable `InformationType`s for this bug.
Beispiel #4
0
class IMarineUnit2018(Interface):
    marine_unit_id = List(
        title=u"Marine Reporting Unit",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2018_marine_reporting_unit")
    )
Beispiel #5
0
class IGESComponentArt112020(Interface):
    ges_component = List(
        title=u"Descriptor",
        value_type=Choice(vocabulary="wise_search_ges_component_a112020"),
        required=False,
    )
Beispiel #6
0
class ICountryCode2018Art9(Interface):
    member_states = List(
        title=u"Country",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2018_country_art9")
    )
Beispiel #7
0
class IIndicatorsFeature(Interface):
    feature = List(
        title=u"Feature",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2018_feature_ind")
    )
Beispiel #8
0
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_indexing = 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=_("label_highlight_fields", u"Highlighting fields"),
        description=_(
            "help_highlight_fields",
            default=(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=_("label_highlight_formatter_pre",
                default=u"Highlight formatter: pre"),
        description=_(
            "help_highlight_formatter_pre",
            default=u"The text to insert before the highlighted keyword.",
        ),
        default=u"[",
        required=False,
    )

    highlight_formatter_post = TextLine(
        title=_("label_highlight_formatter_post",
                default=u"Highlight formatter: post"),
        description=_(
            "help_highlight_formatter_post",
            default=u"The text to insert after the highlighted keyword.",
        ),
        default=u"]",
        required=False,
    )

    highlight_fragsize = Int(
        title=_("label_highlight_fragsize",
                default=u"Highlight Fragment Size"),
        description=_(
            "help_highlight_fragsize",
            default=(u"The size, in characters, of the snippets (aka "
                     u"fragments) created by the highlighter."),
        ),
        default=100,
    )

    field_list = List(
        title=_("label_field_list", default=u"Default fields to be returned"),
        description=_(
            "help_field_list",
            default=(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,
    )

    boost_script = Text(
        title=_("label_boost_script",
                default=u"Python script for custom index boosting"),
        required=False,
        default=u"",
        missing_value=u"",
        description=_(
            "help_boost_script",
            default=u"This script is meant to be customized according to "
            u"site-specific search requirements, e.g. boosting "
            u'certain content types like "news items", ranking older '
            u"content lower, consider special important content items,"
            u" content rating etc."
            u" the indexing data that will be sent to Solr is passed "
            u"in as the `data` parameter, the indexable object is "
            u"available via the `context` binding. The return value "
            u"should be a dictionary consisting of field names and "
            u"their respecitive boost values.  use an empty string "
            u"as the key to set a boost value for the entire "
            u"document/content item.",
        ),
    )
Beispiel #9
0
 def test_converter_toWidgetValue(self):
     from plone.app.z3cform.converters import QueryStringDataConverter
     converter = QueryStringDataConverter(List(), None)
     self.assertEqual(converter.toWidgetValue(None), u'[]')
     self.assertEqual(converter.toWidgetValue([]), u'[]')
Beispiel #10
0
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=_('label_highlight_fields', u'Highlighting fields'),
        description=_(
            'help_highlight_fields',
            default=(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=_('label_highlight_formatter_pre',
                default=u'Highlight formatter: pre'),
        description=_(
            'help_highlight_formatter_pre',
            default=u'The text to insert before the highlighted keyword.'),
        default=u'[',
        required=False)

    highlight_formatter_post = TextLine(
        title=_('label_highlight_formatter_post',
                default=u'Highlight formatter: post'),
        description=_(
            'help_highlight_formatter_post',
            default=u'The text to insert after the highlighted keyword.'),
        default=u']',
        required=False)

    highlight_fragsize = Int(
        title=_('label_highlight_fragsize',
                default=u'Highlight Fragment Size'),
        description=_(
            'help_highlight_fragsize',
            default=(u'The size, in characters, of the snippets (aka '
                     u'fragments) created by the highlighter.')),
        default=100,
    )

    field_list = List(
        title=_('label_field_list', default=u'Default fields to be returned'),
        description=_(
            'help_field_list',
            default=(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,
    )

    boost_script = Text(
        title=_('label_boost_script',
                default=u'Python script for custom index boosting'),
        required=False,
        default=u'',
        missing_value=u'',
        description=_(
            'help_boost_script',
            default=u'This script is meant to be customized according to '
            u'site-specific search requirements, e.g. boosting '
            u'certain content types like "news items", ranking older '
            u'content lower, consider special important content items,'
            u' content rating etc.'
            u' the indexing data that will be sent to Solr is passed '
            u'in as the `data` parameter, the indexable object is '
            u'available via the `context` binding. The return value '
            u'should be a dictionary consisting of field names and '
            u'their respecitive boost values.  use an empty string '
            u'as the key to set a boost value for the entire '
            u'document/content item.'))
Beispiel #11
0
class IPromotion(Interface):
    """ A promoted item can have a number of promotions
    """
    locations = List(
            title=u"Website locations",
            description=u"Where on the site to display this promotion.",
            required=False,
        )

    themepage_section = Choice(
            title=u"Theme Page Section",
            description=u"Which page section to put this promotion in.",
            required=False,
            vocabulary=u"Themepage Promotion Sections"
        )

    themes = List(
        title=u"Themes",
        description=u"List of themes that this content object should be "
                       "associated with. If this promotion should be visible "
                       "on theme pages, this list is used to determine on "
                       "which themes.",
        required=False,
        max_length=3,
        value_type=Choice(
            title=u"Theme",
            vocabulary=u"Allowed themes",
            )
        )

    active = Bool(
            title=u"Activated",
            description=u"Activate/Deactivate this promotion.",
        )

    display_on_frontpage = Bool(
            title=u"Display On Front Page",
            description=u"Whether or not this promotion should be visible \
                    on the front page.",
        )

    display_on_themepage = Bool(
            title=u"Display On Themes Page",
            description=u"Whether or not this promotion should be visible \
                    on the themes page.",
        )

    display_in_spotlight = Bool(
            title=u"Display In Spotlight",
            description=u"Whether or not this promotion should be visible \
                    in spotlight",
        )

    display_in_topics_index_page = Bool(
        title=u"Display In Topics index page",
        description=u"Whether or not this promotion should be visible \
                    in topics index page",
    )

    display_on_datacentre = Bool(
            title=u"Display In Datacentre",
            description=u"Whether or not this promotion should be visible \
                    on datacentres",
        )

    edit_url = Attribute("URL to edit this promotion")

    is_external = Attribute("Is this an external or internal promotion?")

    url = Attribute("Get the URL to this promotion")

    def remove(self):
        """ Remove all annotations stored in this promotion
Beispiel #12
0
 def test_not_required(self):
     numbers = List(value_type=ICollector['choice']).bind(Collector(None))
     request = TestRequest()
     widget = self._widget(numbers, self._vocabulary, request)
     self.assertFalse(widget.required)
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)
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',
        ])
Beispiel #15
0
class IA1314UniqueCodes(Interface):
    unique_codes = List(
        title=u"Unique Codes",
        required=False,
        value_type=Choice(vocabulary="wise_search_a1314_unique_codes")
    )
Beispiel #16
0
 def test_converter_empty_value(self):
     from plone.app.z3cform.converters import QueryStringDataConverter
     converter = QueryStringDataConverter(List(), None)
     self.assertEqual(converter.toFieldValue(u''), None)
     self.assertEqual(converter.toFieldValue(u'[]'), None)
Beispiel #17
0
class IA2012GesComponentsArt10(Interface):
    ges_components = List(
        title=u"GES Component",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2012_ges_components_art10")
    )
Beispiel #18
0
class IPathElements(Interface):
    """Path elements interface"""

    parents = List(title="Element parents",
                   description="Internal IDs of parents objects",
                   value_type=Int())
Beispiel #19
0
class IFeatures81c(Interface):
    feature = List(
        title=u"Feature",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2018_feature_art81c")
    )
Beispiel #20
0
class IPackageUpload(Interface):
    """A Queue item for the archive uploader."""

    export_as_webservice_entry(publish_web_link=False)

    id = exported(Int(
        title=_("ID"),
        required=True,
        readonly=True,
    ))

    status = exported(
        Choice(
            vocabulary=PackageUploadStatus,
            description=_("The status of this upload."),
            title=_("Queue status"),
            required=False,
            readonly=True,
        ))

    distroseries = exported(
        Reference(
            # Really IDistroSeries, patched in
            # _schema_circular_imports.py
            schema=Interface,
            description=_("The distroseries targeted by this upload."),
            title=_("Series"),
            required=True,
            readonly=False,
        ))

    pocket = exported(
        Choice(
            vocabulary=PackagePublishingPocket,
            description=_("The pocket targeted by this upload."),
            title=_("The pocket"),
            required=True,
            readonly=False,
        ))

    date_created = exported(
        Datetime(title=_('Date created'),
                 description=_("The date this package upload was done.")))

    changesfile = Attribute("The librarian alias for the changes file "
                            "associated with this upload")
    changes_file_url = exported(TextLine(
        title=_("Changes file URL"),
        description=_("Librarian URL for the changes file associated with "
                      "this upload. Will be None if the upload was copied "
                      "from another series."),
        required=False,
        readonly=True),
                                as_of="devel")

    signing_key = Attribute("Changesfile Signing Key.")

    package_copy_job = Reference(
        schema=IPackageCopyJob,
        description=_("The PackageCopyJob for this upload, if it has one."),
        title=_("Raw Package Copy Job"),
        required=False,
        readonly=True)

    concrete_package_copy_job = Reference(
        schema=IPackageCopyJob,
        description=_("Concrete IPackageCopyJob implementation, if any."),
        title=_("Package Copy Job"),
        required=False,
        readonly=True)

    archive = exported(
        Reference(
            # Really IArchive, patched in _schema_circular_imports.py
            schema=Interface,
            description=_("The archive for this upload."),
            title=_("Archive"),
            required=True,
            readonly=True))
    sources = Attribute("The queue sources associated with this queue item")
    builds = Attribute("The queue builds associated with the queue item")

    customfiles = Attribute("Custom upload files associated with this "
                            "queue item")
    custom_file_urls = exported(List(
        title=_("Custom file URLs"),
        description=_("Librarian URLs for all the custom files attached "
                      "to this upload."),
        value_type=TextLine(),
        required=False,
        readonly=True), ("devel", dict(exported=False)),
                                exported=True)

    copy_source_archive = exported(
        Reference(
            # Really IArchive, patched in _schema_circular_imports.py
            schema=Interface,
            description=_("The archive from which this package was copied, if "
                          "any."),
            title=_("Copy source archive"),
            required=False,
            readonly=True))

    displayname = exported(TextLine(
        title=_("Generic displayname for a queue item"), readonly=True),
                           exported_as="display_name")
    displayversion = exported(TextLine(
        title=_("This item's displayable source package version"),
        readonly=True),
                              exported_as="display_version")
    displayarchs = exported(TextLine(
        title=_("Architectures related to this item"), readonly=True),
                            exported_as="display_arches")

    sourcepackagerelease = Attribute(
        "The source package release for this item")

    searchable_names = TextLine(title=_("Searchable names for this item"),
                                readonly=True)
    searchable_versions = List(title=_("Searchable versions for this item"),
                               readonly=True)

    package_name = exported(TextLine(
        title=_("Name of the uploaded source package"), readonly=True),
                            as_of="devel")

    package_version = exported(TextLine(title=_("Source package version"),
                                        readonly=True),
                               as_of="devel")

    component_name = exported(TextLine(
        title=_("Source package component name"), readonly=True),
                              as_of="devel")

    section_name = exported(TextLine(title=_("Source package section name"),
                                     readonly=True),
                            as_of="devel")

    contains_source = exported(Bool(
        title=_("Whether or not this upload contains sources"), readonly=True),
                               as_of="devel")
    contains_build = exported(
        Bool(title=_("Whether or not this upload contains binaries"),
             readonly=True),
        as_of="devel")
    contains_copy = exported(Bool(title=_(
        "Whether or not this upload contains a copy from another "
        "series."),
                                  readonly=True),
                             as_of="devel")
    contains_installer = Attribute(
        "whether or not this upload contains installers images")
    contains_translation = Attribute(
        "whether or not this upload contains translations")
    contains_upgrader = Attribute(
        "whether or not this upload contains upgrader images")
    contains_ddtp = Attribute(
        "whether or not this upload contains DDTP images")
    contains_signing = Attribute(
        "whether or not this upload contains signing images")
    contains_uefi = Attribute(
        "whether or not this upload contains a signed UEFI boot loader image"
        " (deprecated)")
    isPPA = Attribute("Return True if this PackageUpload is a PPA upload.")

    components = Attribute("""The set of components used in this upload.

        For sources, this is the component on the associated
        sourcepackagerelease.  For binaries, this is all the components
        on all the binarypackagerelease records arising from the build.
        """)

    @export_read_operation()
    @operation_for_version("devel")
    def sourceFileUrls():
        """URLs for all the source files attached to this upload.

        :return: A collection of URLs for this upload.
        """

    @export_read_operation()
    @operation_for_version("devel")
    def binaryFileUrls():
        """URLs for all the binary files attached to this upload.

        :return: A collection of URLs for this upload.
        """

    @export_read_operation()
    @operation_for_version("devel")
    def customFileUrls():
        """URLs for all the custom files attached to this upload.

        :return: A collection of URLs for this upload.
        """

    @export_read_operation()
    @operation_for_version("devel")
    def getBinaryProperties():
        """The properties of the binaries associated with this queue item.

        :return: A list of dictionaries, each containing the properties of a
            single binary.
        """

    def getFileByName(filename):
        """Return the corresponding `ILibraryFileAlias` in this context.

        The following file types (and extension) can be looked up in the
        PackageUpload context:

         * Changes files: '.changes';
         * Source files: '.orig.tar.gz', 'tar.gz', '.diff.gz' and '.dsc'.
         * Custom files: '.tar.gz'.

        :param filename: the exact filename to be looked up.

        :raises NotFoundError if no file could be found.

        :return the corresponding `ILibraryFileAlias` if the file was found.
        """

    def setUnapproved():
        """Set queue state to UNAPPROVED."""

    def setAccepted():
        """Set queue state to ACCEPTED.

        Perform the required checks on its content, so we guarantee data
        integrity by code.
        """

    def setDone():
        """Set queue state to DONE."""

    def setRejected():
        """Set queue state to REJECTED."""

    def acceptFromUploader(changesfile_path, logger=None):
        """Perform upload acceptance during upload-time.

         * Move the upload to accepted queue in all cases.
         * Publish and close bugs for 'single-source' uploads.
         * Skip bug-closing for PPA uploads.
         * Grant karma to people involved with the upload.
        """

    @export_write_operation()
    @call_with(user=REQUEST_USER)
    @operation_for_version("devel")
    def acceptFromQueue(user=None):
        """Call setAccepted, do a syncUpdate, and send notification email.

         * Grant karma to people involved with the upload.
        """

    @export_write_operation()
    @operation_parameters(comment=TextLine(title=_("Rejection comment"),
                                           required=False))
    @call_with(user=REQUEST_USER)
    @operation_for_version("devel")
    def rejectFromQueue(user, comment=None):
        """Call setRejected, do a syncUpdate, and send notification email."""

    def realiseUpload(logger=None):
        """Take this ACCEPTED upload and create the publishing records for it
        as appropriate.

        When derivation is taken into account, this may result in queue items
        being created for derived distributions.

        If a logger is provided, messages will be written to it as the upload
        is entered into the publishing records.

        Return a list containing the publishing records created.
        """

    def addSource(spr):
        """Add the provided source package release to this queue entry."""

    def addBuild(build):
        """Add the provided build to this queue entry."""

    def addCustom(library_file, custom_type):
        """Add the provided library file alias as a custom queue entry of
        the given custom type.
        """

    def syncUpdate():
        """Write updates made on this object to the database.

        This should be used when you can't wait until the transaction is
        committed to have some updates actually written to the database.
        """

    def notify(status=None,
               summary_text=None,
               changes_file_object=None,
               logger=None):
        """Notify by email when there is a new distroseriesqueue entry.

        This will send new, accept, announce and rejection messages as
        appropriate.

        :param status: The current `PackageUploadStatus` when this
            notification was generated.  Defaults to `self.status`.

        :param summary_text: Any additional text to append to the auto-
            generated summary.  This is also the only text used if there is
            a rejection message generated.

        :param changes_file_object: An open file object pointing at the
            changes file.  Current, only nascentupload need supply this
            as the transaction is not committed to the DB at that point so
            data needs to be obtained from the changes file.

        :param logger: Specify a logger object if required.  Mainly for tests.
        """

    @operation_parameters(
        new_component=TextLine(title=u"The new component name."),
        new_section=TextLine(title=u"The new section name."))
    @call_with(allowed_components=None, user=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def overrideSource(new_component=None,
                       new_section=None,
                       allowed_components=None,
                       user=None):
        """Override the source package contained in this queue item.

        :param new_component: An IComponent to replace the existing one
            in the upload's source.
        :param new_section: An ISection to replace the existing one
            in the upload's source.
        :param allowed_components: A sequence of components that the
            callsite is allowed to override from and to.
        :param user: The user requesting the override change, used if
            allowed_components is None.

        :raises QueueInconsistentStateError: if either the existing
            or the new_component are not in the allowed_components
            sequence.

        The override values may be None, in which case they are not
        changed.

        :return: True if the source was overridden.
        """

    @operation_parameters(changes=List(
        title=u"A sequence of changes to apply.",
        description=(
            u"Each item may have a 'name' item which specifies the binary "
            "package name to override; otherwise, the change applies to "
            "all binaries in the upload. It may also have 'component', "
            "'section', and 'priority' items which replace the "
            "corresponding existing one in the upload's overridden "
            "binaries."),
        value_type=Dict(key_type=TextLine())))
    @call_with(allowed_components=None, user=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def overrideBinaries(changes, allowed_components=None, user=None):
        """Override binary packages in a binary queue item.
Beispiel #21
0
class IIndicatorsGesComponent(Interface):
    ges_component = List(
        title=u"GES Component",
        required=False,
        value_type=Choice(vocabulary="wise_search_a2018_ges_component_ind")
    )
class ISolrSchema(Interface):

    active = Bool(title=_(u'Active'),
                  default=False,
                  description=_(
                      u'Check this to enable the Solr integration, i.e. '
                      'indexing and searching using the below settings.'))

    host = TextLine(
        title=_(u'Host'),
        description=_(u'The host name of the Solr instance to be used.'))

    port = Int(title=_(u'Port'),
               description=_(u'The port of the Solr instance to be used.'))

    base = TextLine(
        title=_(u'Base'),
        description=_(u'The base prefix of the Solr instance to be used.'))

    async = Bool(title=_(u'Asynchronous indexing'),
                 default=False,
                 description=_(
                     u'Check to enable asynchronous indexing operations, '
                     'which will improve Zope response times in return for '
                     'not having the Solr index updated immediately.'))

    auto_commit = Bool(
        title=_(u'Automatic commit'),
        default=True,
        description=_(u'If enabled each index operation will cause a commit '
                      'to be sent to Solr, which causes it to update its '
                      'index. If you disable this, you need to configure '
                      'commit policies on the Solr server side.'))

    commit_within = Int(
        title=_(u'Commit within'),
        default=0,
        description=_(u'Maximum number of milliseconds after which adds '
                      'should be processed by Solr. Defaults to 0, meaning '
                      'immediate commits. Enabling this feature implicitly '
                      'disables automatic commit and you should configure '
                      'commit policies on the Solr server side. Otherwise '
                      'large numbers of deletes without adds will not be '
                      'processed. This feature requires a Solr 1.4 server.'))

    index_timeout = Float(
        title=_(u'Index timeout'),
        description=_(u'Number of seconds after which an index request will '
                      'time out. Set to "0" to disable timeouts.'))

    search_timeout = Float(
        title=_(u'Search timeout'),
        description=_(u'Number of seconds after which a search request will '
                      'time out. Set to "0" to disable timeouts.'))

    max_results = Int(
        title=_(u'Maximum search results'),
        description=_(u'Specify the maximum number of matches to be returned '
                      'when searching. Set to "0" to always return all '
                      'results.'))

    required = List(title=_(u'Required query parameters'),
                    description=_(
                        u'Specify required query parameters, one per line. '
                        'Searches will only get dispatched to Solr if any '
                        'of the listed parameters is present in the query. '
                        'Leave empty to dispatch all searches.'),
                    value_type=TextLine(),
                    default=[],
                    required=False)

    search_pattern = TextLine(
        title=_(u'Pattern for simple search queries'),
        description=_(u'Specify a query pattern used for simple queries '
                      'consisting only of words and numbers, i.e. not '
                      'using any of Solr\'s advanced query expressions. '
                      '{value} and {base_value} are available in the '
                      'pattern and will be replaced by the search word '
                      'and the search word stripped of wildcard symbols.'))

    facets = List(title=_(u'Default search facets'),
                  description=_(
                      u'Specify catalog indexes that should be queried for '
                      'facet information, one per line.'),
                  value_type=TextLine(),
                  default=[],
                  required=False)

    filter_queries = List(
        title=_(u'Filter query parameters'),
        description=_(u'Specify query parameters for which filter queries '
                      'should be used, one per line.  You can use several '
                      'indices in one filter query separated by space. '
                      'Typical examples are '
                      '"effective expires allowedRolesAndUsers" or '
                      '"review_state portal_type".'),
        value_type=TextLine(),
        default=[],
        required=False)

    slow_query_threshold = Int(
        title=_(u'Slow query threshold'),
        description=_(u'Specify a threshold (in milliseconds) after which '
                      'queries are considered to be slow causing them to '
                      'be logged. Set to "0" to prevent any logging.'))

    effective_steps = Int(
        title=_(u'Effective date steps'),
        default=1,
        description=_(u'Specify the effective date steps in seconds. '
                      'Using 900 seconds (15 minutes) means the effective '
                      'date sent to Solr changes every 15 minutes.'))

    exclude_user = Bool(
        title=_(u'Exclude user from allowedRolesAndUsers'),
        description=_(u'Specify whether the user:userid should be excluded '
                      'from allowedRolesAndUsers to improve cacheability '
                      'on the expense of finding content with local roles'
                      'given to specific users.'),
        default=False)
Beispiel #23
0
class IGESComponentsA18(Interface):
    ges_component = List(
        title=u"GES Component",
        required=False,
        value_type=Choice(vocabulary="wise_search_a18_ges_component")
    )
Beispiel #24
0
class IC3sIndicator(IIndicator):
    """ Indicator Interface"""

    #directives.omitted(IEditForm, "contributor_list")
    #directives.omitted(IAddForm, "contributor_list")
    directives.omitted(IEditForm, "other_contributor")
    directives.omitted(IAddForm, "other_contributor")
    directives.omitted(IEditForm, "map_graphs")
    directives.omitted(IAddForm, "map_graphs")
    #directives.omitted(IEditForm, "publication_date")
    #directives.omitted(IAddForm, "publication_date")

    #directives.omitted(IEditForm, "keywords")
    #directives.omitted(IAddForm, "keywords")
    #directives.omitted(IEditForm, "sectors")
    #directives.omitted(IAddForm, "sectors")
    #directives.omitted(IEditForm, "climate_impacts")
    #directives.omitted(IAddForm, "climate_impacts")
    #directives.omitted(IEditForm, "elements")
    #directives.omitted(IAddForm, "elements")

    #directives.omitted(IEditForm, "websites")
    #directives.omitted(IAddForm, "websites")
    #directives.omitted(IEditForm, "source")
    #directives.omitted(IAddForm, "source")
    #directives.omitted(IEditForm, "special_tags")
    #directives.omitted(IAddForm, "special_tags")
    # directives.omitted(IEditForm, 'comments')
    # directives.omitted(IAddForm, 'comments')

    directives.omitted(IEditForm, "geographic_information")
    directives.omitted(IAddForm, "geographic_information")

    #directives.omitted(IEditForm, "include_in_observatory")
    #directives.omitted(IAddForm, "include_in_observatory")
    #directives.omitted(IEditForm, "health_impacts")
    #directives.omitted(IAddForm, "health_impacts")

    indicator_title = TextLine(
        title=_(u"Indicator title"), required=True
    )

    definition_app = RichText(
        title=(u"App definition"),
        description=u"Provide a short description",
        required=False,
    )

    c3s_identifier = TextLine(
        title=_(u"C3S Identifier"), required=True
    )

    overview_app_toolbox_url = TextLine(
        title=_(u"Overview APP Toolbox URL"), required=True
    )

    overview_app_parameters = Text(title=(u"Overview APP parameters"), required=True)

    details_app_toolbox_url = TextLine(
        title=_(u"Details APP Toolbox URL"), required=True
    )

    details_app_parameters = Text(title=(u"Details APP parameters"), required=True)

    sectors = List(
        title=_(u"Sectors"),
        description=_(
            u"Select one or more relevant sector policies"
            u" that this item relates to."
        ),
        required=False,
        missing_value=[],
        default=None,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_sectors",
        ),
    )

    climate_impacts = List(
        title=_(u"Climate impacts"),
        description=_(
            u"Select one or more climate change impact topics that "
            u"this item relates to."
        ),
        required=False,
        missing_value=[],
        default=None,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts",
        ),
    )

    publication_date = Date(
        title=_(u"Date of item's publication"),
        description=u"The date refers to the latest date of publication of "
        u"the item."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u"add only the year, please select \"day: 1\", \"month: January\" "
        u"and then the year",
        required=False
    )
Beispiel #25
0
class IRegionSubregions(Interface):
    region_subregions = List(
        title=u"Region and Subregion",
        value_type=Choice(vocabulary="wise_search_region_subregions"),
        required=False,
    )
Beispiel #26
0
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))
    display_name = exported(
        TextLine(title=_("Display Name"),
                 description=_("The displayable name of the distribution."),
                 required=True))
    displayname = Attribute("Display name (deprecated)")
    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")

    official_packages = exported(
        Bool(title=_("Packages are tracked in Launchpad"),
             readonly=False,
             required=True))

    supports_ppas = exported(
        Bool(title=_("Enable PPA creation and publication"),
             readonly=False,
             required=True))

    supports_mirrors = exported(
        Bool(title=_("Enable mirror listings and probes"),
             readonly=False,
             required=True))

    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))

    vcs = exported(
        Choice(title=_("VCS"),
               required=False,
               vocabulary=VCSType,
               description=_(
                   "Version control system for this distribution's code.")))

    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 getNonObsoleteSeries():
        """Return the non-OBSOLETE DistroSeries in this distribution."""

    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,
                  display_name=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?"""
Beispiel #27
0
class IAreaTypes(Interface):
    area_types = List(
        title=u"Area Type",
        value_type=Choice(vocabulary="wise_search_area_type"),
        required=False,
    )
Beispiel #28
0
class ISpecificationView(IHasOwner, IHasLinkedBranches):
    """Specification's attributes and methods that require
    the permission launchpad.LimitedView.
    """

    name = exported(SpecNameField(
        title=_('Name'),
        required=True,
        readonly=False,
        description=_(
            "May contain lower-case letters, numbers, and dashes. "
            "It will be used in the specification url. "
            "Examples: mozilla-type-ahead-find, postgres-smart-serial.")),
                    as_of="devel")
    title = exported(Title(
        title=_('Title'),
        required=True,
        description=_(
            "Describe the feature as clearly as possible in up to 70 "
            "characters. This title is displayed in every feature "
            "list or report.")),
                     as_of="devel")
    specurl = exported(
        SpecURLField(
            title=_('Specification URL'),
            required=False,
            description=_(
                "The URL of the specification. This is usually a wiki page."),
            constraint=valid_webref),
        exported_as="specification_url",
        as_of="devel",
    )
    summary = exported(Summary(
        title=_('Summary'),
        required=True,
        description=_(
            "A single-paragraph description of the feature. "
            "This will also be displayed in most feature listings.")),
                       as_of="devel")

    definition_status = exported(Choice(
        title=_('Definition Status'),
        readonly=True,
        vocabulary=SpecificationDefinitionStatus,
        default=SpecificationDefinitionStatus.NEW,
        description=_(
            "The current status of the process to define the "
            "feature and get approval for the implementation plan.")),
                                 as_of="devel")

    assignee = exported(PublicPersonChoice(
        title=_('Assignee'),
        required=False,
        description=_("The person responsible for implementing the feature."),
        vocabulary='ValidPersonOrTeam'),
                        as_of="devel")
    assigneeID = Attribute('db assignee value')
    drafter = exported(PublicPersonChoice(
        title=_('Drafter'),
        required=False,
        description=_(
            "The person responsible for drafting the specification."),
        vocabulary='ValidPersonOrTeam'),
                       as_of="devel")
    drafterID = Attribute('db drafter value')
    approver = exported(PublicPersonChoice(
        title=_('Approver'),
        required=False,
        description=_(
            "The person responsible for approving the specification, "
            "and for reviewing the code when it's ready to be landed."),
        vocabulary='ValidPersonOrTeam'),
                        as_of="devel")
    approverID = Attribute('db approver value')

    priority = exported(Choice(title=_('Priority'),
                               vocabulary=SpecificationPriority,
                               default=SpecificationPriority.UNDEFINED,
                               required=True),
                        as_of="devel")
    datecreated = exported(
        Datetime(title=_('Date Created'), required=True, readonly=True),
        as_of="devel",
        exported_as="date_created",
    )
    owner = exported(PublicPersonChoice(title=_('Owner'),
                                        required=True,
                                        readonly=True,
                                        vocabulary='ValidPersonOrTeam'),
                     as_of="devel")

    product = Choice(title=_('Project'), required=False, vocabulary='Product')
    distribution = Choice(title=_('Distribution'),
                          required=False,
                          vocabulary='Distribution')

    # Exported as readonly for simplicity, but could be exported as read-write
    # using setTarget() as the mutator.
    target = exported(ReferenceChoice(
        title=_('For'),
        required=True,
        readonly=True,
        vocabulary='DistributionOrProduct',
        description=_("The project for which this proposal is being made."),
        schema=ISpecificationTarget),
                      as_of="devel")

    productseries = Choice(
        title=_('Series Goal'),
        required=False,
        vocabulary='FilteredProductSeries',
        description=_(
            "Choose a series in which you would like to deliver this "
            "feature. Selecting '(nothing selected)' will clear the goal."))
    distroseries = Choice(
        title=_('Series Goal'),
        required=False,
        vocabulary='FilteredDistroSeries',
        description=_(
            "Choose a series in which you would like to deliver this "
            "feature. Selecting '(nothing selected)' will clear the goal."))

    # milestone
    milestone = exported(ReferenceChoice(
        title=_('Milestone'),
        required=False,
        vocabulary='Milestone',
        description=_(
            "The milestone in which we would like this feature to be "
            "delivered."),
        schema=IMilestone),
                         as_of="devel")

    # nomination to a series for release management
    # XXX: It'd be nice to export goal as read-only, but it's tricky because
    # users will need to be aware of goalstatus as what's returned by .goal
    # may not be the accepted goal.
    goal = Attribute("The series for which this feature is a goal.")
    goalstatus = Choice(
        title=_('Goal Acceptance'),
        vocabulary=SpecificationGoalStatus,
        default=SpecificationGoalStatus.PROPOSED,
        description=_(
            "Whether or not the drivers have accepted this feature as "
            "a goal for the targeted series."))
    goal_proposer = Attribute("The person who nominated the spec for "
                              "this series.")
    date_goal_proposed = Attribute("The date of the nomination.")
    goal_decider = Attribute("The person who approved or declined "
                             "the spec a a goal.")
    date_goal_decided = Attribute("The date the spec was approved "
                                  "or declined as a goal.")

    work_items = List(description=_(
        "All non-deleted work items for this spec, sorted by "
        "their 'sequence'"),
                      value_type=Reference(schema=ISpecificationWorkItem),
                      readonly=True)
    whiteboard = exported(Text(
        title=_('Status Whiteboard'),
        required=False,
        description=_("Any notes on the status of this spec you would like to "
                      "make. Your changes will override the current text.")),
                          as_of="devel")
    workitems_text = exported(WorkItemsText(
        title=_('Work Items'),
        required=False,
        readonly=True,
        description=_(
            "Work items for this specification input in a text format. "
            "Your changes will override the current work items.")),
                              as_of="devel")
    direction_approved = exported(Bool(
        title=_('Basic direction approved?'),
        required=True,
        default=False,
        description=_("Check this to indicate that the drafter and assignee "
                      "have satisfied the approver that they are headed in "
                      "the right basic direction with this specification.")),
                                  as_of="devel")
    man_days = Int(
        title=_("Estimated Developer Days"),
        required=False,
        default=None,
        description=_(
            "An estimate of the "
            "number of developer days it will take to implement this feature. "
            "Please only provide an estimate if you are relatively confident "
            "in the number."))
    implementation_status = exported(Choice(
        title=_("Implementation Status"),
        required=True,
        readonly=True,
        default=SpecificationImplementationStatus.UNKNOWN,
        vocabulary=SpecificationImplementationStatus,
        description=_("The state of progress being made on the actual "
                      "implementation or delivery of this feature.")),
                                     as_of="devel")
    superseded_by = Choice(
        title=_("Superseded by"),
        required=False,
        default=None,
        vocabulary='Specification',
        description=_(
            "The specification "
            "which supersedes this one. Note that selecting a specification "
            "here and pressing Continue will change the specification "
            "status to Superseded."))

    # lifecycle
    starter = exported(PublicPersonChoice(
        title=_('Starter'),
        required=False,
        readonly=True,
        description=_(
            'The person who first set the state of the '
            'spec to the values that we consider mark it as started.'),
        vocabulary='ValidPersonOrTeam'),
                       as_of="devel")
    date_started = exported(Datetime(
        title=_('Date Started'),
        required=False,
        readonly=True,
        description=_('The date when this spec was marked started.')),
                            as_of="devel")

    completer = exported(PublicPersonChoice(
        title=_('Starter'),
        required=False,
        readonly=True,
        description=_(
            'The person who finally set the state of the '
            'spec to the values that we consider mark it as complete.'),
        vocabulary='ValidPersonOrTeam'),
                         as_of="devel")

    date_completed = exported(Datetime(
        title=_('Date Completed'),
        required=False,
        readonly=True,
        description=_(
            'The date when this spec was marked '
            'complete. Note that complete also includes "obsolete" and '
            'superseded. Essentially, it is the state where no more work '
            'will be done on the feature.')),
                              as_of="devel")

    # joins
    subscriptions = Attribute('The set of subscriptions to this spec.')
    subscribers = Attribute('The set of subscribers to this spec.')
    sprints = Attribute('The sprints at which this spec is discussed.')
    sprint_links = Attribute('The entries that link this spec to sprints.')
    dependencies = exported(
        CollectionField(
            title=_('Specs on which this one depends.'),
            value_type=Reference(schema=Interface),  # ISpecification, really.
            readonly=True),
        as_of="devel")
    linked_branches = exported(
        CollectionField(
            title=_("Branches associated with this spec, usually "
                    "branches on which this spec is being implemented."),
            value_type=Reference(schema=Interface),  # ISpecificationBranch
            readonly=True),
        as_of="devel")

    def getDependencies():
        """Specs on which this one depends."""

    def getBlockedSpecs():
        """Specs for which this spec is a dependency."""

    # emergent properties
    informational = Attribute('Is True if this spec is purely informational '
                              'and requires no implementation.')
    is_complete = exported(Bool(
        title=_('Is started'),
        readonly=True,
        required=True,
        description=_(
            'Is True if this spec is already completely implemented. '
            'Note that it is True for informational specs, since '
            'they describe general functionality rather than specific '
            'code to be written. It is also true of obsolete and '
            'superseded specs, since there is no longer any need '
            'to schedule work for them.')),
                           as_of="devel")

    is_incomplete = Attribute(
        'Is True if this work still needs to '
        'be done. Is in fact always the opposite of is_complete.')
    is_blocked = Attribute('Is True if this spec depends on another spec '
                           'which is still incomplete.')
    is_started = exported(Bool(
        title=_('Is started'),
        readonly=True,
        required=True,
        description=_(
            'Is True if the spec is in a state which '
            'we consider to be "started". This looks at the delivery '
            'attribute, and also considers informational specs to be '
            'started when they are approved.')),
                          as_of="devel")

    lifecycle_status = exported(Choice(
        title=_('Lifecycle Status'),
        vocabulary=SpecificationLifecycleStatus,
        default=SpecificationLifecycleStatus.NOTSTARTED,
        readonly=True),
                                as_of="devel")

    def all_deps():
        """All the dependencies, including dependencies of dependencies.

        If a user is provided, filters to only dependencies the user can see.
        """

    def all_blocked():
        """All specs blocked on this, and those blocked on the blocked ones.

        If a user is provided, filters to only blocked dependencies the user
        can see.
        """

    def validateMove(target):
        """Check that the specification can be moved to the target."""

    def getSprintSpecification(sprintname):
        """Get the record that links this spec to the named sprint."""

    def notificationRecipientAddresses():
        """Return the list of email addresses that receive notifications."""

    has_accepted_goal = exported(Bool(
        title=_('Series goal is accepted'),
        readonly=True,
        required=True,
        description=_(
            'Is true if this specification has been '
            'proposed as a goal for a specific series, '
            'and the drivers of that series have accepted the goal.')),
                                 as_of="devel")

    # lifecycle management
    def updateLifecycleStatus(user):
        """Mark the specification as started, and/or complete, if appropriate.

        This will verify that the state of the specification is in fact
        "complete" (there is a completeness test in
        Specification.is_complete) and then record the completer and the
        date_completed. If the spec is not completed, then it ensures that
        nothing is recorded about its completion.

        It returns a SpecificationLifecycleStatus dbschema showing the
        overall state of the specification IF the state has changed.
        """

    # event-related methods
    def getDelta(old_spec, user):
        """Return a dictionary of things that changed between this spec and
        the old_spec.

        This method is primarily used by event subscription code, to
        determine what has changed during an ObjectModifiedEvent.
        """

    # subscription-related methods
    def subscription(person):
        """Return the subscription for this person to this spec, or None."""

    @operation_parameters(person=Reference(IPerson,
                                           title=_('Person'),
                                           required=True),
                          essential=copy_field(
                              ISpecificationSubscription['essential'],
                              required=False))
    @call_with(subscribed_by=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def subscribe(person, subscribed_by=None, essential=False):
        """Subscribe this person to the feature specification."""

    @operation_parameters(person=Reference(IPerson,
                                           title=_('Person'),
                                           required=False))
    @call_with(unsubscribed_by=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def unsubscribe(person, unsubscribed_by):
        """Remove the person's subscription to this spec."""

    def getSubscriptionByName(name):
        """Return a subscription based on the person's name, or None."""

    def isSubscribed(person):
        """Is person subscribed to this spec?

        Returns True if the user is explicitly subscribed to this spec
        (no matter what the type of subscription), otherwise False.

        If person is None, the return value is always False.
        """

    # sprints
    def linkSprint(sprint, user):
        """Put this spec on the agenda of the sprint."""

    def unlinkSprint(sprint):
        """Remove this spec from the agenda of the sprint."""

    # dependencies
    def createDependency(specification):
        """Create a dependency for this spec on the spec provided."""

    def removeDependency(specification):
        """Remove any dependency of this spec on the spec provided."""

    # branches
    def getBranchLink(branch):
        """Return the SpecificationBranch link for the branch, or None."""

    def getLinkedBugTasks(user):
        """Return the bug tasks that are relevant to this blueprint.

        When multiple tasks are on a bug, if one of the tasks is for the
        target, then only that task is returned. Otherwise the default
        bug task is returned.

        :param user: The user doing the search.
        """

    def getAllowedInformationTypes(who):
        """Get a list of acceptable `InformationType`s for this spec."""