SaWALi Models

Models - DocSettingsBase

Models - DocSettingsBase

Description

Derived from BaseModel, this model defines SaWALi's main site sections. A section is basically a collection of related documents that reside in their own database— as in this site's case: Home, Portfolio, Development, Journal. DocSettingsBase provides the global settings for each documents database.

Properties

All inherited from BaseModel.

Database Schema

[buzhug record default properties]
These include __id__, __version__, etc.
name (Unicode)
Short title of the site section, like "Blog".
title (Unicode)
Full title of the site section, like "My Personal Weblog".
template (Unicode)
Filename of the default section template, which should be in "templates/public".
weight (Integer)
Indicates where the section's link is to be placed relative to other section links. The "heavier" a section is, the nearer its link will be placed to the end of a group of section links.

Methods

__init__
Initialises the BaseModel super-class passing "DocSettings" as the prefix.
_create_schema
Override to BaseModel._create_schema, see Database Schema heading.
get (section_name)
Selects a section record by its `name`.
get_menu_items
Generates a list of dictionaries sorted according to `weight` and `name`. These dictionaries are primarily used by a controller for generating a Mako context property.
remove_section (section)
Removes a section from the database. The documents database related to it has to be removed from disk manually.
validate_and_update (section, post_info)
Validates POST information and updates a section record accordingly. Returns True on success, False on failure.