schema.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 09 May 2010 20:20:48 +0200
changeset 205 246ca4f3030e
parent 160 65c3bb0b8e0c
child 216 e8340fe485c9
permissions -rw-r--r--
backport stable

from yams.buildobjs import EntityType, String, RichString, SubjectRelation
from cubicweb.schema import WorkflowableEntityType, ERQLExpression

class Blog(EntityType):
    title = String(maxsize=50, required=True)
    description = RichString()
    rss_url = String(maxsize=128, description=_('blog\'s rss url (useful for when using external site such as feedburner)'))


class BlogEntry(WorkflowableEntityType):
    __permissions__ = {
        'read': ('managers', 'users', ERQLExpression('X in_state S, S name "published"'),),
        'add': ('managers', 'users'),
        'update': ('managers', 'owners'),
        'delete': ('managers', 'owners')
        }
    title = String(required=True, fulltextindexed=True, maxsize=256)
    content = RichString(required=True, fulltextindexed=True)
    entry_of = SubjectRelation('Blog', cardinality='**')