Exemplo n.º 1
0
class IUnfallanzeige(IContent):

    # Default Page

    unfustdor = Choice(
        title=_(u"Arbeitsstelle des Versicherten"),
        description=_(u"Wo ist die versicherte Person regelmaessig taetig?"),
        values=(u'In dem vorher genannten Unternehmen',
                'In einer Zweigniederlassung'),
    )

    unfuname = TextLine(
        title=_(u"Name der Zweigstelle"),
        description=_(u"Bitte geben Sie hier den Namen der Zweigstelle an."),
        required=False,
    )

    unfustrasse = TextLine(
        title=_(u"Strasse"),
        description=_(u"Bitte geben Sie Strasse"),
        required=False,
    )

    unfunr = TextLine(
        title=_(u"Hs.-Nr."),
        description=_(u"Hausnummer der Zweigstelle an."),
        required=False,
    )

    unfuplz = TextLine(
        title=_(u"PLZ"),
        description=_(u"Bitte geben Sie Postleitzahl"),
        required=False,
        constraint=validatePLZ,
    )

    unfuort = TextLine(
        title=_(u"Ort"),
        description=_(u"Ort der Zweigstelle an."),
        required=False,
    )

    anspname = TextLine(
        title=_(u"Ansprechpartner"),
        description=
        _(u"Bitte geben Sie einen Ansprechpartner an, den wir bei Rueckfragen schnell erreichen koennen"
          ),
    )

    anspfon = TextLine(
        title=_(u"Telefon"),
        description=_(u"vergessen Sie dabei bitte nicht die Telefonnummer."),
    )

    # Page Two

    uadbru1 = OptionalChoice(
        title=_(u"Taetigkeit zum Unfallzeitpunkt"),
        description=_(
            u"Die versicherte Person ist zum Unfallzeitpunkt beschaeftigt als:"
        ),
        source=DynVocab("uvc.uadbru1"),
    )

    uadst = TextLine(
        title=_(u"Beginn der Beschaeftigung"),
        description=_(u"Der Versicherte ist beschaeftigt seit: (mm.jjjj)"),
        constraint=validateFutureShortDatum,
    )

    unfute = OptionalChoice(
        title=_(u"Teil des Unternehmens"),
        description=
        _(u"In welchem Teil des Unternehmens ist der Versicherte staendig taetig?"
          ),
        source=DynVocab("uvc.unfute"),
    )

    unflar = Choice(
        title=_(u"Leiharbeitnehmer"),
        description=_(u"Ist die versicherte Person Leiharbeitnehmer?"),
        values=('ja', 'nein'),
    )

    unvlaraddr = Text(
        title=_(u"Personaldienstleister"),
        description=
        _(u"Bitte geben Sie Name und Anschrift des Personaldienstleisters bzw. Zeitarbeitsunternehmens an."
          ),
        required=False,
    )

    # Step 3

    prsname = TextLine(
        title=_(u"Name"),
        description=_(u"Name des Versicherten"),
    )

    prsvor = TextLine(
        title=_(u"Vorname"),
        description=_(u"Vorname des Versicherten"),
    )

    ikstr = TextLine(
        title=_(u"Anschrift (Strasse"),
        description=_(u"Bitte geben Sie Strasse"),
    )

    iknr = TextLine(
        title=_(u"Hs.-Nr.)"),
        description=_(u"Hausnummer des Versicherten an."),
    )

    lkz = OptionalChoice(
        title=_(u"Laenderkennzeichen"),
        description=_(u"Laenderkennzeichen des Versicherten"),
        source=DynVocab(u'uvc.lkz'),
    )

    ikzplz = TextLine(
        title=_(u"PLZ"),
        description=_(u"Bitte geben Sie Postleitzahl"),
        #constraint = validatePLZ,
    )

    ikzort = TextLine(
        title=_(u"Ort"),
        description=_(u"Ort des Versicherten an."),
    )

    prsgeb = TextLine(
        title=_(u"Geburtsdatum"),
        description=_(u"Geburtsdatum des Versicherten (tt.mm.jjjj)"),
        constraint=validateFutureDatum,
    )

    prssex = Choice(
        title=_(u"Geschlecht"),
        description=_(u"Geschlecht des Versicherten"),
        source=vocab_prssex,
    )

    prssta = Choice(
        title=_(u"Staatsangehoerigkeit"),
        description=_(u"Staatsangehoerigkeit des Versicherten"),
        source=DynVocab(u'uvc.sta'),
    )

    unfbu = Choice(
        title=_(u"Angaben zum Arbeitsverhaeltnis"),
        description=
        _(u"Bitte waehlen Sie aus, in welchem Arbeitsverhaeltnis der Versicherte steht."
          ),
        source=vocab_unfbu,
    )

    vehearbeitsv = Choice(
        title=_(u"Ehegattenarbeitsvertrag"),
        description=_(u"Besteht ein Ehegattenarbeitsvertrag?"),
        values=(u'Ja', u'Nein'),
        required=False,
    )

    vehebis = TextLine(
        title=_(u"Ehegattenarbeitsvertrag (Vertragsbeginn)"),
        description=_(
            u"Wann wurde der Ehegattenarbeitsvertrag geschlossen (tt.mm.jjjj)"
        ),
        required=False,
        constraint=validateFutureDatum,
    )

    veheentgeltbis = TextLine(
        title=_(u"Entgeltzahlung"),
        description=
        _(u"Entgelt aus dem Ehegattenarbeitsvertrag wurde gezahlt bis (tt.mm.jjjj):"
          ),
        required=False,
        constraint=validateFutureDatum,
    )

    unfefz = Int(
        title=_(u"Entgeltfortzahlung"),
        description=_(
            u"Fuer wie viele Wochen besteht Anspuch auf Entgeltfortzahlung?"),
        required=False,
        max=99,
        min=0,
    )

    unfkka = TextLine(
        title=_(u"Krankenkasse des Versicherten"),
        description=_(
            u"Name und Anschrift der Krankenkasse des Versicherten."),
    )

    #Step4

    unfdatum = TextLine(
        title=_(u"Unfallzeitpunkt (Datum"),
        description=_(u"Bitte geben Sie das Unfallatum (tt.mm.jjjj)"),
        constraint=validateFutureDatum,
    )

    unfzeit = TextLine(
        title=_(u"Zeit)"),
        description=_(u"den Zeitpunkt (hh:mm) des Unfalls an."),
        constraint=validateUhrzeit,
    )

    unfort_detail = Choice(
        title=_(u"Unfallort"),
        description=_(u"Bitte waehlen Sie aus wo sich der Unfall ereignete."),
        source=vocab_unfortdetail,
    )

    unfort = Text(
        title=_(u"Angaben zum Unfallort"),
        description=
        _(u"Bitte geben Sie den Unfallort moeglichst genau an (genaue Orts- und Strassenangabe mit Postleitzahl)."
          ),
    )

    unfhg1 = Text(
        title=_(u"Unfallhergang"),
        description=
        _(u"Bitte schildern sie moeglichst detailliert wie sich der Unfall ereignete"
          ),
    )

    unfhg2 = Choice(
        title=_(u"Angaben zum Unfall"),
        description=_(u"Die Angaben beruhen auf den Schilderungen:"),
        values=('des Versicherten', 'einer anderen Person'),
    )

    unfkn1 = Text(
        title=_(u"Zeugen des Unfalls"),
        description=
        _(u"Wer hat von dem Unfall zuerst Kenntnis genommen (Name und Anschrift des Zeugen)"
          ),
        required=False,
    )

    unfkn2 = Choice(
        title=_(u"Augenzeuge"),
        description=_(u"War diese Person Augenzeuge?"),
        values=('ja', 'nein'),
        required=False,
    )

    # Step 5

    prstkz = Choice(
        title=_(u"Toedlicher Unfall"),
        description=_(u"Handelt es sich um einen toedlichen Unfall?"),
        values=('ja', 'nein'),
    )

    unfae1 = Choice(
        title=_(u"Unterbrechung der Arbeit"),
        description=_(u"Hat der Versicherte die Arbeit eingestellt?"),
        source=vocab_wiederaufnahme,
        required=False,
    )

    unfaedatum = TextLine(
        title=_(u"Datum"),
        description=_(u"Bitte geben Sie Datum (tt.mm.jjjj)"),
        required=False,
        constraint=validateFutureDatum,
    )

    unfaezeit = TextLine(
        title=_(u"Uhrzeit"),
        description=_(u"Uhrzeit (hh:mm) an."),
        required=False,
        constraint=validateUhrzeit,
    )

    unfwa1 = Choice(
        title=_(u"Wiederaufnahme der Arbeit"),
        description=_(u"Hat der Versicherte die Arbeit wieder aufgenommen?"),
        values=('ja', 'nein'),
        required=False,
    )

    unfwax = TextLine(
        title=_(u"Datum der Wiederaufnahme"),
        description=_(
            u"An welchem Tag wurde die Arbeit wieder aufgenommen (tt.mm.jjjj)?"
        ),
        required=False,
        constraint=validateFutureDatum,
    )

    uadbavon = TextLine(
        title=_(u"Arbeitszeit (Beginn"),
        description=_(u"Die taegliche Arbeitszeit beginnt um Uhrzeit (hh:mm)"),
        constraint=validateUhrzeit,
    )

    uadbabis = TextLine(
        title=_(u"Ende)"),
        description=_(u"endet um Uhrzeit (hh:mm)."),
        constraint=validateUhrzeit,
    )

    diavkt = TextLine(
        title=_(u"Verletzte Koerperteile"),
        description=_(u"Welche Koerperteile sind verletzt?"),
    )

    diaadv = TextLine(
        title=_(u"Art der Verletzung"),
        description=_(u"Welche Art der Verletzung liegt vor?"),
    )

    unfeba = Choice(
        title=_(u"Erstbehandlung des Versicherten"),
        description=_(
            u"War eine aerztliche Erstbehandlung des Versicherten erforderlich?"
        ),
        source=vocab_arzt,
    )

    unfeba1 = Text(
        title=_(u"Erstbehandelnder Arzt"),
        description=
        _(u"Bitte geben Sie Name und Anschrift des erstbehandelnden Arztes an."
          ),
        required=False,
    )

    #Step 6

    unfus3 = TextLine(
        title=_(u"Personal- bzw. Betriebsrat"),
        description=
        _(u"Die folgende Person des Personal- bzw Betriebsrates wurde informiert: (Vorname, Name)"
          ),
        required=False,
    )

    unfus2 = TextLine(
        title=_(u"Unternehmer / Bevollmaechtigter"),
        description=_(
            u"Vorname, Name des Unternehmens bzw. des Bevollmaechtigten"),
    )

    #Step 7

    behandlung = Choice(
        title=_(u"Weiteres Vorgehen"),
        description=_(
            u"Bitte waehlen Sie aus, wie Sie weiter vorgehen moechten."),
        values=('Versand', 'Entwurf speichern'),
    )
Exemplo n.º 2
0
class IMetadataSchema(Interface):

    """Schema for metadata views.
    """

    allow_discussion = Choice(
        title=_(u'Enable Discussion?'),
        required=False,
        vocabulary=SimpleVocabulary.fromTitleItems(available_settings))

    identifier = URI(
        title=_(u'Identifier'),
        readonly=True)

    title = TextLine(
        title=_(u'Title'),
        required=False,
        missing_value=u'')

    description = Text(
        title=_(u'Description'),
        required=False,
        missing_value=u'')

    subject = Set(
        title=_(u'Subject'),
        required=False,
        missing_value=set(),
        value_type=TextLine())

    contributors = Tuple(
        title=_(u'Contributors'),
        required=False,
        missing_value=(),
        value_type=TextLine())

    created = Datetime(
        title=_(u'Creation Date'),
        readonly=True)

    modified = Datetime(
        title=_(u'Last Modified Date'),
        readonly=True)

    effective = Datetime(
        title=_(u'Effective Date'),
        required=False
        )

    expires = Datetime(
        title=_(u'Expiration Date'),
        required=False
        )

    format = TextLine(
        title=_(u'Format'),
        required=False,
        missing_value=u'')

    language = TextLine(
        title=_(u'Language'),
        required=False,
        missing_value=u'')

    rights = TextLine(
        title=_(u'Rights'),
        required=False,
        missing_value=u'')
Exemplo n.º 3
0
class IIdentifier(IAlgebraObject):
    """Objects providing this interface represent the
    Identifier Algebra object
    """
    name = Text()
