Overview

The examples repository contains several Python packages which demonstrate various Ptah usage. The examples are not released individually as packages. You are expected to git clone this repository and work from there.

Installation

Get the source:

git clone git://github.com/ptahproject/examples.git

Change to the directory of the example you would like startup:

cd examples/ptah_minicms

Then run /virtualenv/bin/python setup.py develop.

Lastly startup pyramid using the .ini settings file:

/virtualenv/bin/pserve settings.ini --reload

Examples

ptah_models

The ptah_models package demonstrates:

  • Pyramid developer toolbar
  • A homepage view
  • Ptah Manage is accessible without authenticating
  • Form used for content entry of a model, ptah_models.models.Link
  • Manually constructed Form which does nothing but validates/accepts values
  • A example Form Field is available. It is a colorpicker javascript widget.

Dependencies:

ptah_simpleauth

The ptah_simpleauth package demonstrates:

  • Pyramid developer toolbar
  • A homepage view
  • Ptah Manage requires authentication

Dependencies:

ptah_minicms

A miniature Content Management System (CMS) example which provides a sophisticated experience and demonstration of Ptah capabilities.

This package provides:

  • Content types/models: File, Page, and Folder
  • Layout preview functionality
  • Sharing UI to assign users roles per item or folder
  • Homepage view
  • User management by using ptah_crowd
  • Folder operations on items: cut, copy, paste and rename.

Dependencies:

simple_forms

This directory contains two examples of form generation using Ptah’s form library. The idea is to show how to generate forms using the two configuration approaches provided by the form library.

These examples do not use pserve to run. Just use the python environment where you have installed ptah.

Example of running one of the simple_forms examples:

$ cd examples/simple_forms
$ /virtualenv/bin/python form_declarative.py

form_declarative.py

Example of using ptah.form declaratively. The form example subclasses ptah.form.Form and has a validator.

form_imperative.py

Example of using ptah.form imperatively. The form is instantiated and fields are added manually.

simple_layout

Ptah provides a pyramid.renderers independent mechanism to provide template composition (e.g. template inheritance). The ptah_minicms provides an example of layout preview which draws borders around the layouts.

This is a simple example of Ptah layouts, which shows how to define layouts and how to assign them to different parts of a site.

layout.py

Project Versions

Table Of Contents

Previous topic

Ptah Examples

Next topic

License

This Page