Part of canonical.launchpad.webapp.tales View In Hierarchy
Known subclasses: canonical.launchpad.webapp.tales.BranchMergeProposalFormatterAPI, canonical.launchpad.webapp.tales.BranchSubscriptionFormatterAPI, canonical.launchpad.webapp.tales.BugBranchFormatterAPI, canonical.launchpad.webapp.tales.BugFormatterAPI, canonical.launchpad.webapp.tales.BugTaskFormatterAPI, canonical.launchpad.webapp.tales.CodeImportFormatterAPI, canonical.launchpad.webapp.tales.CodeImportMachineFormatterAPI, canonical.launchpad.webapp.tales.CodeReviewCommentFormatterAPI, canonical.launchpad.webapp.tales.DistroSeriesFormatterAPI, canonical.launchpad.webapp.tales.MilestoneFormatterAPI, canonical.launchpad.webapp.tales.PillarFormatterAPI, canonical.launchpad.webapp.tales.PPAFormatterAPI, canonical.launchpad.webapp.tales.ProductReleaseFormatterAPI, canonical.launchpad.webapp.tales.ProductSeriesFormatterAPI, canonical.launchpad.webapp.tales.QuestionFormatterAPI, canonical.launchpad.webapp.tales.SourcePackageFormatterAPI, canonical.launchpad.webapp.tales.SourcePackageRecipeBuildFormatterAPI, canonical.launchpad.webapp.tales.SourcePackageRecipeFormatterAPI, canonical.launchpad.webapp.tales.SourcePackageReleaseFormatterAPI, canonical.launchpad.webapp.tales.SpecificationBranchFormatterAPI, canonical.launchpad.webapp.tales.SpecificationFormatterAPI, lp.registry.browser.distributionsourcepackage.DistributionSourcePackageFormatterAPI
This provides fmt:url and fmt:link support for the object it adapts.
For most object types, only the _link_summary_template class variable and _link_summary_values method need to be overridden. This assumes that:
- canonical_url produces appropriate urls for this type,
- the launchpad.View permission alone is required to view this object's url, and,
- if there is an icon for this object type, image:icon is implemented and appropriate.
For greater control over the summary, overrride _make_link_summary.
If a different permission is required, override _link_permission.
Method | sprite_css | Retrieve the icon for the _context, if any. |
Method | link | Return html including a link, description and icon. |
Method | _link_summary_values | Return a dict of values to use for template substitution. |
Method | _make_link_summary | Create a summary from _template and _link_summary_values(). |
Inherited from ObjectFormatterAPI:
Method | __init__ | Undocumented |
Method | url | Return the object's canonical URL. |
Method | api_url | Return the object's (partial) canonical web service URL. |
Method | traverse | Undocumented |
Method | public_private_css | Return the CSS class that represents the object's privacy. |
Method | pagetitle | The page title to be used. |
These values should not be escaped, as this will be performed later. For this reason, only string values should be supplied.
This summary is for use in fmt:link, which is meant to be used in contexts like lists of items.
Returns | The icon css or None if no icon is available. |
Icon and link are optional, depending on type and permissions. Uses self._make_link_summary for the summary, self._get_icon for the icon, self._should_link to determine whether to link, and self.url() to generate the url.