Exemplo n.º 4
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.'))
Exemplo n.º 5
0
class IGitRepositoryView(IHasRecipes):
    """IGitRepository attributes that require launchpad.View permission."""

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

    date_created = exported(
        Datetime(title=_("Date created"), required=True, readonly=True))

    repository_type = exported(
        Choice(
            title=_("Repository type"),
            required=True,
            readonly=True,
            vocabulary=GitRepositoryType,
            description=_(
                "The way this repository is hosted: directly on Launchpad, or "
                "imported from somewhere else.")))

    registrant = exported(
        PublicPersonChoice(
            title=_("Registrant"),
            required=True,
            readonly=True,
            vocabulary="ValidPersonOrTeam",
            description=_("The person who registered this Git repository.")))

    owner = exported(
        PersonChoice(
            title=_("Owner"),
            required=True,
            readonly=True,
            vocabulary="AllUserTeamsParticipationPlusSelf",
            description=_(
                "The owner of this Git repository. This controls who can modify "
                "the repository.")))

    target = exported(Reference(
        title=_("Target"),
        required=True,
        readonly=True,
        schema=IHasGitRepositories,
        description=_("The target of the repository.")),
                      as_of="devel")

    namespace = Attribute(
        "The namespace of this repository, as an `IGitNamespace`.")

    # XXX cjwatson 2015-01-29: Add some advice about default repository
    # naming.
    name = exported(
        TextLine(
            title=_("Name"),
            required=True,
            readonly=True,
            constraint=git_repository_name_validator,
            description=_(
                "The repository name. Keep very short, unique, and descriptive, "
                "because it will be used in URLs.")))

    information_type = exported(
        Choice(title=_("Information type"),
               vocabulary=InformationType,
               required=True,
               readonly=True,
               default=InformationType.PUBLIC,
               description=_(
                   "The type of information contained in this repository.")))

    owner_default = exported(
        Bool(title=_("Owner default"),
             required=True,
             readonly=True,
             description=_(
                 "Whether this repository is the default for its owner and "
                 "target.")))

    target_default = exported(
        Bool(title=_("Target default"),
             required=True,
             readonly=True,
             description=_(
                 "Whether this repository is the default for its target.")))

    unique_name = exported(
        Text(
            title=_("Unique name"),
            readonly=True,
            description=_(
                "Unique name of the repository, including the owner and project "
                "names.")))

    display_name = exported(
        Text(title=_("Display name"),
             readonly=True,
             description=_("Display name of the repository.")))

    code_reviewer = Attribute(
        "The reviewer if set, otherwise the owner of the repository.")

    shortened_path = Attribute(
        "The shortest reasonable version of the path to this repository.")

    @operation_parameters(reviewer=Reference(
        title=_("A person for which the reviewer status is in question."),
        schema=IPerson))
    @export_read_operation()
    @operation_for_version('devel')
    def isPersonTrustedReviewer(reviewer):
        """Return true if the `reviewer` is a trusted reviewer.

        The reviewer is trusted if they either own the repository, or are in
        the team that owns the repository, or they are in the review team
        for the repository.
        """

    git_identity = exported(
        Text(
            title=_("Git identity"),
            readonly=True,
            description=_(
                "If this is the default repository for some target, then this is "
                "'lp:' plus a shortcut version of the path via that target.  "
                "Otherwise it is simply 'lp:' plus the unique name.")))

    identity = Attribute(
        "The identity of this repository: a VCS-independent synonym for "
        "git_identity.")

    git_https_url = exported(
        TextLine(
            title=_("HTTPS URL"),
            readonly=True,
            description=_(
                "An HTTPS URL for this repository, or None in the case of private "
                "repositories.")))

    git_ssh_url = exported(
        TextLine(title=_("SSH URL"),
                 readonly=True,
                 description=_("A git+ssh:// URL for this repository.")))

    refs = exported(
        doNotSnapshot(
            CollectionField(
                title=_("The references present in this repository."),
                readonly=True,
                # Really IGitRef, patched in _schema_circular_imports.py.
                value_type=Reference(Interface))))

    branches = exported(
        doNotSnapshot(
            CollectionField(
                title=_("The branch references present in this repository."),
                readonly=True,
                # Really IGitRef, patched in _schema_circular_imports.py.
                value_type=Reference(Interface))))

    branches_by_date = Attribute(
        "The branch references present in this repository, ordered by last "
        "commit date.")

    subscriptions = exported(
        CollectionField(
            title=_("GitSubscriptions associated with this repository."),
            readonly=True,
            # Really IGitSubscription, patched in _schema_circular_imports.py.
            value_type=Reference(Interface)))

    subscribers = exported(
        CollectionField(title=_("Persons subscribed to this repository."),
                        readonly=True,
                        value_type=Reference(IPerson)))

    code_import = exported(
        Reference(
            title=_("The associated CodeImport, if any."),
            # Really ICodeImport, patched in _schema_circular_imports.py.
            schema=Interface))

    rules = Attribute("The access rules for this repository.")

    grants = Attribute("The access grants for this repository.")

    @operation_parameters(
        path=TextLine(title=_("A string to look up as a path.")))
    # Really IGitRef, patched in _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @export_read_operation()
    @operation_for_version("devel")
    def getRefByPath(path):
        """Look up a single reference in this repository by path.

        :param path: A string to look up as a path.

        :return: An `IGitRef`, or None.
        """

    def createOrUpdateRefs(refs_info, get_objects=False, logger=None):
        """Create or update a set of references in this repository.

        :param refs_info: A dict mapping ref paths to
            {"sha1": sha1, "type": `GitObjectType`}.
        :param get_objects: Return the created/updated references.
        :param logger: An optional logger.

        :return: A list of the created/updated references if get_objects,
            otherwise None.
        """

    def removeRefs(paths):
        """Remove a set of references in this repository.

        :params paths: An iterable of paths.
        """

    def planRefChanges(hosting_path, logger=None):
        """Plan ref changes based on information from the hosting service.

        :param hosting_path: A path on the hosting service.
        :param logger: An optional logger.

        :return: A dict of refs to create or update as appropriate, mapping
            ref paths to dictionaries of their fields; and a set of ref
            paths to remove.
        """

    def fetchRefCommits(hosting_path, refs, logger=None):
        """Fetch commit information from the hosting service for a set of refs.

        :param hosting_path: A path on the hosting service.
        :param refs: A dict mapping ref paths to dictionaries of their
            fields; the field dictionaries will be updated with any detailed
            commit information that is available.
        :param logger: An optional logger.
        """

    def synchroniseRefs(refs_to_upsert, refs_to_remove, logger=None):
        """Synchronise references with those from the hosting service.

        :param refs_to_upsert: A dictionary mapping ref paths to
            dictionaries of their fields; these refs will be created or
            updated as appropriate.
        :param refs_to_remove: A set of ref paths to remove.
        :param logger: An optional logger.
        """

    def setOwnerDefault(value):
        """Set whether this repository is the default for its owner-target.

        This is for internal use; the caller should ensure permission to
        edit the owner, should arrange to remove any existing owner-target
        default, and should check that this repository is attached to the
        desired target.

        :param value: True if this repository should be the owner-target
            default, otherwise False.
        """

    def setTargetDefault(value):
        """Set whether this repository is the default for its target.

        This is for internal use; the caller should ensure permission to
        edit the target, should arrange to remove any existing target
        default, and should check that this repository is attached to the
        desired target.

        :param value: True if this repository should be the target default,
            otherwise False.
        """

    def getCodebrowseUrl():
        """Construct a browsing URL for this Git repository."""

    def getCodebrowseUrlForRevision(commit):
        """The URL to the commit of the merge to the target branch"""

    def getLatestScanJob():
        """Return the last IGitRefScanJobSource for this repository"""

    def visibleByUser(user):
        """Can the specified user see this repository?"""

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

        If the user is a Launchpad admin, any type is acceptable.
        """

    def getInternalPath():
        """Get the internal path to this repository.

        This is used on the storage backend.
        """

    def getRepositoryDefaults():
        """Return a sorted list of `ICanHasDefaultGitRepository` objects.

        There is one result for each related object for which this
        repository is the default.  For example, in the case where a
        repository is the default for a project and is also its owner's
        default repository for that project, the objects for both the
        project and the person-project are returned.

        More important related objects are sorted first.
        """

    # Marker for references to Git URL layouts: ##GITNAMESPACE##
    def getRepositoryIdentities():
        """A list of aliases for a repository.

        Returns a list of tuples of path and context object.  There is at
        least one alias for any repository, and that is the repository
        itself.  For default repositories, the context object is the
        appropriate default object.

        Where a repository is the default for a product or a distribution
        source package, the repository is available through a number of
        different URLs.  These URLs are the aliases for the repository.

        For example, a repository which is the default for the 'fooix'
        project and which is also its owner's default repository for that
        project is accessible using:
          fooix - the context object is the project fooix
          ~fooix-owner/fooix - the context object is the person-project
              ~fooix-owner and fooix
          ~fooix-owner/fooix/+git/fooix - the unique name of the repository
              where the context object is the repository itself.
        """

    def userCanBeSubscribed(person):
        """Return True if the `IPerson` can be subscribed to the repository."""

    @operation_parameters(
        person=Reference(title=_("The person to subscribe."), schema=IPerson),
        notification_level=Choice(
            title=_("The level of notification to subscribe to."),
            vocabulary=BranchSubscriptionNotificationLevel),
        max_diff_lines=Choice(
            title=_("The max number of lines for diff email."),
            vocabulary=BranchSubscriptionDiffSize),
        code_review_level=Choice(
            title=_("The level of code review notification emails."),
            vocabulary=CodeReviewNotificationLevel))
    # Really IGitSubscription, patched in _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @call_with(subscribed_by=REQUEST_USER)
    @export_write_operation()
    @operation_for_version("devel")
    def subscribe(person, notification_level, max_diff_lines,
                  code_review_level, subscribed_by):
        """Subscribe this person to the repository.

        :param person: The `Person` to subscribe.
        :param notification_level: The kinds of repository changes that
            cause notification.
        :param max_diff_lines: The maximum number of lines of diff that may
            appear in a notification.
        :param code_review_level: The kinds of code review activity that
            cause notification.
        :param subscribed_by: The person who is subscribing the subscriber.
            Most often the subscriber themselves.
        :return: A new or existing `GitSubscription`.
        """

    @operation_parameters(person=Reference(title=_("The person to search for"),
                                           schema=IPerson))
    # Really IGitSubscription, patched in _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @export_read_operation()
    @operation_for_version("devel")
    def getSubscription(person):
        """Return the `GitSubscription` for this person."""

    def hasSubscription(person):
        """Is this person subscribed to the repository?"""

    @operation_parameters(person=Reference(
        title=_("The person to unsubscribe"), schema=IPerson))
    @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 repository.

        :param person: The person or team to unsubscribe from the repository.
        :param unsubscribed_by: The person doing the unsubscribing.
        """

    def getSubscriptionsByLevel(notification_levels):
        """Return the subscriptions that are at the given notification levels.

        :param notification_levels: An iterable of
            `BranchSubscriptionNotificationLevel`s.
        :return: A `ResultSet`.
        """

    def getNotificationRecipients():
        """Return a complete INotificationRecipientSet instance.

        The INotificationRecipientSet instance contains the subscribers
        and their subscriptions.
        """

    landing_targets = Attribute(
        "A collection of the merge proposals where this repository is "
        "the source.")
    _api_landing_targets = exported(
        CollectionField(
            title=_("Landing targets"),
            description=_(
                "A collection of the merge proposals where this repository is "
                "the source."),
            readonly=True,
            # Really IBranchMergeProposal, patched in
            # _schema_circular_imports.py.
            value_type=Reference(Interface)),
        exported_as="landing_targets")
    landing_candidates = Attribute(
        "A collection of the merge proposals where this repository is "
        "the target.")
    _api_landing_candidates = exported(
        CollectionField(
            title=_("Landing candidates"),
            description=_(
                "A collection of the merge proposals where this repository is "
                "the target."),
            readonly=True,
            # Really IBranchMergeProposal, patched in
            # _schema_circular_imports.py.
            value_type=Reference(Interface)),
        exported_as="landing_candidates")
    dependent_landings = exported(
        CollectionField(
            title=_("Dependent landings"),
            description=_(
                "A collection of the merge proposals that are dependent on this "
                "repository."),
            readonly=True,
            # Really IBranchMergeProposal, patched in _schema_circular_imports.py.
            value_type=Reference(Interface)))

    def getPrecachedLandingTargets(user):
        """Return precached landing targets.

        Target and prerequisite repositories are preloaded.
        """

    def getPrecachedLandingCandidates(user):
        """Return precached landing candidates.

        Source and prerequisite repositories are preloaded.
        """

    @operation_parameters(
        status=List(title=_("A list of merge proposal statuses to filter by."),
                    value_type=Choice(vocabulary=BranchMergeProposalStatus)),
        merged_revision_ids=List(
            TextLine(title=_('The target revision ID of the merge.'))))
    @call_with(visible_by_user=REQUEST_USER)
    # Really IBranchMergeProposal, patched in _schema_circular_imports.py.
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    @operation_for_version("devel")
    def getMergeProposals(status=None,
                          visible_by_user=None,
                          merged_revision_ids=None,
                          eager_load=False):
        """Return matching BranchMergeProposals."""

    def getMergeProposalByID(id):
        """Return this repository's merge proposal with this id, or None."""

    def isRepositoryMergeable(other):
        """Is the other repository mergeable into this one (or vice versa)?"""

    pending_updates = Attribute(
        "Whether there are recent changes in this repository that have not "
        "yet been scanned.")

    def updateMergeCommitIDs(paths):
        """Update commit SHA1s of merge proposals for this repository.

        The *_git_commit_sha1 columns of merge proposals are stored
        explicitly in order that merge proposals are still meaningful after
        associated refs have been deleted.  However, active merge proposals
        where the refs in question still exist should have these columns
        kept up to date.
        """

    def updateLandingTargets(paths):
        """Update landing targets (MPs where this repository is the source).

        For each merge proposal, create `UpdatePreviewDiffJob`s.

        :param paths: A list of reference paths.  Any merge proposals whose
            source is this repository and one of these paths will have their
            diffs updated.
        """

    def markRecipesStale(paths):
        """Mark recipes associated with this repository as stale.

        :param paths: A list of reference paths.  Any recipes that include
            an entry that points to this repository and that have a
            `revspec` that is one of these paths will be marked as stale.
        """

    def markSnapsStale(paths):
        """Mark snap packages associated with this repository as stale.

        :param paths: A list of reference paths.  Any snap packages that
            include an entry that points to this repository and that are
            based on one of these paths will be marked as stale.
        """

    def detectMerges(paths, logger=None):
        """Detect merges of landing candidates.

        :param paths: A list of reference paths.  Any merge proposals whose
            target is this repository and one of these paths will be
            checked.
        :param logger: An optional logger.
        """

    def getBlob(filename, rev=None):
        """Get a blob by file name from this repository.

        :param filename: Relative path of a file in the repository.
        :param rev: An optional revision. Defaults to 'HEAD'.
        :return: A binary string with the blob content.
        """

    def getDiff(old, new):
        """Get the diff between two commits in this repository.

        :param old: The OID of the old commit.
        :param new: The OID of the new commit.
        :return: The diff as a binary string.
        """

    def getRule(ref_pattern):
        """Get the access rule for this repository with a given pattern.

        :param ref_pattern: The reference pattern that the rule should have.
        :return: An `IGitRule`, or None.
        """

    def getActivity(changed_after=None):
        """Get activity log entries for this repository.

        :param changed_after: If supplied, only return entries for changes
            made after this date.
        :return: A `ResultSet` of `IGitActivity`.
        """

    def getPrecachedActivity(**kwargs):
        """Activity log entries are preloaded.
Exemplo n.º 6
0
class IBinaryPackageBuildView(IPackageBuild):
    """A Build interface for items requiring launchpad.View."""
    id = Int(title=_('ID'), required=True, readonly=True)

    # Overridden from IBuildFarmJob to ensure required is True.
    processor = Reference(
        title=_("Processor"),
        schema=IProcessor,
        required=True,
        readonly=True,
        description=_("The Processor where this build should be built."))

    source_package_release = Reference(
        title=_('Source'),
        schema=ISourcePackageRelease,
        required=True,
        readonly=True,
        description=_("The SourcePackageRelease requested to build."))

    source_package_release_id = Int()

    distro_arch_series = Reference(
        title=_("Architecture"),
        # Really IDistroArchSeries
        schema=Interface,
        required=True,
        readonly=True,
        description=_("The DistroArchSeries context for this build."))

    distro_arch_series_id = Int()

    # Properties
    current_source_publication = exported(
        Reference(
            title=_("Source publication"),
            schema=ISourcePackagePublishingHistory,
            required=False,
            readonly=True,
            description=_("The current source publication for this build.")))

    distro_series = Attribute("Direct parent needed by CanonicalURL")
    arch_tag = exported(Text(title=_("Architecture tag"), required=False))
    distributionsourcepackagerelease = Attribute(
        "The page showing the "
        "details for this sourcepackagerelease in this distribution.")
    binarypackages = Attribute(
        "A list of binary packages that resulted from this build, "
        "not limited and ordered by name.")
    distroarchseriesbinarypackages = Attribute(
        "A list of distroarchseriesbinarypackages that resulted from this"
        "build, ordered by name.")

    can_be_rescored = exported(
        Bool(title=_("Can Be Rescored"),
             required=False,
             readonly=True,
             description=_("Whether or not this build record can be rescored "
                           "manually.")))

    can_be_retried = exported(
        Bool(
            title=_("Can Be Retried"),
            required=False,
            readonly=True,
            description=_("Whether or not this build record can be retried.")))

    can_be_cancelled = exported(
        Bool(title=_("Can Be Cancelled"),
             required=False,
             readonly=True,
             description=_(
                 "Whether or not this build record can be cancelled.")))

    is_virtualized = Attribute(
        "Whether or not this build requires a virtual build host or not.")

    upload_changesfile = Attribute(
        "The `LibraryFileAlias` object containing the changes file which "
        "was originally uploaded with the results of this build. It's "
        "'None' if it is build imported by Gina.")

    changesfile_url = exported(
        TextLine(title=_("Changes File URL"),
                 required=False,
                 description=_(
                     "The URL for the changes file for this build. "
                     "Will be None if the build was imported by Gina.")))

    package_upload = Attribute(
        "The `PackageUpload` record corresponding to the original upload "
        "of the binaries resulted from this build. It's 'None' if it is "
        "a build imported by Gina.")

    api_score = exported(Int(
        title=_("Score of the related job (if any)"),
        readonly=True,
    ),
                         exported_as="score")

    def updateDependencies():
        """Update the build-dependencies line within the targeted context."""

    def __getitem__(name):
        """Mapped to getBinaryPackageRelease."""

    def getBinaryPackageRelease(name):
        """Return the binary package from this build with the given name, or
        raise NotFoundError if no such package exists.
        """

    def createBinaryPackageRelease(binarypackagename,
                                   version,
                                   summary,
                                   description,
                                   binpackageformat,
                                   component,
                                   section,
                                   priority,
                                   installedsize,
                                   architecturespecific,
                                   shlibdeps=None,
                                   depends=None,
                                   recommends=None,
                                   suggests=None,
                                   conflicts=None,
                                   replaces=None,
                                   provides=None,
                                   pre_depends=None,
                                   enhances=None,
                                   breaks=None,
                                   essential=False,
                                   debug_package=None,
                                   user_defined_fields=None,
                                   homepage=None):
        """Create and return a `BinaryPackageRelease`.

        The binarypackagerelease will be attached to this specific build.
        """

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

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

         * Binary changesfile: '.changes';
         * Build logs: '.txt.gz';
         * Build upload logs: '_log.txt';

        :param filename: exactly filename to be looked up.

        :raises AssertionError if the given filename contains a unsupported
            filename and/or extension, see the list above.
        :raises NotFoundError if no file could not be found.

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

    def getBinaryPackageFileByName(filename):
        """Return the corresponding `IBinaryPackageFile` in this context.

        :param filename: the filename to look up.
        :return: the corresponding `IBinaryPackageFile` if it was found.
        """

    def getBinaryPackageNamesForDisplay():
        """Retrieve the build's binary package names for display purposes.

        :return: a result set of
            (`IBinaryPackageRelease`, `IBinaryPackageName`) ordered by name
            and `IBinaryPackageRelease.id`.
        """

    def getBinaryFilesForDisplay():
        """Retrieve the build's `IBinaryPackageFile`s for display purposes.
