Part of lp.services.webapp View In Hierarchy
Base class for views in Launchpad.
Available attributes and methods are:
context
request
initialize() <-- subclass this for specific initialization
template <-- the template set from zcml, otherwise not present
user <-- currently logged-in user
many templates not set via zcml, or you want to do rendering from Python.
publishTraverse() <-- override this to support traversing-through.
override this if the view has special privacy needs (i.e. context doesn't properly indicate privacy).
Method | private | A view is private if its context is. |
Method | information_type | A view has the information_type of its context. |
Method | information_type_description | A view has the information_type_description of its context. |
Method | __init__ | Undocumented |
Method | beta_features | Undocumented |
Method | initialize | Override this in subclasses. |
Method | page_description | Return a string containing a description of the context. |
Method | template | The page's template, if configured in zcml. |
Method | yui_version | The version of YUI we are using. |
Method | yui_console_debug | Hide console debug messages in production. |
Method | combo_url | Return the URL for the combo loader. |
Method | render | Return the body of the response. |
Method | __call__ | Undocumented |
Method | getCacheJSON | Undocumented |
Method | publishTraverse | See IBrowserPublisher. |
Method | recommended_canonical_url | Canonical URL to be recommended in metadata. |
Method | related_feature_info | Related feature flags that are active for this context and scope. |
Method | _get_json_cache | Undocumented |
Method | _isRedirected | Return True if a redirect was requested. |
Method | _getErrorMessage | Property getter for error_message . |
Method | _setErrorMessage | Property setter for error_message . |
Method | _getInfoMessage | Property getter for info_message . |
Method | _setInfoMessage | Property setter for info_message . |
Inherited from UserAttributeCache:
Method | account | Undocumented |
Method | user | The logged-in Person, or None if there is no one logged in. |
Typically this is the contents of the most-descriptive text attribute of the context, by default its 'description' attribute if there is one.
This will be inserted into the HTML meta description, and may eventually end up in search engine summary results, or when a link to the page is shared elsewhere.
This may be specialized by view subclasses.
Do not write eg "This is a page about...", just directly describe the object on the page.
If the mime type of request.response starts with text/, then the result of this method is encoded to the charset of request.response. If there is no charset, it is encoded to utf8. Otherwise, the result of this method is treated as bytes.
XXX: Steve Alexander says this is a convenient lie. That is, its not quite right, but good enough for most uses.
Check if the response status is one of 301, 302, 303 or 307.
error_message
.
Enforces error_message
values that are either None or
implement IStructuredString.
info_message
.
Enforces info_message
values that are either None or
implement IStructuredString.
Used to generate <link rel="canonical"> to hint that pages with different URLs are actually (at least almost) functionally and semantically identical.
See http://www.google.com/support/webmasters/bin/ answer.py?answer=139394 "Canonical is a long word that means my preferred or my primary."
Google (at least) will primarily, but not absolutely certainly, treat these pages as duplicates, so don't use this if there's any real chance the user would want to specifically find one of the non-duplicate pages.
Most views won't need this.
This property describes all features marked as related_features in the view. is_beta means that the value is not the default value.
Return a dict of flags keyed by flag_name, with title and url as given by the flag's description. Value is the value in the current scope, and is_beta is true if this is not the default value.