l.b.v.s.SpecificationDepCandidatesVocabulary(SQLObjectVocabularyBase) : class documentation

Part of lp.blueprints.vocabularies.specificationdependency View In Hierarchy

Specifications that could be dependencies of this spec.

This includes only those specs that are not blocked by this spec (directly or indirectly), unless they are already dependencies.

This vocabulary has a bit of a split personality.

Tokens are either:

For the purposes of enumeration and searching we look at all the possible specifications, but order those of the same target first. If there is an associated series as well, then those are shown before other matches not linked to the same series.

Method toTerm Undocumented
Method getTermByToken See zope.schema.interfaces.IVocabularyTokenized.
Method search See SQLObjectVocabularyBase.search.
Method __iter__ Return an iterator which provides the terms from the vocabulary.
Method __contains__ Undocumented
Method _is_valid_candidate Is spec a valid candidate spec for self.context?
Method _order_by Look at the context to provide grouping.
Method _exclude_blocked_query Return the select statement to exclude already blocked specs.
Method _spec_from_url If url is the URL of a specification, return it.

Inherited from SQLObjectVocabularyBase:

Method __init__ Undocumented
Method searchForTerms Undocumented
Method __len__ Undocumented
Method getTerm Undocumented
Method emptySelectResults Return a SelectResults object without any elements.

Inherited from FilteredVocabularyBase (via SQLObjectVocabularyBase):

Method __getattribute__ Undocumented
Method supportedFilters Undocumented
def _is_valid_candidate(self, spec):
Is spec a valid candidate spec for self.context?

Invalid candidates are:

  • None
  • The spec that we're adding a depdency to
  • Specs that depend on this one

Preventing the last category prevents loops in the dependency graph.

def _order_by(self):
Look at the context to provide grouping.

If the blueprint is for a project, then matching results for that project should be first. If the blueprint is set for a series, then that series should come before others for the project. Similarly for the distribution, and the series goal for the distribution.

If all else is equal, the ordering is by name, then database id as a final uniqueness resolver.

def _exclude_blocked_query(self):
Return the select statement to exclude already blocked specs.
def toTerm(self, obj):
Undocumented
def _spec_from_url(self, url):
If url is the URL of a specification, return it.

This implementation is a little fuzzy and will return specs for URLs that, for example, don't have the host name right. This seems unlikely to cause confusion in practice, and being too anal probably would be confusing (e.g. not accepting production URLs on staging).

def getTermByToken(self, token):
See zope.schema.interfaces.IVocabularyTokenized.

The tokens for specifications are either the name of a spec on the same target or a URL for a spec.

def search(self, query, vocab_filter=None):
See SQLObjectVocabularyBase.search.

We find specs where query is in the text of name or title, or matches the full text index and then filter out ineligible specs using _filter_specs.

def __iter__(self):
Return an iterator which provides the terms from the vocabulary.
def __contains__(self, obj):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2018-05-21 00:00:05.