Libraries

Library classes and helpers.

piano.libs.base

class piano.lib.base.ContextBase(key=None, parent=None, **kwargs)[source]

Base (abstract) class for all resources (contexts).

appname[source]

Returns the name of the application.

get_conn(app=None, site=None)[source]

Returns a raw MongoDB connection. If none of the arguments are set it will try to configure the connection based on the instances app and site name. Otherwise, it is up to you to choose the database and collection to use.

sitename[source]

Returns the name of the site.

class piano.lib.base.DocumentBase(doc=None, gen_skel=True, collection=None, lang='en', fallback_lang='en')[source]

Base (abstract) class for all documents (MongoDB).

piano.libs.crumb

class piano.lib.crumb.Breadcrumb(uri=None)[source]

Tracks the current position within the site and creates a breadcrumb trail.

Returns the list of links which make up the breadcrumb at the current level.

piano.libs.mongo

piano.lib.mongo.setup_db(config, settings, full_index=False)[source]

Sets up MongoDB, registers the connection (and its cleanup) in the request, and ensures all of the indexes are set.

piano.lib.mongo.ensure_indexes(full_index=False)[source]

Hard-coded utility function to ensure the proper indexes are set across all of the databases and collections (excluding system ones).

piano.lib.mongo.mongodb_subscriber(event)[source]

Attaches a MongoDB connection to the current request.

piano.lib.mongo.mongodb_cleanup_subscriber(event)[source]

Releases the MongoDB connection which was attached to the request.

piano.libs.mvc

class piano.lib.mvc.PageModel(context, **kwargs)[source]

PageModel to standardize the dict values used across pages.

piano.libs.rest

piano.lib.rest.invoke(url)[source]

Invokes a RESTful URL and converts the response to a Python dict().

piano.libs.helpers

piano.lib.helpers.now()[source]

Table Of Contents

Previous topic

Constants

Next topic

Resources

This Page