Exemplo n.º 7
0
class IDirectoryBase(IDirectoryRoot):
    """Container for all directory items."""

    title = TextLine(title=_(u'Name'), )

    subtitle = TextLine(title=_(u'Subtitle'), required=False)

    description = Text(title=_(u'Description'), required=False, default=u'')

    cat1 = TextLine(title=_(u'1st Category Name'), required=False, default=u'')

    cat1_suggestions = List(
        title=_(u'Suggested Values for the 1st Category'),
        required=False,
        description=_(
            u'These values are suggested when typing category values in the '
            u'category items, in addition to values found in other items.'),
        value_type=TextLine(),
    )

    cat2 = TextLine(title=_(u'2nd Category Name'), required=False, default=u'')

    cat2_suggestions = List(
        title=_(u'Suggested Values for the 2nd Category'),
        required=False,
        description=_(
            u'These values are suggested when typing category values in the '
            u'category items, in addition to values found in other items.'),
        value_type=TextLine(),
    )

    cat3 = TextLine(title=_(u'3rd Category Name'), required=False, default=u'')

    cat3_suggestions = List(
        title=_(u'Suggested Values for the 3rd Category'),
        required=False,
        description=_(
            u'These values are suggested when typing category values in the '
            u'category items, in addition to values found in other items.'),
        value_type=TextLine(),
    )

    cat4 = TextLine(title=_(u'4th Category Name'), required=False, default=u'')

    cat4_suggestions = List(
        title=_(u'Suggested Values for the 4th Category'),
        required=False,
        description=_(
            u'These values are suggested when typing category values in the '
            u'category items, in addition to values found in other items.'),
        value_type=TextLine(),
    )

    enable_filter = Bool(title=_(u'Enable filtering'),
                         required=True,
                         default=True)

    enable_search = Bool(title=_(u'Enable searching'),
                         required=True,
                         default=True)

    enable_map = Bool(title=_(u'Enable the map'), required=True, default=True)

    allow_custom_categories = Bool(
        title=_(u'Allow custom categories'),
        description=_(
            u'If custom categories are allowed, items may specify new '
            u'categories. If they are not allowed, people can only choose '
            u'from the given suggestions.'),
        required=True,
        default=True,
    )
Exemplo n.º 8
0
class IItem(Interface):
    """TODO item"""

    subject = Text(required=False)

    closed = Bool(default=False, required=False)
