Resources
Application resources, documents, and models.
-
piano.resources.create_root(request)[source]
Create the context tree and wires parent/child classes together.
-
class piano.resources.contexts.App(key=None, parent=None, **kwargs)[source]
The app segment specifies which ‘database’ is used for all segments
following. At a high-level it represents the application being accessed
and is the master container for sites and pages. If the database does not
exist during an operation it will be created.
-
list_sites()[source]
Returns a list of sites under the application.
-
class piano.resources.contexts.Service(key=None, parent=None, **kwargs)[source]
The service segment (/services) acts as the entry-point for all services
that are exposed. Currently, this comprises RESTful services only.
-
class piano.resources.contexts.Site(key=None, parent=None, **kwargs)[source]
The site segment represents the entry-point into a collection of pages.
An application can have many sites and each site can have many pages.
-
delete()[source]
Deletes the site and its associated collection.
-
classmethod find(key, parent)[source]
Returns a single site by its slug.
-
save(include_default=False)[source]
Saves the primary site details and creates a new collection to house
the pages in. It also creates a default (Home) page if needed.
-
class piano.resources.contexts.Page(key=None, parent=None, **kwargs)[source]
The page segment represents an individual page (i.e. home, contact us,
site map, etc.). If the page segment extends beyond a single element it
will continue to look up pages until a KeyError is raised at which point
the view is invoked/resolved.
-
classmethod find(key, parent)[source]
Finds a single page by its parent and slug.
-
save()[source]
Creates a new page and associates it to a parent.
-
template[source]
Returns the primary view template in the form
[app].[module]:[template].mako.
Example: sample.home:main.mako
-
class piano.resources.contexts.Root(request)[source]
The root segment is the entry-point into the context tree. From the
root it will try to find an application, then the site, then any pages. The
only exception are services (/services) which can only be accessed from the
the root.
-
class piano.resources.documents.SiteDocument(doc=None, gen_skel=True, collection=None, lang='en', fallback_lang='en')[source]
“Document representation of a site.
-
class piano.resources.documents.PageDocument(doc=None, gen_skel=True, collection=None, lang='en', fallback_lang='en')[source]
“Document representation of a page.
-
class piano.resources.interfaces.IApp(name, bases=(), attrs=None, __doc__=None, __module__=None)[source]
Marker interface for an application context.
-
class piano.resources.interfaces.ISite(name, bases=(), attrs=None, __doc__=None, __module__=None)[source]
Marker interface for a site context.