cubicweb/devtools/test/data/cubes/i18ntestcube/schema.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Sat, 16 Jan 2016 13:48:51 +0100
changeset 11057 0b59724cb3f2
parent 9153 devtools/test/data/cubes/i18ntestcube/schema.py@bc1b8e77d6ce
permissions -rw-r--r--
Reorganize source tree to have a "cubicweb" top-level package Basically: mkdir cubicweb hg mv *.py -X setup.py cubicweb hg mv dataimport devtools entities etwist ext hooks i18n misc schemas server skeleton sobjects test web wsgi cubicweb Other changes: * adjust path to cubicweb-ctl in devtools tests * update setup.py to avoid importing __pkginfo__ (exec it instead), replace os.path.walk by os.walk and prepend `modname` here and there * update tox.ini to account for new test locations * update doc/conf.py so that it still finds __pkginfo__.py and CWDIR in doc/Makefile
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9153
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     2
# copyright 2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     3
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     4
#
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     5
# This program is free software: you can redistribute it and/or modify it under
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     6
# the terms of the GNU Lesser General Public License as published by the Free
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     7
# Software Foundation, either version 2.1 of the License, or (at your option)
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     8
# any later version.
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
     9
#
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    10
# This program is distributed in the hope that it will be useful, but WITHOUT
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    12
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    13
# details.
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    14
#
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    15
# You should have received a copy of the GNU Lesser General Public License along
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    16
# with this program. If not, see <http://www.gnu.org/licenses/>.
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    17
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    18
"""cubicweb-forum schema"""
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    19
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    20
from yams.buildobjs import (String, RichString, EntityType,
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    21
                            RelationDefinition, SubjectRelation)
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    22
from yams.reader import context
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    23
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    24
class Forum(EntityType):
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    25
    topic = String(maxsize=50, required=True, unique=True)
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    26
    description = RichString()
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    27
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    28
class ForumThread(EntityType):
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    29
    __permissions__ = {
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    30
        'read': ('managers', 'users'),
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    31
        'add': ('managers', 'users'),
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    32
        'update': ('managers', 'owners'),
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    33
        'delete': ('managers', 'owners')
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    34
        }
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    35
    title = String(required=True, fulltextindexed=True, maxsize=256)
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    36
    content = RichString(required=True, fulltextindexed=True)
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    37
    in_forum = SubjectRelation('Forum', cardinality='1*', inlined=True,
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    38
                               composite='object')
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    39
class interested_in(RelationDefinition):
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    40
    subject = 'CWUser'
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    41
    object = ('ForumThread', 'Forum')
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    42
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    43
class nosy_list(RelationDefinition):
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    44
    subject = ('Forum', 'ForumThread')
bc1b8e77d6ce [test/devctl] add a test case for i18ncube command
David Douard <david.douard@logilab.fr>
parents:
diff changeset
    45
    object = 'CWUser'