cubicweb/web/test/data/cubicweb_blog/schema.py
author Philippe Pepiot <philippe.pepiot@logilab.fr>
Tue, 19 Mar 2019 13:17:47 +0100
changeset 12519 aff5d3498f68
permissions -rw-r--r--
[web/test] drop dependency on third party cubes Drop dependency on cubicweb-file, cubicweb-blog and cubicweb-tag for cubicweb/web/test Copy required parts of cubes (schema, entities, views and hooks) into cubicweb/web/test/data/cubicweb-<cube> that make tests pass.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12519
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     1
from yams.buildobjs import EntityType, String, RichString, SubjectRelation
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     2
from cubicweb.schema import WorkflowableEntityType, ERQLExpression
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     3
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     4
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     5
class Blog(EntityType):
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     6
    title = String(maxsize=50, required=True)
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     7
    description = RichString()
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     8
    rss_url = String(maxsize=128, description=(
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
     9
        'blog\'s rss url (useful for when using external site such as feedburner)'))
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    10
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    11
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    12
class BlogEntry(WorkflowableEntityType):
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    13
    __permissions__ = {
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    14
        'read': ('managers', 'users', ERQLExpression('X in_state S, S name "published"'),),
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    15
        'add': ('managers', 'users'),
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    16
        'update': ('managers', 'owners'),
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    17
        'delete': ('managers', 'owners')
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    18
    }
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    19
    title = String(required=True, fulltextindexed=True, maxsize=256)
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    20
    content = RichString(required=True, fulltextindexed=True)
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    21
    entry_of = SubjectRelation('Blog')
aff5d3498f68 [web/test] drop dependency on third party cubes
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
diff changeset
    22
    same_as = SubjectRelation('ExternalUri')