Skip to content
Snippets Groups Projects
schema.py 942 B
Newer Older
from yams.buildobjs import EntityType, String, SubjectRelation
Sylvain Thénault's avatar
Sylvain Thénault committed
from cubicweb.schema import WorkflowableEntityType, ERQLExpression
Sylvain Thénault's avatar
Sylvain Thénault committed
try:
    from yams.buildobjs import RichString
except ImportError:
    from cubicweb.schema import RichString

Nicolas Chauvat's avatar
Nicolas Chauvat committed

class Blog(EntityType):
    title = String(maxsize=50, required=True)
Sylvain Thénault's avatar
Sylvain Thénault committed
    description = RichString()
sylvain thenault's avatar
sylvain thenault committed
    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')
        }
Nicolas Chauvat's avatar
Nicolas Chauvat committed
    title = String(required=True, fulltextindexed=True, maxsize=256)
Sylvain Thénault's avatar
Sylvain Thénault committed
    content = RichString(required=True, fulltextindexed=True)
    entry_of = SubjectRelation('Blog', cardinality='**')