tseaver / candide

TTW schemas / propertysheets for SubstanceD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

candide README

This application demonstrates defining colander schemas as through-the-web (TWW) objects, managed in SubstanceD Schema definitions are managed as YAML, using the bindings defined in sweetpotatopie.

Defining Schemas

In the SubstanceD management interface (SDI), visit the schemas service, found in the ZODB root. For each content type which should have a TTW schema, add a TTWSchema object, naming it for the content type (e.g., 'Document').

Edit the 'yaml' property, using the sweetpotatopie documentation as a guide. E.g.:

!schema
  children:
    - !field.string
      name: title
    - !field.integer
      name: rating
    - !field.float
      name: weight
    - !field.decimal
      name: price
    - !field.boolean
      name: active
    - !field.datetime
      name: expires
    - !field.date
      name: joined

Associating Schemas with Types

Any type which should use a TTW schema needs (for now) to add a propertysheet to its SubstanceD @content registration. E.g.:

from candide.property import CandidePropertysheet
from persistent import Persistent
from substanced.content import content

@content(
    'MyType',
    add_view='add_my_type',
    propertysheets = (
        # others...
        ('TTW', CandidePropertysheet),
    )
)
class MyType(Persistent):
    pass

This package defines a 'Document' type which enables such a propertysheet.

About

TTW schemas / propertysheets for SubstanceD


Languages

Language:Python 100.0%