Exemplo n.º 9
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))
    displayname = exported(
        TextLine(
            title=_("Display Name"),
            description=_("The displayable name of the distribution."),
            required=True),
        exported_as='display_name')
    title = exported(
        Title(
            title=_("Title"),
            description=_("The distro's title."), required=True))
    summary = exported(
        Summary(
            title=_("Summary"),
            description=_(
                "A short paragraph to introduce the goals and highlights "
                "of the distribution."),
            required=True))
    homepage_content = exported(
        Text(
            title=_("Homepage Content"), required=False,
            description=_(
                "The content of this distribution's home page. Edit this and "
                "it will be displayed for all the world to see. It is NOT a "
                "wiki so you cannot undo changes.")))
    icon = exported(
        IconImageUpload(
            title=_("Icon"), required=False,
            default_image_resource='/@@/distribution',
            description=_(
                "A small image of exactly 14x14 pixels and at most 5kb in "
                "size, that can be used to identify this distribution. The "
                "icon will be displayed everywhere we list the distribution "
                "and link to it.")))
    logo = exported(
        LogoImageUpload(
            title=_("Logo"), required=False,
            default_image_resource='/@@/distribution-logo',
            description=_(
                "An image of exactly 64x64 pixels that will be displayed in "
                "the heading of all pages related to this distribution. It "
                "should be no bigger than 50kb in size.")))
    mugshot = exported(
        MugshotImageUpload(
            title=_("Brand"), required=False,
            default_image_resource='/@@/distribution-mugshot',
            description=_(
                "A large image of exactly 192x192 pixels, that will be "
                "displayed on this distribution's home page in Launchpad. "
                "It should be no bigger than 100kb in size. ")))
    description = exported(
        Description(
            title=_("Description"),
            description=_(
                "Details about the distributions's work, highlights, goals, "
                "and how to contribute. Use plain text, paragraphs are "
                "preserved and URLs are linked in pages. Don't repeat the "
                "Summary."),
            required=True))
    domainname = exported(
        TextLine(
            title=_("Web site URL"),
            description=_("The distro's web site URL."), required=True),
        exported_as='domain_name')
    owner = exported(
        PublicPersonChoice(
            title=_("Owner"),
            required=True,
            vocabulary='ValidPillarOwner',
            description=_("The restricted team, moderated team, or person "
                          "who maintains the distribution information in "
                          "Launchpad.")))
    registrant = exported(
        PublicPersonChoice(
            title=_("Registrant"), vocabulary='ValidPersonOrTeam',
            description=_("The distro's registrant."), required=True,
            readonly=True))
    date_created = exported(
        Datetime(title=_('Date created'),
                 description=_("The date this distribution was registered.")))
    driver = exported(
        PublicPersonChoice(
            title=_("Driver"),
            description=_(
                "The person or team responsible for decisions about features "
                "and bugs that will be targeted for any series in this "
                "distribution. Note that you can also specify a driver "
                "on each series whose permissions will be limited to that "
                "specific series."),
            required=False, vocabulary='ValidPersonOrTeam'))
    drivers = Attribute(
        "Presents the distro driver as a list for consistency with "
        "IProduct.drivers where the list might include a project driver.")
    members = exported(PublicPersonChoice(
        title=_("Members"),
        description=_("The distro's members team."), required=True,
        vocabulary='ValidPersonOrTeam'))
    mirror_admin = exported(PublicPersonChoice(
        title=_("Mirror Administrator"),
        description=_("The person or team that has the rights to review and "
                      "mark this distribution's mirrors as official."),
        required=True, vocabulary='ValidPersonOrTeam'))
    archive_mirrors = exported(doNotSnapshot(
        CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror))))
    archive_mirrors_by_country = doNotSnapshot(CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror)))
    cdimage_mirrors = exported(doNotSnapshot(
        CollectionField(
            description=_("All enabled and official RELEASE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror))))
    cdimage_mirrors_by_country = doNotSnapshot(CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror)))
    disabled_mirrors = Attribute(
        "All disabled and official mirrors of this Distribution.")
    unofficial_mirrors = Attribute(
        "All unofficial mirrors of this Distribution.")
    pending_review_mirrors = Attribute(
        "All mirrors of this Distribution that haven't been reviewed yet.")
    series = exported(doNotSnapshot(
        CollectionField(
            title=_("DistroSeries inside this Distribution"),
            # Really IDistroSeries, see _schema_circular_imports.py.
            value_type=Reference(schema=Interface))))
    derivatives = exported(doNotSnapshot(
        CollectionField(
            title=_("This Distribution's derivatives"),
            # Really IDistroSeries, see _schema_circular_imports.py.
            value_type=Reference(schema=Interface))))
    architectures = List(
        title=_("DistroArchSeries inside this Distribution"))
    uploaders = Attribute(_(
        "ArchivePermission records for uploaders with rights to upload to "
        "this distribution."))
    package_derivatives_email = TextLine(
        title=_("Package Derivatives Email Address"),
        description=_(
            "The email address to send information about updates to packages "
            "that are derived from another distribution. The sequence "
            "{package_name} is replaced with the actual package name."),
        required=False)

    # properties
    currentseries = exported(
        Reference(
            # Really IDistroSeries, see _schema_circular_imports.py.
            Interface,
            title=_("Current series"),
            description=_(
                "The current development series of this distribution. "
                "Note that all maintainerships refer to the current "
                "series. When people ask about the state of packages "
                "in the distribution, we should interpret that query "
                "in the context of the currentseries.")),
        exported_as="current_series")

    full_functionality = Attribute(
        "Whether or not we enable the full functionality of Launchpad for "
        "this distribution. Currently only Ubuntu and some derivatives "
        "get the full functionality of LP")

    translation_focus = Choice(
        title=_("Translation focus"),
        description=_(
            "The release series that translators should focus on."),
        required=False,
        vocabulary='FilteredDistroSeries')

    language_pack_admin = Choice(
        title=_("Language Pack Administrator"),
        description=_("The distribution language pack administrator."),
        required=False, vocabulary='ValidPersonOrTeam')

    main_archive = exported(
        Reference(
            title=_('Distribution Main Archive.'), readonly=True,
            # Really IArchive, see _schema_circular_imports.py.
            schema=Interface))

    all_distro_archives = exported(doNotSnapshot(
        CollectionField(
            title=_(
                "A sequence of the distribution's primary, "
                "partner and debug archives."),
            readonly=True, required=False,
            value_type=Reference(schema=Interface))),
                # Really IArchive, see _schema_circular_imports.py.
        exported_as='archives')

    all_distro_archive_ids = Attribute(
        "A list containing the IDs of all the non-PPA archives.")

    has_published_binaries = Bool(
        title=_("Has Published Binaries"),
        description=_("True if this distribution has binaries published "
                      "on disk."),
        readonly=True, required=False)

    has_published_sources = Bool(
        title=_("Has Published Sources"),
        description=_("True if this distribution has sources published."),
        readonly=True, required=False)

    redirect_release_uploads = exported(Bool(
        title=_("Redirect release pocket uploads"),
        description=_("Redirect release pocket uploads to proposed pocket"),
        readonly=False, required=True))

    development_series_alias = exported(DistroSeriesNameField(
        title=_("Alias for development series"),
        description=_(
            "If set, an alias for the current development series in this "
            "distribution."),
        constraint=name_validator, readonly=False, required=False))

    def getArchiveIDList(archive=None):
        """Return a list of archive IDs suitable for sqlvalues() or quote().

        If the archive param is supplied, just its ID will be returned in
        a list of one item.  If it is not supplied, return a list of
        all the IDs for all the archives for the distribution.
        """

    def __getitem__(name):
        """Returns a DistroSeries that matches name, or raises and
        exception if none exists."""

    def __iter__():
        """Iterate over the series for this distribution."""

    @operation_parameters(
        name=TextLine(title=_("Archive name"), required=True))
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getArchive(name):
        """Return the distribution archive with the given name.

        Only distribution archives are considered -- PPAs will not be found.

        :param name: The name of the archive, e.g. 'partner'
        """

    # Really IDistroSeries, see _schema_circular_imports.py.
    @operation_returns_collection_of(Interface)
    @export_operation_as(name="getDevelopmentSeries")
    @export_read_operation()
    def getDevelopmentSeries():
        """Return the DistroSeries which are marked as in development."""

    def resolveSeriesAlias(name):
        """Resolve a series alias.

        :param name: The name to resolve.
        :raises NoSuchDistroSeries: If there is no match.
        """

    @operation_parameters(
        name_or_version=TextLine(title=_("Name or version"), required=True))
    # Really IDistroSeries, see _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @call_with(follow_aliases=True)
    @export_read_operation()
    def getSeries(name_or_version, follow_aliases=False):
        """Return the series with the name or version given.

        :param name_or_version: The `IDistroSeries.name` or
            `IDistroSeries.version`.
        """

    # This API is specifically for Ensemble's Principia.  It does not scale
    # well to distributions of Ubuntu's scale, and is not intended for it.
    # Therefore, this should probably never be exposed for a webservice
    # version other than "devel".
    @operation_parameters(
        since=Datetime(
            title=_("Time of last change"),
            description=_(
                "Return branches that have new tips since this timestamp."),
            required=False))
    @call_with(user=REQUEST_USER)
    @export_operation_as(name="getBranchTips")
    @export_read_operation()
    @operation_for_version('devel')
    def getBranchTips(user=None, since=None):
        """Return a list of branches which have new tips since a date.

        Each branch information is a tuple of (branch_unique_name,
        tip_revision, (official_series*)).

        So for each branch in the distribution, you'll get the branch unique
        name, the revision id of tip, and if the branch is official for some
        series, the list of series name.

        :param: user: If specified, shows the branches visible to that user.
            if not specified, only branches visible to the anonymous user are
            shown.

        :param since: If specified, limits results to branches modified since
            that date and time.
        """

    @operation_parameters(
        name=TextLine(title=_("Name"), required=True))
    @operation_returns_entry(IDistributionMirror)
    @export_read_operation()
    def getMirrorByName(name):
        """Return the mirror with the given name for this distribution or None
        if it's not found.
        """

    @operation_parameters(
        country=copy_field(IDistributionMirror['country'], required=True),
        mirror_type=copy_field(IDistributionMirror['content'], required=True))
    @operation_returns_entry(IDistributionMirror)
    @export_read_operation()
    def getCountryMirror(country, mirror_type):
        """Return the country DNS mirror for a country and content type."""

    def newMirror(owner, speed, country, content, displayname=None,
                  description=None, http_base_url=None,
                  ftp_base_url=None, rsync_base_url=None, enabled=False,
                  official_candidate=False, whiteboard=None):
        """Create a new DistributionMirror for this distribution.

        At least one of http_base_url or ftp_base_url must be provided in
        order to create a mirror.
        """

    @operation_parameters(
        name=TextLine(title=_("Package name"), required=True))
    # Really returns IDistributionSourcePackage, see
    # _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getSourcePackage(name):
        """Return a DistributionSourcePackage with the given name for this
        distribution, or None.
        """

    def getSourcePackageRelease(sourcepackagerelease):
        """Returns an IDistributionSourcePackageRelease

        Receives a sourcepackagerelease.
        """

    def getCurrentSourceReleases(source_package_names):
        """Get the current release of a list of source packages.

        :param source_package_names: a list of `ISourcePackageName`
            instances.

        :return: a dict where the key is a `IDistributionSourcePackage`
            and the value is a `IDistributionSourcePackageRelease`.
        """

    def getDistroSeriesAndPocket(distroseriesname, follow_aliases=False):
        """Return a (distroseries,pocket) tuple which is the given textual
        distroseriesname in this distribution."""

    def getSeriesByStatus(status):
        """Query context distribution for distroseries with a given status.

        :param status: Series status to look for
        :return: list of `IDistroSeries`
        """

    @rename_parameters_as(text="source_match")
    @operation_parameters(
        text=TextLine(title=_("Source package name substring match"),
                      required=True))
    # Really returns IDistributionSourcePackage, see
    # _schema_circular_imports.py.
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def searchSourcePackages(
        text, has_packaging=None, publishing_distroseries=None):
        """Search for source packages that correspond to the given text.

        This method just decorates the result of searchSourcePackageCaches()
        to return DistributionSourcePackages.
        """

    def searchSourcePackageCaches(
        text, has_packaging=None, publishing_distroseries=None):
        """Search for source packages that correspond to the given text.

        :param text: The text that will be matched.
        :param has_packaging: If True, it will filter out
            packages with no packaging (i.e. no link to the upstream
            project). False will do the reverse filtering, and None
            will do no filtering on this field.
        :param publishing_distroseries: If it is not None, then
            it will filter out source packages that do not have a
            publishing history for the given distroseries.
        :return: A result set containing
            (DistributionSourcePackageCache, SourcePackageName, rank) tuples
            ordered by rank.
        """

    def searchBinaryPackages(package_name, exact_match=False):
        """Search for binary packages in this distribution.

        :param package_name: The binary package name to match.
        :param exact_match: If False, substring matches are done on the
            binary package names; if True only a full string match is
            returned.
        :return: A result set containing appropriate DistributionSourcePackage
            objects for the matching source.

        The returned results will consist of source packages that match
        (a substring of) their binary package names.
        """

    def guessPublishedSourcePackageName(pkgname):
        """Return the "published" SourcePackageName related to pkgname.

        If pkgname corresponds to a source package that was published in
        any of the distribution series, that's the SourcePackageName that is
        returned.

        If there is any official source package branch linked, then that
        source package name is returned.

        Otherwise, try to find a published binary package name and then return
        the source package name from which it comes from.

        :raises NotFoundError: when pkgname doesn't correspond to either a
            published source or binary package name in this distribution.
        """

    def getAllPPAs():
        """Return all PPAs for this distribution."""

    def searchPPAs(text=None, show_inactive=False):
        """Return all PPAs matching the given text in this distribution.

        'text', when passed, will restrict results to Archives with matching
        description (using substring) or matching Archive.owner (using
        available person fti/ftq).

        'show_inactive', when False, will restrict results to Archive with
        at least one source publication in PENDING or PUBLISHED status.
        """

    def getPendingAcceptancePPAs():
        """Return only pending acceptance PPAs in this distribution."""

    def getPendingPublicationPPAs():
        """Return all PPAs in this distribution that are pending publication.

        A PPA is said to be pending publication if it has publishing records
        in the pending state or if it had packages deleted from it.
        """

    def getArchiveByComponent(component_name):
        """Return the archive most appropriate for the component name.

        Where different components may imply a different archive (e.g.
        partner), this method will return the archive for that component.

        If the component_name supplied is unknown, None is returned.
        """

    def getAllowedBugInformationTypes():
        """Get the information types that a bug in this distribution can have.

        :return: A sequence of `InformationType`s.
        """

    def getDefaultBugInformationType():
        """Get the default information type of a new bug in this distro.

        :return: The `InformationType`.
        """

    def userCanEdit(user):
        """Can the user edit this distribution?"""
Exemplo n.º 10
0
class ICKEditorBaseSchema(Interface):
    """
    CKEditor Base fieldset schema
    """

    forcePasteAsPlainText = Bool(
        title=_(u"Force paste as plain text"),
        description=_(u"Choose if you want to remove format on copy/paste, "
                      "and paste only text and CR/LF"),
        default=False,
        required=False)

    toolbar = Choice(
        title=_(u"Toolbar"),
        description=_(u"Choose the editor toolbar, "
                      "edit the next field if you choose a Custom toolbar'."),
        required=True,
        default='Plone',
        vocabulary="collective.ckeditor.vocabularies.toolbar")

    toolbar_Custom = Text(
        title=_(u"Customized Toolbar"),
        description=_(u"Build your own CKEditor Toolbar. "
                      "Take care with the javascript syntax. "
                      "If you want to add new plugins, "
                      "add new buttons here if needed."),
        required=False)

    filtering = Choice(
        title=_(u"Filtering"),
        description=_(
            u"Setup of Advanced Content Filter. "
            u"Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter"
        ),
        required=True,
        default='default',
        vocabulary="collective.ckeditor.vocabularies.filtering")

    customAllowedContent = Text(
        title=_(u"Custom Allowed Content"),
        description=_(
            u"Configuration of custom filtering. "
            u"Taken in account only if Filtering option is 'Custom'. "
            u"Use Javascript syntax. Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules"
        ),
        required=False)

    extraAllowedContent = Text(
        title=_(u"Extra Allowed Content"),
        description=_(
            u"Extra rules on top of automatic filtering. "
            u"Taken in account only if Filtering option is 'Automatic'. "
            u"Use Javascript syntax. Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules"
        ),
        required=False)

    menuStyles = Text(
        title=_(u"Menu styles"),
        description=_(u"Build your own CKEditor menu styles Combo box. "
                      u"Take care with the javascript syntax. "
                      u"If you want to use css classes or ids, "
                      u"the attributes must exist in your css."),
        required=True)

    bodyId = TextLine(
        title=_(u"Area Body Id"),
        description=_(u"Enter the css id applied to the "
                      "body tag of the editor area"),
        default=u'content',
        required=False)

    plugins = List(
        title=_(u"Plugins"),
        description=_(u"Plugin format is 'id;relative path'."),
        value_type=TextLine(),
        required=False)

    removePlugins = List(
        title=_(u"Plugins to remove"),
        description=_(u"Plugin format is 'id'."),
        value_type=TextLine(),
        required=False)

    bodyClass = TextLine(
        title=_(u"Area Body Class"),
        description=_(u"Enter the css class name applied to the "
                      "body tag of the editor area"),
        required=False)

    customTemplates = List(
        title=_(u"Custom templates"),
        description=_(u"URLs of Javascript "
                      "files that register custom templates"),
        value_type=TextLine(),
        required=False)

    templatesReplaceContent = Bool(
        title=_(u"Templates will replace the current contents "
                "of the visual editor window"),
        description=_(u"Choose if you want templates to replace "
                      "the contents when inserted"),
        default=False,
        required=False)

    enableScaytOnStartup = Bool(
        title=_(u"Enable SCAYT on startup"),
        description=_(u"Choose if you want SCAYT to be automatically "
                      "enabled while the editor is loaded.  This will only "
                      "be the case if a relevant language can be used "
                      "in SCAYT availble ones."),
        default=False,
        required=False)

    defaultTableWidth = TextLine(
        title=_(u"Default Table Width"),
        description=_(u"Enter the default table width"),
        default=u"500px",
        required=False)
Exemplo n.º 11
0
class IPackageCopyRequest(Interface):
    """A Build interface"""

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

    target_archive = Object(
        title=_("Target archive"),
        schema=IArchive,
        required=True,
        readonly=True,
        description=_("The archive to which packages will be copied."))

    target_distroseries = Object(title=_("Target distroseries"),
                                 schema=IDistroSeries,
                                 required=False,
                                 readonly=True,
                                 description=_("The target DistroSeries."))

    target_component = Object(title=_("Target component"),
                              schema=IComponent,
                              required=False,
                              readonly=True,
                              description=_("The target component."))

    target_pocket = Choice(title=_('Target pocket'),
                           required=False,
                           vocabulary=PackagePublishingPocket,
                           description=_("The target pocket."))

    copy_binaries = Bool(
        title=_('Copy binaries'),
        required=True,
        default=False,
        description=_("Whether binary packages should be copied as well."))

    source_archive = Object(
        title=_("Source archive"),
        schema=IArchive,
        required=True,
        readonly=True,
        description=_("The archive from which packages will be copied."))

    source_distroseries = Object(title=_("Source distroseries"),
                                 schema=IDistroSeries,
                                 required=False,
                                 readonly=True,
                                 description=_("The source DistroSeries."))

    source_component = Object(title=_("Source component"),
                              schema=IComponent,
                              required=False,
                              readonly=True,
                              description=_("The source component."))

    source_pocket = Choice(title=_('Source pocket'),
                           required=False,
                           vocabulary=PackagePublishingPocket,
                           description=_("The source pocket."))

    requester = Object(
        title=_("Requester"),
        schema=IPerson,
        required=True,
        readonly=True,
        description=_("The person who requested the package copy operation."))

    status = Choice(title=_('Copy status'),
                    required=True,
                    vocabulary=PackageCopyStatus,
                    description=_("The current status of the copy operation."))

    reason = Text(title=_('Reason'),
                  required=False,
                  description=_("The reason for this package copy operation."))

    date_created = Datetime(
        title=_('Date created'),
        required=True,
        readonly=True,
        description=_("The time when the package copy request was created."))

    date_started = Datetime(
        title=_('Date started'),
        required=False,
        readonly=False,
        description=_("The time when the copy request processing started."))

    date_completed = Datetime(
        title=_('Date completed'),
        required=False,
        readonly=False,
        description=_("The time when the copy request processing completed."))

    def __str__():
        """Return a textual representation of the package copy request."""

    def markAsInprogress():
        """Mark this request as being in progress.

        Update the 'status' and 'date_started' properties as appropriate.
        """

    def markAsCompleted():
        """Mark this request as completed.

        Update the 'status' and 'date_completed' properties as appropriate.
        """

    def markAsFailed():
        """Mark this request as failed.

        Update the 'status' and 'date_completed' properties as appropriate.
        """

    def markAsCanceling():
        """Mark this request as canceling.

        Update the 'status' as appropriate.
        """

    def markAsCancelled():
        """Mark this request as cancelled.
class IAceProject(form.Schema, IImageScaleTraversable):
    """
    Defines content-type schema for Ace Project
    """

    title = TextLine(
        title=_(u"Title"),
        description=_(u"Project title or name"),
        required=True,
    )

    acronym = TextLine(
        title=_(u"Acronym"),
        description=_(u"Acronym of the project"),
        required=True,
    )

    lead = TextLine(
        title=_(u"Lead"),
        description=_(u"Lead organisation of the project"),
        required=False,
    )

    website = TextLine(
        title=_(u"Website"),
        description=_(u"Project website"),
        required=False,
    )

    dexteritytextindexer.searchable('abstracts')
    abstracts = RichText(
        title=_(u"Abstracts"),
        description=_(u"Project abstracts"),
        required=False,
    )

    dexteritytextindexer.searchable('partners')
    partners = RichText(
        title=_(u"Partners"),
        description=_(u"Information about project partners"),
        required=False,
    )

    dexteritytextindexer.searchable('keywords')
    keywords = RichText(
        title=_(u"Keywords"),
        description=_(u"Keywords related to the project"),
        required=False,
    )

    sectors = List(
        title=_(u"Sectors"),
        description=_(u"EU policy sectors"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_sectors", ),
    )

    elements = List(
        title=_(u"Elements"),
        description=_(u"Adaptation element"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_elements", ),
    )

    climate_impacts = List(
        title=_(u"Climate impacts"),
        description=_(u"Climate impacts"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts", ),
    )

    funding = TextLine(
        title=_(u"Funding"),
        description=_(u"Source of funding"),
        required=False,
    )

    duration = TextLine(
        title=_(u"Duration"),
        description=_(u"Duration of project"),
        required=False,
    )

    dexteritytextindexer.searchable('source')
    source = RichText(
        title=_(u"Source"),
        description=_(u"Source from which project was retrieved"),
        required=False)

    specialtagging = TextLine(
        title=_(u"Special Tagging"),
        description=_(u"Special tags that allow for linking the item"),
        required=False)

    geochars = Text(title=_(u"Geochars"),
                    description=_(u"Characterisation of the area"),
                    required=False)

    comments = TextLine(title=_(u"Source"),
                        description=_(u"Any comments provided with the item"),
                        required=False)

    important = Bool(title=_(u"Important"), required=False, default=False)

    rating = Int(title=_(u"Rating"), required=True, default=0)

    spatial_layer = TextLine(title=_(u"Spatial Layer"),
                             required=False,
                             default=u"")

    spatial_values = List(
        title=_(u"Countries"),
        description=_(u"European countries"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.ace_countries"))
Exemplo n.º 13
0
class IMessageApproval(Interface):
    """A held message."""

    message_id = Text(
        title=_('Message-ID'),
        description=_('The RFC 2822 Message-ID header.'),
        required=True, readonly=True)

    posted_by = PublicPersonChoice(
        title=_('Posted by'),
        description=_('The Launchpad member who posted the message.'),
        vocabulary='ValidPersonOrTeam',
        required=True, readonly=True)

    posted_message = Object(
        schema=ILibraryFileAlias,
        title=_('Posted message'),
        description=_('An alias to the posted message in the librarian.'),
        required=True, readonly=True)

    message = Object(
        schema=IMessage,
        title=_('The posted message object'),
        description=_('The posted message'),
        required=True, readonly=True)

    posted_date = Datetime(
        title=_('Date posted'),
        description=_('The date this message was posted.'),
        required=True, readonly=True)

    mailing_list = Object(
        schema=IMailingList,
        title=_('The mailing list'),
        description=_('The mailing list this message was posted to.'),
        required=True, readonly=True)

    status = Choice(
        title=_('Status'),
        description=_('The status of the held message.'),
        vocabulary='PostedMessageStatus',
        required=True)

    disposed_by = PublicPersonChoice(
        title=_('Approved or rejected by'),
        description=_('The person who approved or rejected this message.'),
        vocabulary='ValidPersonOrTeam',
        required=False)

    disposal_date = Datetime(
        title=_('Date approved or rejected'),
        description=_('The date this message was approved or rejected.'),
        required=False)

    def approve(reviewer):
        """Approve the message.

        Set the status to APPROVAL_PENDING, indicating that the reviewer has
        chosen to approve the message, but that Mailman has not yet
        acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def reject(reviewer):
        """Reject the message.

        Set the status to REJECTION_PENDING, indicating that the reviewer has
        chosen to reject (i.e. bounce) the message, but that Mailman has not
        yet acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def discard(reviewer):
        """Discard the message.

        Set the status to DISCARD_PENDING, indicating that the reviewer has
        chosen to discard the message, but that Mailman has not yet
        acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def acknowledge():
        """Acknowledge the pending status of a message.
Exemplo n.º 14
0
class IMailingList(Interface):
    """A mailing list."""

    team = PublicPersonChoice(
        title=_('Team'),
        description=_('The team that this mailing list is associated with.'),
        vocabulary='ValidTeam',
        required=True, readonly=True)

    registrant = PublicPersonChoice(
        title=_('Registrant'),
        description=_('The person who registered the mailing list.'),
        vocabulary='ValidPersonOrTeam',
        required=True, readonly=True)

    date_registered = Datetime(
        title=_('Registration date'),
        description=_('The date on which this mailing list was registered.'),
        required=True, readonly=True)

    # Mailing lists are auto-approved now so these fields are no longer used,
    # but we won't drop the columns from the database because they might be
    # useful for the historical record.
    reviewer = PublicPersonChoice(
        title=_('Reviewer'),
        description=_(
            'The person who reviewed this mailing list registration, or '
            'None if the registration has not yet been reviewed.'),
        vocabulary='ValidPersonOrTeam')

    date_reviewed = Datetime(
        title=_('Review date'),
        description=_('The date on which this mailing list registration was '
                      'reviewed, or None if the registration has not yet '
                      'been reviewed.'))

    date_activated = Datetime(
        title=_('Activation date'),
        description=_('The date on which this mailing list was activated, '
                      'meaning that the Mailman process has successfully '
                      'created it.  This may be None if the mailing list '
                      'has not yet been activated, or that its activation '
                      'has failed.'))

    status = Choice(
        title=_('Status'),
        description=_('The status of the mailing list.'),
        vocabulary='MailingListStatus',
        required=True,
        )

    welcome_message = Text(
        title=_('Welcome message text'),
        description=_('Any instructions or links that should be sent to new '
                      'subscribers to this mailing list.'),
        required=False,
        )

    address = TextLine(
        title=_("This list's email address."),
        description=_(
            "The text representation of this team's email address."),
        required=True,
        readonly=True)

    archive_url = TextLine(
        title=_("The url to the list's archives"),
        description=_(
            'This is the url to the archive if the mailing list has ever '
            'activated.  Such a list, even if now inactive, may still have '
            'an archive.  If the list has never been activated, this will '
            'be None.'),
        readonly=True)

    is_public = Bool(
        title=_('Is this mailing list, and its team, public?'),
        readonly=True)

    is_usable = Bool(
        title=_('Is this mailing list in a state to accept messages?'),
        description=_(
            "This doesn't necessarily mean that the list is in perfect "
            'shape; its status might be `MailingListStatus.MOD_FAILED`. But '
            'it should be able to handle messages.'),
        readonly=True)

    def startConstructing():
        """Set the status to the `MailingListStatus.CONSTRUCTING` state.

        This state change happens when Mailman pulls the list approved mailing
        lists and begins constructing them.

        :raises AssertionError: When prior to constructing, the status of the
            mailing list is not `MailingListStatus.APPROVED`.
        """

    def startUpdating():
        """Set the status to the `MailingListStatus.UPDATING` state.

        This state change happens when Mailman pulls the list of modified
        mailing lists and begins updating them.

        :raises AssertionError: When prior to updating, the status if the
            mailing list is not `MailingListStatus.MODIFIED`.
        """

    def transitionToStatus(target_state):
        """Transition the list's state after a remote action has taken place.

        This sets the status of the mailing list to reflect the results of
        action by Mailman.  It handles various state changes, updating other
        attributes such as the activate date as necessary.

        :param target_state: The new state.
        :raises AssertionError: When an invalid state transition is made.
        """

    def deactivate():
        """Deactivate the mailing list.

        This sets the status to `MailingListStatus.INACTIVE`.

        :raises AssertionError: When prior to deactivation, the status of the
            mailing list is not `MailingListStatus.ACTIVE`.
        """

    def reactivate():
        """Reactivate the mailing list.

        This sets the status to `MailingListStatus.APPROVED`.

        :raises AssertionError: When prior to reactivation, the status of the
            mailing list is not `MailingListStatus.INACTIVE`.
        """

    def getSubscription(person):
        """Get a person's subscription details for the mailing list.

        :param person: The person whose subscription details to get.

        :return: If the person is subscribed to this mailing list, an
                 IMailingListSubscription. Otherwise, None.
        """

    def subscribe(person, address=None):
        """Subscribe a person to the mailing list.

        :param person: The person to subscribe to the mailing list.  The
            person must be a member (either direct or indirect) of the team
            linked to this mailing list.
        :param address: The `IEmailAddress` to use for the subscription.  The
            address must be owned by `person`.  If None (the default), then
            the person's preferred email address is used.  If the person's
            preferred address changes, their subscription address will change
            as well.
        :raises CannotSubscribe: Raised when the person is not allowed to
            subscribe to the mailing list with the given address.  For
            example, this is raised when the person is not a member of the
            team linked to this mailing list, when `person` is a team, or when
            `person` does not own the given email address.
        """

    def unsubscribe(person):
        """Unsubscribe the person from the mailing list.

        :param person: A member of the mailing list.
        :raises CannotUnsubscribe: Raised when the person is not a member of
            the mailing list.
        """

    def changeAddress(person, address):
        """Change the address a person is subscribed with.

        :param person: The mailing list subscriber.
        :param address: The new IEmailAddress to use for the subscription.
            The address must be owned by `person`.  If None, the person's
            preferred email address is used.  If the person's preferred
            address changes, their subscription address will change as well.
        :raises CannotChangeSubscription: Raised when the person is not a
            allowed to change their subscription address.  For example, this
            is raised when the person is not a member of the team linked to
            this mailing list, when `person` is a team, or when `person` does
            not own the given email address.
        """

    def getSubscribers():
        """Return the set of subscribers.

        :return: a result set of the subscribers sorted by full name.  These
        are the people who will receive messages posted to the mailing list.
        """

    def holdMessage(message):
        """Hold a message for approval on this mailing list.

        :param message: The IMessage to hold.
        :return: The IMessageApproval representing the held message.
        """

    def getReviewableMessages(message_id_filter=None):
        """Return the set of all held messages for this list requiring review.

        :param message_id_filter: If supplied only messages with message ids
            in the filter are returned.
        :return: A sequence of `IMessageApproval`s for this mailing list,
            where the status is `PostedMessageStatus.NEW`.  The returned set
            is ordered first by the date the message was posted, then by
            Message-ID.
        """

    def purge():
        """Place the mailing list into the PURGED state, if safe to do so.
Exemplo n.º 15
0
class IProjectGroupPublic(ICanGetMilestonesDirectly, IHasAppointedDriver,
                          IHasBranches, IHasBugs, IHasDrivers, IHasIcon,
                          IHasLogo, IHasMergeProposals, IHasMilestones,
                          IHasMugshot, IHasOwner, IHasSpecifications,
                          IHasSprints, IMakesAnnouncements, IKarmaContext,
                          IHasOfficialBugTags, IServiceUsage):
    """Public IProjectGroup properties."""

    id = Int(title=_('ID'), readonly=True)

    # The following milestone collections are copied from IHasMilestone so that
    # we can override the collection value types to be IProjectGroupMilestone.
    milestones = copy_field(
        IHasMilestones['milestones'],
        value_type=Reference(schema=IProjectGroupMilestone))

    all_milestones = copy_field(
        IHasMilestones['all_milestones'],
        value_type=Reference(schema=IProjectGroupMilestone))

    owner = exported(
        PublicPersonChoice(
            title=_('Maintainer'),
            required=True,
            vocabulary='ValidPillarOwner',
            description=_("The restricted team, moderated team, or person "
                          "who maintains the project group information in "
                          "Launchpad.")))

    registrant = exported(
        PublicPersonChoice(title=_('Registrant'),
                           required=True,
                           readonly=True,
                           vocabulary='ValidPersonOrTeam',
                           description=_(
                               "Project group registrant. Must be a valid "
                               "Launchpad Person.")))

    display_name = exported(
        TextLine(title=_('Display Name'),
                 description=_(
                     "Appropriately capitalised, "
                     'and typically ending in "Project". '
                     "Examples: the Apache Project, the Mozilla Project, "
                     "the Gimp Project.")))

    displayname = Attribute('Display name (deprecated)')

    title = exported(
        Title(title=_('Title'),
              description=_("The full name of the project group, "
                            "which can contain spaces, special characters, "
                            "etc.")))

    summary = exported(
        Summary(
            title=_('Project Group Summary'),
            description=_(
                "A short paragraph to introduce the project group's work.")))

    description = exported(
        Text(title=_('Description'),
             description=_(
                 "Details about the project group's work, goals, and "
                 "how to contribute. Use plain text, paragraphs are preserved "
                 "and URLs are linked in pages. Don't repeat the Summary.")))

    datecreated = exported(Datetime(
        title=_('Date Created'),
        description=_("The date this project group was created in Launchpad."),
        readonly=True),
                           exported_as="date_created")

    driver = exported(
        PublicPersonChoice(
            title=_("Driver"),
            description=_(
                "This is a project group-wide appointment. Think carefully "
                "here! This person or team will be able to set feature goals "
                "and approve bug targeting and backporting for ANY series in "
                "ANY project in this group. You can also appoint drivers "
                "at the level of a specific project or series. So you may "
                "just want to leave this space blank, and instead let the "
                "individual projects and series have drivers."),
            required=False,
            vocabulary='ValidPersonOrTeam'))

    homepageurl = exported(URIField(title=_('Homepage URL'),
                                    required=False,
                                    allowed_schemes=['http', 'https', 'ftp'],
                                    allow_userinfo=False,
                                    description=_(
                                        "The project group home page. "
                                        "Please include the http://")),
                           exported_as="homepage_url")

    wikiurl = exported(URIField(
        title=_('Wiki URL'),
        required=False,
        allowed_schemes=['http', 'https', 'ftp'],
        allow_userinfo=False,
        description=_("The URL of this project group's wiki, "
                      "if it has one. Please include the http://")),
                       exported_as="wiki_url")

    lastdoap = TextLine(title=_('Last-parsed RDF fragment'),
                        description=_("The last RDF fragment for this "
                                      "entity that we received and parsed, or "
                                      "generated."),
                        required=False)

    sourceforgeproject = exported(TextLine(
        title=_("SourceForge Project Name"),
        description=_("The SourceForge project name for this "
                      "project group, if it is in SourceForge."),
        required=False),
                                  exported_as="sourceforge_project")

    freshmeatproject = exported(TextLine(
        title=_("Freshmeat Project Name"),
        description=_("The Freshmeat project name for this "
                      "project group, if it is in Freshmeat. "
                      "[DEPRECATED]"),
        required=False),
                                exported_as="freshmeat_project")

    homepage_content = exported(
        Text(title=_("Homepage Content"),
             required=False,
             description=_(
                 "The content of this project group'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='/@@/project',
            description=_(
                "A small image of exactly 14x14 pixels and at most 5kb in "
                "size, that can be used to identify this project group. The "
                "icon will be displayed in Launchpad everywhere that we link "
                "to this project group. For example in listings or tables of "
                "active project groups.")))

    logo = exported(
        LogoImageUpload(
            title=_("Logo"),
            required=False,
            default_image_resource='/@@/project-logo',
            description=_(
                "An image of exactly 64x64 pixels that will be displayed in "
                "the heading of all pages related to this project group. It "
                "should be no bigger than 50kb in size.")))

    mugshot = exported(
        MugshotImageUpload(
            title=_("Brand"),
            required=False,
            default_image_resource='/@@/project-mugshot',
            description=_(
                "A large image of exactly 192x192 pixels, that will be "
                "displayed on this project group's home page in Launchpad. "
                "It should be no bigger than 100kb in size. ")))

    bugtracker = exported(ReferenceChoice(
        title=_('Bug Tracker'),
        required=False,
        vocabulary='BugTracker',
        schema=IBugTracker,
        description=_(
            "The bug tracker the projects in this project group use.")),
                          exported_as="bug_tracker")

    # products.value_type will be set to IProduct once IProduct is defined.
    products = exported(CollectionField(
        title=_('List of active projects for this project group.'),
        value_type=Reference(Interface)),
                        exported_as="projects")

    bug_reporting_guidelines = exported(
        Text(title=(u"If I\N{right single quotation mark}m reporting a bug, "
                    u"I should include, if possible"),
             description=(u"These guidelines will be shown to "
                          "anyone reporting a bug."),
             required=False,
             max_length=50000))

    bug_reported_acknowledgement = exported(
        Text(title=(u"After reporting a bug, I can expect the following."),
             description=(u"This message of acknowledgement will be displayed "
                          "to anyone after reporting a bug."),
             required=False,
             max_length=50000))

    enable_bugfiling_duplicate_search = Bool(
        title=u"Search for possible duplicate bugs when a new bug is filed",
        required=False,
        readonly=True)

    translatables = Attribute("Products that are translatable in LP")

    def getProduct(name):
        """Get a product with name `name`."""

    def getConfigurableProducts():
        """Get all products that can be edited by user."""

    def has_translatable():
        """Return a boolean showing the existance of translatables products.
        """

    def has_branches():
        """Return a boolean showing the existance of products with branches.
        """

    def hasProducts():
        """Returns True if a project has products associated with it, False
        otherwise.
        """

    def getSeries(series_name):
        """Return a ProjectGroupSeries object with name `series_name`."""

    product_milestones = Attribute('all the milestones for all the products.')
Exemplo n.º 16
0
class S(Interface):
    foo = Text()
    bar = Text()
    baro = Text(readonly=True)
Exemplo n.º 17
0
class ISiteSchema(Interface):

    site_title_1 = TextLine(
        title=_(u'Site title (First Line)'),
        description=_(u'First line of site title'),
        required=False,
        default=u'')

    site_title_2 = TextLine(
        title=_(u'Site title (Second Line)'),
        description=_(u'Second line of site title'),
        default=u'')

    site_orgao = TextLine(
        title=_(u'Department'),
        description=_(u'Name of Ministry or Department '
                      u'to which this site is subject.'),
        required=False,
        default=u'')

    url_orgao = TextLine(
        title=_(u'Url ID of Department'),
        description=_(u'Url ID for Ministry or Department to which this site is subject.'),
        required=False,
        default=u'')

    site_description = Text(
        title=_(u'Site description'),
        description=_(u'The site description is available '
                      u'in syndicated content and in search engines. '
                      u'Keep it brief.'),
        default=u'',
        required=False)

    exposeDCMetaTags = Bool(
        title=_(u'Expose Dublin Core metadata'),
        description=_(u'Exposes the Dublin Core properties as metatags.'),
        default=False,
        required=False)

    display_pub_date_in_byline = Bool(
        title=_(u'Display publication date in about information'),
        description=_(u'Displays content publication date on site pages.'),
        default=False,
        required=False)

    enable_sitemap = Bool(
        title=_(u'Expose sitemap.xml.gz'),
        description=_(u'Exposes your content as a file '
                      u'according to the sitemaps.org standard. You '
                      u'can submit this to compliant search engines '
                      u'like Google, Yahoo and Microsoft. It allows '
                      u'these search engines to more intelligently '
                      u'crawl your site.'),
        default=False,
        required=False)

    webstats_js = SourceText(
        title=_(u'JavaScript for web statistics support'),
        description=_(u'For enabling web statistics support '
                      u'from external providers (for e.g. Google '
                      u'Analytics). Paste the code snippets provided. '
                      u'It will be included in the rendered HTML as '
                      u'entered near the end of the page.'),
        default=u'',
        required=False)
Exemplo n.º 18
0
class S2(Interface):
    foo2 = Text()
    bar2 = Text()
Exemplo n.º 19
0
class ISourcePackageRecipeView(Interface):
    """IBranch attributes that require launchpad.View permission."""

    id = Int()

    date_created = Datetime(required=True, readonly=True)

    registrant = exported(
        PublicPersonChoice(title=_("The person who created this recipe."),
                           required=True,
                           readonly=True,
                           vocabulary='ValidPersonOrTeam'))

    recipe_text = exported(Text(readonly=True))

    pending_builds = exported(
        doNotSnapshot(
            CollectionField(title=_("The pending builds of this recipe."),
                            description=_(
                                'Pending builds of this recipe, sorted in '
                                'descending order of creation.'),
                            value_type=Reference(schema=Interface),
                            readonly=True)))

    completed_builds = exported(
        doNotSnapshot(
            CollectionField(
                title=_("The completed builds of this recipe."),
                description=_(
                    'Completed builds of this recipe, sorted in '
                    'descending order of finishing (or starting if not'
                    'completed successfully).'),
                value_type=Reference(schema=Interface),
                readonly=True)))

    builds = exported(
        doNotSnapshot(
            CollectionField(
                title=_("All builds of this recipe."),
                description=_(
                    'All builds of this recipe, sorted in '
                    'descending order of finishing (or starting if not'
                    'completed successfully).'),
                value_type=Reference(schema=Interface),
                readonly=True)))

    last_build = exported(
        Reference(Interface,
                  title=_("The the most recent build of this recipe."),
                  readonly=True))

    def isOverQuota(requester, distroseries):
        """True if the recipe/requester/distroseries combo is >= quota.

        :param requester: The Person requesting a build.
        :param distroseries: The distroseries to build for.
        """

    @call_with(requester=REQUEST_USER)
    @operation_parameters(archive=Reference(schema=IArchive),
                          distroseries=Reference(schema=IDistroSeries),
                          pocket=Choice(vocabulary=PackagePublishingPocket, ))
    @operation_returns_entry(Interface)
    @export_write_operation()
    def requestBuild(archive, distroseries, requester, pocket):
        """Request that the recipe be built in to the specified archive.

        :param archive: The IArchive which you want the build to end up in.
        :param requester: the person requesting the build.
        :param pocket: the pocket that should be targeted.
        :raises: various specific upload errors if the requestor is not
            able to upload to the archive.
        """

    def containsUnbuildableSeries(archive):
        """Does the recipe contain series that can not be built into.
        """

    @export_write_operation()
    def performDailyBuild():
        """Perform a build into the daily build archive."""

    @export_read_operation()
    @operation_for_version("devel")
    def getPendingBuildInfo():
        """Find distroseries and archive data for pending builds.
 class IWithFields(Interface):
     foo = Text()
     bar = Text()
Exemplo n.º 21
0
class IPreviewDiff(IDiff):
    """A diff generated to show actual diff between two branches.

    This diff will be used primarily for branch merge proposals where we are
    trying to determine the effective changes of landing the source branch on
    the target branch.
    """
    export_as_webservice_entry()

    source_revision_id = exported(
        TextLine(title=_('The tip revision id of the source branch used to '
                         'generate the diff.'),
                 readonly=True))

    target_revision_id = exported(
        TextLine(title=_('The tip revision id of the target branch used to '
                         'generate the diff.'),
                 readonly=True))

    prerequisite_revision_id = exported(
        TextLine(title=_(
            'The tip revision id of the prerequisite branch used to '
            'generate the diff.'),
                 readonly=True))

    conflicts = exported(
        Text(title=_(
            'The conflicts text describing any path or text conflicts.'),
             readonly=True))

    has_conflicts = Bool(
        title=_('Has conflicts'),
        readonly=True,
        description=_('The previewed merge produces conflicts.'))

    branch_merge_proposal_id = Int(
        title=_('The branch merge proposal for this diff.'), readonly=True)

    # The schema for the Reference gets patched in _schema_circular_imports.
    branch_merge_proposal = exported(
        Reference(Interface,
                  readonly=True,
                  title=_('The branch merge proposal that diff relates to.')))

    date_created = exported(
        Datetime(title=_('Date Created'),
                 required=False,
                 readonly=True,
                 description=_("When this diff was created.")))

    stale = exported(
        Bool(readonly=True,
             description=_(
                 'If the preview diff is stale, it is out of date when '
                 'compared to the tip revisions of the source, target, and '
                 'possibly prerequisite branches.')))

    title = exported(
        TextLine(title=_('Title'),
                 required=False,
                 readonly=True,
                 description=_('PreviewDiff title.')))

    def getFileByName(filename):
        """Return the file under +files with specified name."""
 class IWithRequired(Interface):
     must = Text(required=True)
Exemplo n.º 23
0
class IComponentsSetupSchema(Interface):
    """Schema for components setup views.
    """

    body = Text(title=u'Settings')
Exemplo n.º 24
0
 def test_getFormValue_w_default(self):
     field = Text(__name__='foo', title=u"Foo Title", default=u"def")
     request = TestRequest()
     widget = self._WidgetFactory(field, request)
     self.assertEqual(widget._getFormValue(), u'def')
Exemplo n.º 25
0
class IGitRepositorySet(Interface):
    """Interface representing the set of Git repositories."""

    export_as_webservice_collection(IGitRepository)

    def new(registrant,
            owner,
            target,
            name,
            information_type=None,
            date_created=None):
        """Create a Git repository and return it.

        :param registrant: The `IPerson` who registered the new repository.
        :param owner: The `IPerson` who owns the new repository.
        :param target: The `IProduct`, `IDistributionSourcePackage`, or
            `IPerson` that the new repository is associated with.
        :param name: The repository name.
        :param information_type: Set the repository's information type to
            one different from the target's default.  The type must conform
            to the target's code sharing policy.  (optional)
        """

    # Marker for references to Git URL layouts: ##GITNAMESPACE##
    @call_with(user=REQUEST_USER)
    @operation_parameters(path=TextLine(title=_("Repository path"),
                                        required=True))
    @operation_returns_entry(IGitRepository)
    @export_read_operation()
    @operation_for_version("devel")
    def getByPath(user, path):
        """Find a repository by its path.

        Any of these forms may be used::

            Unique names:
                ~OWNER/PROJECT/+git/NAME
                ~OWNER/DISTRO/+source/SOURCE/+git/NAME
                ~OWNER/+git/NAME
            Owner-target default aliases:
                ~OWNER/PROJECT
                ~OWNER/DISTRO/+source/SOURCE
            Official aliases:
                PROJECT
                DISTRO/+source/SOURCE

        Return None if no match was found.
        """

    @call_with(user=REQUEST_USER)
    @operation_parameters(target=Reference(title=_("Target"),
                                           required=True,
                                           schema=IHasGitRepositories))
    @operation_returns_collection_of(IGitRepository)
    @export_read_operation()
    @operation_for_version("devel")
    def getRepositories(user, target):
        """Get all repositories for a target.

        :param user: An `IPerson`.  Only repositories visible by this user
            will be returned.
        :param target: An `IHasGitRepositories`.

        :return: A collection of `IGitRepository` objects.
        """

    @call_with(user=REQUEST_USER)
    @operation_parameters(
        person=Reference(title=_(
            "The person whose repository visibility is being "
            "checked."),
                         schema=IPerson),
        repository_names=List(value_type=Text(),
                              title=_('List of repository unique names'),
                              required=True),
    )
    @export_read_operation()
    @operation_for_version("devel")
    def getRepositoryVisibilityInfo(user, person, repository_names):
        """Return the named repositories visible to both user and person.

        Anonymous requesters don't get any information.

        :param user: The user requesting the information. If the user is
            None then we return an empty dict.
        :param person: The person whose repository visibility we wish to
            check.
        :param repository_names: The unique names of the repositories to
            check.

        Return a dict with the following values:
        person_name: the displayname of the person.
        visible_repositories: a list of the unique names of the repositories
        which the requester and specified person can both see.

        This API call is provided for use by the client Javascript.  It is
        not designed to efficiently scale to handle requests for large
        numbers of repositories.
        """

    @operation_parameters(target=Reference(title=_("Target"),
                                           required=True,
                                           schema=IHasGitRepositories))
    @operation_returns_entry(IGitRepository)
    @export_read_operation()
    @operation_for_version("devel")
    def getDefaultRepository(target):
        """Get the default repository for a target.

        :param target: An `IHasGitRepositories`.

        :raises GitTargetError: if `target` is an `IPerson`.
        :return: An `IGitRepository`, or None.
        """

    @operation_parameters(owner=Reference(title=_("Owner"),
                                          required=True,
                                          schema=IPerson),
                          target=Reference(title=_("Target"),
                                           required=True,
                                           schema=IHasGitRepositories))
    @operation_returns_entry(IGitRepository)
    @export_read_operation()
    @operation_for_version("devel")
    def getDefaultRepositoryForOwner(owner, target):
        """Get a person's default repository for a target.

        :param owner: An `IPerson`.
        :param target: An `IHasGitRepositories`.

        :raises GitTargetError: if `target` is an `IPerson`.
        :return: An `IGitRepository`, or None.
        """

    @operation_parameters(target=Reference(title=_("Target"),
                                           required=True,
                                           schema=IHasGitRepositories),
                          repository=Reference(title=_("Git repository"),
                                               required=False,
                                               schema=IGitRepository))
    @export_write_operation()
    @operation_for_version("devel")
    def setDefaultRepository(target, repository):
        """Set the default repository for a target.

        :param target: An `IHasGitRepositories`.
        :param repository: An `IGitRepository`, or None to unset the default
            repository.

        :raises GitTargetError: if `target` is an `IPerson`.
        """

    @call_with(user=REQUEST_USER)
    @operation_parameters(owner=Reference(title=_("Owner"),
                                          required=True,
                                          schema=IPerson),
                          target=Reference(title=_("Target"),
                                           required=True,
                                           schema=IHasGitRepositories),
                          repository=Reference(title=_("Git repository"),
                                               required=False,
                                               schema=IGitRepository))
    @export_write_operation()
    @operation_for_version("devel")
    def setDefaultRepositoryForOwner(owner, target, repository, user):
        """Set a person's default repository for a target.

        :param owner: An `IPerson`.
        :param target: An `IHasGitRepositories`.
        :param repository: An `IGitRepository`, or None to unset the default
            repository.
        :param user: The `IPerson` who is making the change.

        :raises GitTargetError: if `target` is an `IPerson`.
        """

    @collection_default_content()
    def empty_list():
        """Return an empty collection of repositories.

        This only exists to keep lazr.restful happy.
        """

    def preloadDefaultRepositoriesForProjects(projects):
        """Get preloaded default repositories for a list of projects.
class IAceMeasure(form.Schema, IImageScaleTraversable):
    """
    Defines content-type schema for Ace Measure
    """

    # company - this is always liferay in the data
    # group - same value for all

    # title - Provided by behaviour. Imported value comes from name column
    title = TextLine(title=_(u"Title"), required=True)

    # description - Provided by behaviour. Imported value comes from
    #               description column
    dexteritytextindexer.searchable('long_description')
    long_description = RichText(title=_(u"description"), required=True)

    implementation_type = Choice(
        title=_(u"Implementation Type"), required=False, default=None,
        vocabulary="eea.climateadapt.acemeasure_implementationtype"
    )

    dexteritytextindexer.searchable('implementation_time')
    implementation_time = RichText(
        title=_(u"Implementation Time"), required=False, default=None,
    )

    dexteritytextindexer.searchable('challenges')
    challenges = RichText(
        title=_(u"Challenges"), required=False, default=None,
    )

    dexteritytextindexer.searchable('lifetime')
    lifetime = RichText(title=_(u"Lifetime"), required=False, default=u"")

    spatial_layer = TextLine(
        title=_(u"Spatial Layer"), required=False, default=u"")

    spatial_values = List(title=_(u"Countries"),
                          description=_(u"European countries"),
                          required=False,
                          value_type=Choice(
                              vocabulary="eea.climateadapt.ace_countries"))

    dexteritytextindexer.searchable('legal_aspects')
    legal_aspects = RichText(title=_(u"Legal aspects"),
                             required=False,
                             default=u"")

    dexteritytextindexer.searchable('stakeholder_participation')
    stakeholder_participation = RichText(
        title=_(u"Stakeholder participation"), required=False,
        default=u"")

    dexteritytextindexer.searchable('contact')
    contact = RichText(title=_(u"Contact"), required=False, default=u"")

    dexteritytextindexer.searchable('success_limitations')
    success_limitations = RichText(
        title=_(u"Success / limitations"), required=False, default=u"")

    dexteritytextindexer.searchable('cost_benefit')
    cost_benefit = RichText(
        title=_(u"Cost / Benefit"), required=False, default=u"")

    websites = List(title=_(u"Websites"),
                    description=_(u"A list of relevant website links"),
                    required=False,
                    value_type=URI(title=_("A link")),
                    )

    # keywords = List(title=_(u"Keywords"),
    #                description=_(u"Keywords related to the project"),
    #                required=False,
    #                value_type=TextLine(title=_(u"Tag"))
    # )

    keywords = RichText(title=_(u"Keywords"),
                   description=_(u"Keywords related to the project"),
                   required=False,
    )

    # TODO: startdate, enddate, publicationdate have no values in DB
    # TODO: specialtagging is not used in any view jsp, only in add and edit
    # views

    sectors = List(title=_(u"Sectors"),
                   description=_(u"TODO: Sectors description here"),
                   required=False,
                   value_type=Choice(
                       vocabulary="eea.climateadapt.aceitems_sectors",),
                   )

    elements = List(title=_(u"Elements"),
                    description=_(u"TODO: Elements description here"),
                    required=False,
                    value_type=Choice(
                        vocabulary="eea.climateadapt.aceitems_elements",),
                    )

    climate_impacts = List(
        title=_(u"Climate impacts"),
        description=_(u"TODO: Climate impacts description here"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts",),
    )

    dexteritytextindexer.searchable('source')
    source = RichText(title=_(u"Source"), required=True,)
    # TODO: special tagging implement as related

    geochars = Text(title=_(u"Geographic characterization"),
                    required=False, default=u"")

    measure_type = Choice(title=_(u"Measure Type"),
                          required=True,
                          default="A",
                          vocabulary="eea.climateadapt.acemeasure_types")

    comments = TextLine(title=_(u"Comments"), required=False, default=u"")

    important = Bool(title=_(u"High importance"), required=False,
                     default=False)

    rating = Int(title=_(u"Rating"), required=True, default=0)

    dexteritytextindexer.searchable('objectives')
    objectives = RichText(title=_(u"Objectives"), required=False, default=u"")

    dexteritytextindexer.searchable('solutions')
    solutions = RichText(title=_(u"Solutions"), required=False, default=u"")

    adaptationoptions = List(
        title=_(u"Adaptation Options"),
        required=False,
        value_type=Int(),   # TODO:  leave it like that, until we figure it out
    )   # TODO: reimplement as list
    relevance = List(
        title=_(u"Relevance"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_relevance",),
        )
    primephoto = RelationChoice(
        title=_(u"Prime photo"),
        source=ObjPathSourceBinder(object_provides=IImage.__identifier__),
        required=False,
    )
    supphotos = RelationList(
        title=u"Gallery",
        default=[],
        value_type=RelationChoice(
            title=_(u"Related"),
            source=ObjPathSourceBinder(
                object_provides=IImage.__identifier__)
            ),
        required=False,
    )
Exemplo n.º 27
0
class ISnapEditableAttributes(IHasOwner):
    """`ISnap` attributes that can be edited.

    These attributes need launchpad.View to see, and launchpad.Edit to change.
    """
    date_last_modified = exported(Datetime(
        title=_("Date last modified"), required=True, readonly=True))

    owner = exported(PersonChoice(
        title=_("Owner"), required=True, readonly=False,
        vocabulary="AllUserTeamsParticipationPlusSelf",
        description=_("The owner of this snap package.")))

    distro_series = exported(Reference(
        IDistroSeries, title=_("Distro Series"),
        required=False, readonly=False,
        description=_(
            "The series for which the snap package should be built.  If not "
            "set, Launchpad will infer an appropriate series from "
            "snapcraft.yaml.")))

    name = exported(TextLine(
        title=_("Name"), required=True, readonly=False,
        constraint=name_validator,
        description=_("The name of the snap package.")))

    description = exported(Text(
        title=_("Description"), required=False, readonly=False,
        description=_("A description of the snap package.")))

    branch = exported(ReferenceChoice(
        title=_("Bazaar branch"), schema=IBranch, vocabulary="Branch",
        required=False, readonly=False,
        description=_(
            "A Bazaar branch containing a snap/snapcraft.yaml, "
            "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
            ".snapcraft.yaml recipe at the top level.")))

    git_repository = exported(ReferenceChoice(
        title=_("Git repository"),
        schema=IGitRepository, vocabulary="GitRepository",
        required=False, readonly=True,
        description=_(
            "A Git repository with a branch containing a snap/snapcraft.yaml, "
            "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
            ".snapcraft.yaml recipe at the top level.")))

    git_repository_url = exported(URIField(
        title=_("Git repository URL"), required=False, readonly=True,
        description=_(
            "The URL of a Git repository with a branch containing a "
            "snap/snapcraft.yaml, build-aux/snap/snapcraft.yaml, "
            "snapcraft.yaml, or .snapcraft.yaml recipe at the top level."),
        allowed_schemes=["git", "http", "https"],
        allow_userinfo=True,
        allow_port=True,
        allow_query=False,
        allow_fragment=False,
        trailing_slash=False))

    git_path = TextLine(
        title=_("Git branch path"), required=False, readonly=False,
        description=_(
            "The path of the Git branch containing a snap/snapcraft.yaml, "
            "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
            ".snapcraft.yaml recipe at the top level."))
    _api_git_path = exported(
        TextLine(
            title=git_path.title, required=False, readonly=False,
            description=git_path.description),
        exported_as="git_path")

    git_ref = exported(Reference(
        IGitRef, title=_("Git branch"), required=False, readonly=False,
        description=_(
            "The Git branch containing a snap/snapcraft.yaml, "
            "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
            ".snapcraft.yaml recipe at the top level.")))

    build_source_tarball = exported(Bool(
        title=_("Build source tarball"),
        required=True, readonly=False,
        description=_(
            "Whether builds of this snap package should also build a tarball "
            "containing all source code, including external dependencies.")))

    auto_build = exported(Bool(
        title=_("Automatically build when branch changes"),
        required=True, readonly=False,
        description=_(
            "Whether this snap package is built automatically when the branch "
            "containing its snap/snapcraft.yaml, "
            "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
            ".snapcraft.yaml recipe changes.")))

    auto_build_archive = exported(Reference(
        IArchive, title=_("Source archive for automatic builds"),
        required=False, readonly=False,
        description=_(
            "The archive from which automatic builds of this snap package "
            "should be built.")))

    auto_build_pocket = exported(Choice(
        title=_("Pocket for automatic builds"),
        vocabulary=PackagePublishingPocket, required=False, readonly=False,
        description=_(
            "The package stream within the source distribution series to use "
            "when building the snap package.")))

    auto_build_channels = exported(Dict(
        title=_("Source snap channels for automatic builds"),
        key_type=TextLine(), required=False, readonly=False,
        description=_(
            "A dictionary mapping snap names to channels to use when building "
            "this snap package.  Currently only 'core' and 'snapcraft' keys "
            "are supported.")))

    is_stale = Bool(
        title=_("Snap package is stale and is due to be rebuilt."),
        required=True, readonly=False)

    store_upload = exported(Bool(
        title=_("Automatically upload to store"),
        required=True, readonly=False,
        description=_(
            "Whether builds of this snap package are automatically uploaded "
            "to the store.")))

    # XXX cjwatson 2016-12-08: We should limit this to series that are
    # compatible with distro_series, but that entails validating the case
    # where both are changed in a single PATCH request in such a way that
    # neither is compatible with the old value of the other.  As far as I
    # can tell lazr.restful only supports per-field validation.
    store_series = exported(ReferenceChoice(
        title=_("Store series"),
        schema=ISnappySeries, vocabulary="SnappySeries",
        required=False, readonly=False,
        description=_(
            "The series in which this snap package should be published in the "
            "store.")))

    store_distro_series = ReferenceChoice(
        title=_("Store and distro series"),
        schema=ISnappyDistroSeries, vocabulary="SnappyDistroSeries",
        required=False, readonly=False)

    store_name = exported(TextLine(
        title=_("Registered store package name"),
        required=False, readonly=False,
        description=_(
            "The registered name of this snap package in the store.")))

    store_secrets = List(
        value_type=TextLine(), title=_("Store upload tokens"),
        required=False, readonly=False,
        description=_(
            "Serialized secrets issued by the store and the login service to "
            "authorize uploads of this snap package."))

    store_channels = exported(List(
        title=_("Store channels"),
        required=False, readonly=False, constraint=channels_validator,
        description=_(
            "Channels to release this snap package to after uploading it to "
            "the store. A channel is defined by a combination of an optional "
            " track, a risk, and an optional branch, e.g. "
            "'2.1/stable/fix-123', '2.1/stable', 'stable/fix-123', or "
            "'stable'.")))
Exemplo n.º 28
0
class INode(Interface):

    """Node im- and exporter.
    """

    node = Text(description=u'Im- and export the object as a DOM node.')
Exemplo n.º 29
0
class IOperator(IAlgebraObject):
    """Objects providing this interface represent the
    Operator Algebra object
    """
#    ops = Dict(Text(), Text())
    op = Text()
Exemplo n.º 30
0
class IPOFile(IRosettaStats):
    """A translation file."""

    export_as_webservice_entry(
        singular_name="translation_file",
        plural_name="translation_files")

    id = exported(Int(
        title=_('The translation file id.'), required=True, readonly=True))

    potemplate = Object(
        title=_('The translation file template.'),
        required=True, readonly=True, schema=IPOTemplate)

    language = Choice(
        title=_('Language of this PO file.'),
        vocabulary='Language', required=True)

    title = TextLine(
        title=_('The translation file title.'), required=True, readonly=True)

    description = Text(
        title=_('The translation file description.'), required=True)

    topcomment = Text(
        title=_('A comment about this translation file.'), required=True)

    header = Text(
        title=_('Header'),
        description=_(
            'The standard translation header in its native format.'),
        required=False)

    fuzzyheader = Bool(
        title=_('A flag indicating whether the header is fuzzy.'),
        required=True)

    lasttranslator = Object(
        title=_('Last person that translated a message.'), schema=IPerson)

    date_changed = Datetime(
        title=_('When this file was last changed.'), readonly=False,
        required=True)

    lastparsed = Datetime(title=_('Last time this pofile was parsed.'))

    owner = Choice(
        title=_('Translation file owner'),
        required=True,
        description=_('''
            The owner of the translation file in Launchpad can edit its
            translations and upload new versions.
            '''),
        vocabulary="ValidOwner")

    path = TextLine(
        title=_('The path to the file that was imported'),
        required=True)

    datecreated = Datetime(
        title=_('When this translation file was created.'), required=True)

    translators = List(
        title=_('Translators that have edit permissions.'),
        description=_('''
            Translators designated as having permission to edit these files
            in this language.
            '''), required=True, readonly=True)

    contributors = List(
        title=_('Translators who have made any contribution to this file.'),
        required=True, readonly=True)

    translationpermission = Choice(
        title=_('Translation permission'),
        required=True,
        description=_('''
            The permission system which is used for this translation file.
            This is inherited from the product, project and/or distro in which
            the pofile is found.
            '''),
        vocabulary=TranslationPermission)

    from_sourcepackagename = Field(
        title=_('The source package this pofile comes from.'),
        description=_('''
            The source package this pofile comes from (set it only if it\'s
            different from IPOFile.potemplate.sourcepackagename).
            '''),
        required=False)

    translation_messages = Attribute(_(
        "All `ITranslationMessage` objects related to this "
        "translation file."))

    plural_forms = Int(
        title=_('Number of plural forms for the language of this PO file.'),
        description=_('''
            Number of plural forms is a number of translations provided for
            each plural form message.  If `IPOFile.language` does not specify
            plural forms, it defaults to 2, which is the most common number
            of plural forms.
            '''),
        required=True, readonly=True)

    def getOtherSidePOFile():
        """Get the POFile for the same language on the other side.

        Follow the packaging link to find in the sharing template on the
        other side and get the POFile from there.
        Returns None if no link exists.
        """

    def translatedCount():
        """
        Returns the number of message sets which this PO file has current
        translations for.
        """

    def untranslatedCount():
        """
        Return the number of messages which this PO file has no translation
        for.
        """

    def hasPluralFormInformation():
        """Do we know the plural-forms information for this `POFile`?"""

    def getHeader():
        """Return an `ITranslationHeaderData` representing its header."""

    def findPOTMsgSetsContaining(text):
        """Get POTMsgSets where English text or translation contain `text`."""

    def getPOTMsgSetTranslated():
        """Get pot messages that are translated for this translation file."""

    def getPOTMsgSetUntranslated():
        """Get pot message sets that are untranslated for this file."""

    def getPOTMsgSetWithNewSuggestions():
        """Get pot message sets with suggestions submitted after last review.
        """

    def getPOTMsgSetDifferentTranslations():
        """Get pot message sets with different translations on both sides.
        """

    def getTranslationsFilteredBy(person):
        """Get TranslationMessages in this `IPOFile` contributed by `person`.

        Returned messages are ordered by the `POTMsgSet`, and then by
        `date_created` with newest first.
        """

    def getTranslationMessages(condition=None):
        """Get TranslationMessages in this `IPOFile`.

        If condition is None, return all messages, else narrow the result
        set down using the condition.
        """

    def export(ignore_obsolete=False, export_utf8=False):
        """Export this PO file as string.

        :param ignore_obsolete: Whether the exported PO file does not have
            obsolete entries.
        :param export_utf8: Whether the exported PO file should be exported as
            UTF-8.
        """

    def prepareTranslationCredits(potmsgset):
        """Add Launchpad contributors to translation credit strings.

        It adds to the translation for `potmsgset` if it exists, trying
        not to repeat same people who are already credited.
        """

    def canEditTranslations(person):
        """Whether the given person is able to add/edit translations."""

    def canAddSuggestions(person):
        """Whether the given person is able to add new suggestions."""

    def getStatistics():
        """Summarize this file's cached translation statistics.

        :return: tuple of (`currentcount`, `updatescount`, `rosettacount`,
            `unreviewed_count`), as collected by `updateStatistics`.
        """

    def updateStatistics():
        """Update the cached statistics fields.

        :return: a tuple (`currentcount`, `updatescount`, `rosettacount`,
            `unreviewed_count`), as for `getStatistics`."""

    def updateHeader(new_header):
        """Update the header information.

        new_header is a POHeader object.
        """

    def isTranslationRevisionDateOlder(header):
        """Whether given header revision date is newer then self one."""

    def setPathIfUnique(path):
        """Set path to given one, provided it's a valid, unique path.

        A `POFile`'s path must be unique within its context, i.e. for either
        the same `DistroSeries` and `SourcePackageName`, or for the same
        `ProductSeries`, depending on which the `POFile` is attached to.

        If the new path is not unique, the old path will be retained instead.
        """

    def importFromQueue(entry_to_import, logger=None, txn=None):
        """Import given queue entry.

        :param entry_to_import: `TranslationImportQueueEntry` specifying an
            approved import for this `POFile`
        :param logger: optional logger to report problems to.
        :param txn: optionally, a transaction manager.  It will not be
            used; it's here only for API symmetry with `IPOTemplate`.

        :return: a tuple of the subject line and body for a notification email
            to be sent to the uploader.
        """

    def getFullLanguageCode():
        """Return the language code."""

    def getFullLanguageName():
        """Return the language name."""

    def getTranslationRows():
        """Return exportable rows of translation data.

        :return: a list of `VPOExport` objects.
        """

    def getChangedRows():
        """Return exportable rows that differ from upstream translations.

        :return: a list of `VPOExport` objects.
        """

    def markChanged(translator=None, timestamp=None):
        """Note a change to this `POFile` or its contents.