Part of lp.code.interfaces.branchnamespace View In Hierarchy
This interface exists solely to avoid importing things from the
'database' package. Use get_branch_namespace
to get branch namespaces
instead.
Method | get | Return the appropriate IBranchNamespace for the given objects. |
Method | lookup | Return the IBranchNamespace for 'namespace_name'. |
Method | interpret | Like get , but takes names of objects. |
Method | parse | Parse 'namespace_name' into its components. |
Method | traverse | Look up the branch at the path given by 'segments'. |
IBranchNamespace
for the given objects.IBranchNamespace
for 'namespace_name'.Returns | An IBranchNamespace . | |
Raises | InvalidNamespace | if namespace_name cannot be parsed. |
NoSuchPerson | if the person referred to cannot be found. | |
NoSuchProduct | if the product referred to cannot be found. | |
NoSuchDistribution | if the distribution referred to cannot be found. | |
NoSuchDistroSeries | if the distroseries referred to cannot be- found. | |
NoSuchSourcePackageName | if the sourcepackagename referred to cannot be found. |
get
, but takes names of objects.Returns | An IBranchNamespace . | |
Raises | NoSuchPerson | if the person referred to cannot be found. |
NoSuchProduct | if the product referred to cannot be found. | |
NoSuchDistribution | if the distribution referred to cannot be found. | |
NoSuchDistroSeries | if the distroseries referred to cannot be- found. | |
NoSuchSourcePackageName | if the sourcepackagename referred to cannot be found. |
Parse 'namespace_name' into its components. The name of a namespace is actually a path containing many elements, each of which maps to a particular kind of object in Launchpad. Elements that can appear in a namespace name are: 'person', 'product', 'distribution', 'distroseries' and 'sourcepackagename'. 'parse' returns a dict which maps the names of these elements (e.g. 'person', 'product') to the values of these elements (e.g. 'mark', 'firefox'). If the given path doesn't include a particular kind of element, the dict maps that element name to None. For example:: parse('~foo/bar') => { 'person': 'foo', 'product': 'bar', 'distribution': None, 'distroseries': None, 'sourcepackagename': None} If the given 'namespace_name' cannot be parsed, then we raise an `InvalidNamespace` error. :raise InvalidNamespace: if the name is too long, too short or is malformed. :return: A dict with keys matching each component in 'namespace_name'.
The iterable 'segments' will be consumed until a branch is found. As soon as a branch is found, the branch will be returned and the consumption of segments will stop. Thus, there will often be unconsumed segments that can be used for further traversal.
Parameters | segments | An iterable of names of Launchpad components. The first segment is the username, not preceded by a '~`. |
Returns | IBranch . | |
Raises | InvalidNamespace | if there are not enough segments to define a branch. |
NoSuchPerson | if the person referred to cannot be found. | |
NoSuchProduct | if the product or distro referred to cannot be found. | |
NoSuchDistribution | if the distribution referred to cannot be found. | |
NoSuchDistroSeries | if the distroseries referred to cannot be- found. | |
NoSuchSourcePackageName | if the sourcepackagename referred to cannot be found. |