# HG changeset patch # User Nicola Spanti # Date 1576764790 -3600 # Node ID fceae84a22dde82fc37fcd60803477794124d96e # Parent d29955a6dbba9fc64389350c3f932a73fa47b4de [py] Make flake8 less angry with cubicweb/server/test/ diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_basket/schema.py --- a/cubicweb/server/test/data-migractions/cubicweb_basket/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_basket/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -9,7 +9,7 @@ 'add': ('managers', 'users',), 'delete': ('managers', 'owners',), 'update': ('managers', 'owners',), - } + } name = String(required=True, indexed=True, internationalizable=True, maxsize=128) diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_card/schema.py --- a/cubicweb/server/test/data-migractions/cubicweb_card/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_card/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -7,7 +7,7 @@ 'add': ('managers', 'users'), 'delete': ('managers', 'owners'), 'update': ('managers', 'owners',), - } + } title = String(required=True, fulltextindexed=True, maxsize=256) synopsis = String(fulltextindexed=True, maxsize=512, diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_comment/schema.py --- a/cubicweb/server/test/data-migractions/cubicweb_comment/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_comment/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -10,7 +10,7 @@ 'add': ('managers', 'users',), 'delete': ('managers', 'owners',), 'update': ('managers', 'owners',), - } + } content = RichString(required=True, fulltextindexed=True) comments = SubjectRelation('Comment', cardinality='1*', composite='object') @@ -20,7 +20,7 @@ 'read': ('managers', 'users', 'guests'), 'add': ('managers', 'users',), 'delete': ('managers', RRQLExpression('S owned_by U'),), - } + } inlined = True composite = 'object' cardinality = '1*' diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py --- a/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -1,7 +1,7 @@ - from yams.buildobjs import EntityType, make_type Numeric = make_type('Numeric') + class Location(EntityType): num = Numeric(scale=10, precision=18) diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py --- a/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py Thu Dec 19 15:13:10 2019 +0100 @@ -1,6 +1,5 @@ from yams import register_base_type from logilab.database import get_db_helper -from logilab.database.sqlgen import SQLExpression _NUMERIC_PARAMETERS = {'scale': 0, 'precision': None} register_base_type('Numeric', _NUMERIC_PARAMETERS) @@ -14,4 +13,5 @@ """ return 'numeric(%s, %s)' % (rdef.precision, rdef.scale) + pghelper.TYPE_MAPPING['Numeric'] = pg_numeric_sqltype diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py --- a/cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py Thu Dec 19 15:13:10 2019 +0100 @@ -13,10 +13,10 @@ web = 'http://www.cubicweb.org/project/%s' % distname description = "email component for the CubicWeb framework" classifiers = [ - 'Environment :: Web Environment', - 'Framework :: CubicWeb', - 'Programming Language :: Python', - 'Programming Language :: JavaScript', + 'Environment :: Web Environment', + 'Framework :: CubicWeb', + 'Programming Language :: Python', + 'Programming Language :: JavaScript', ] # used packages @@ -35,18 +35,21 @@ THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname) + def listdir(dirpath): return [join(dirpath, fname) for fname in _listdir(dirpath) if fname[0] != '.' and not fname.endswith('.pyc') and not fname.endswith('~') and not isdir(join(dirpath, fname))] + data_files = [ # common files [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']], - ] +] # check for possible extended cube layout -for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration', 'wdoc'): +for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', + 'i18n', 'migration', 'wdoc'): if isdir(dirname): data_files.append([join(THIS_CUBE_DIR, dirname), listdir(dirname)]) # Note: here, you'll need to add subdirectories if you want diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py --- a/cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -42,7 +42,7 @@ 'add': ('managers', ERQLExpression('E parts X, U has_update_permission E'),), 'delete': ('managers', ERQLExpression('E parts X, U has_update_permission E')), 'update': ('managers', 'owners',), - } + } content = String(fulltextindexed=True) content_format = String(required=True, maxsize=50) @@ -56,28 +56,34 @@ see_also = SubjectRelation('EmailThread') forked_from = SubjectRelation('EmailThread', cardinality='?*') + class parts(RelationType): """ """ fulltext_container = 'subject' + class sender(RelationType): """ """ inlined = True + class in_thread(RelationType): """ """ inlined = True + class reply_to(RelationType): """ """ inlined = True + class generated_by(RelationType): """mark an entity as generated from an email""" cardinality = '?*' subject = ('TrInfo',) object = 'Email' + # if comment is installed if 'Comment' in context.defined: class comment_generated_by(RelationDefinition): diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py --- a/cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -10,7 +10,7 @@ 'add': ('managers', 'users',), 'delete': ('managers', 'owners',), 'update': ('managers', 'owners',), - } + } content = RichString(required=True, fulltextindexed=True) comments = SubjectRelation('Comment', cardinality='1*', composite='object') @@ -20,7 +20,7 @@ 'read': ('managers', 'users', 'guests'), 'add': ('managers', 'users',), 'delete': ('managers', RRQLExpression('S owned_by U'),), - } + } inlined = True composite = 'object' cardinality = '1*' diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-migractions/schema.py --- a/cubicweb/server/test/data-migractions/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-migractions/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -13,8 +13,8 @@ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # -# You should have received a copy of the GNU Lesser General Public License along -# with CubicWeb. If not, see . +# You should have received a copy of the GNU Lesser General Public License +# along with CubicWeb. If not, see . from yams.buildobjs import (EntityType, RelationType, RelationDefinition, ComputedRelation, SubjectRelation, RichString, String, Int, Float, @@ -30,10 +30,14 @@ class Affaire(WorkflowableEntityType): __permissions__ = { 'read': ('managers', - ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), + ERQLExpression('X owned_by U'), + ERQLExpression('X concerne S?, S owned_by U')), 'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), - 'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')), - 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), + 'update': ('managers', 'owners', + ERQLExpression('X in_state S, ' + 'S name in ("pitetre", "en cours")')), + 'delete': ('managers', 'owners', + ERQLExpression('X concerne S, S owned_by U')), } ref = String(fulltextindexed=True, indexed=True, @@ -61,7 +65,7 @@ 'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')), 'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')), 'add': ('managers', 'users',) - } + } nom = String(maxsize=64, fulltextindexed=True) web = String(maxsize=128) @@ -79,13 +83,16 @@ class Division(Societe): __specializes_schema__ = True + class SubDivision(Division): __specializes_schema__ = True + class travaille_subdivision(RelationDefinition): subject = 'Personne' object = 'SubDivision' + from cubicweb.schemas.base import CWUser next(CWUser.get_relations('login')).fulltextindexed = True @@ -106,10 +113,12 @@ }) migrated_from = SubjectRelation('Note') attachment = SubjectRelation('File') - inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*', - constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, ' - 'Y type T, Y inline1 A2, A2 todo_by C', - 'S,Y')]) + inline1 = SubjectRelation( + 'Affaire', inlined=True, cardinality='?*', + constraints=[ + RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, ' + 'Y type T, Y inline1 A2, A2 todo_by C', + 'S,Y')]) todo_by = SubjectRelation('CWUser') @@ -168,6 +177,7 @@ class connait(RelationType): symmetric = True + class concerne(RelationType): __permissions__ = { 'read': ('managers', 'users', 'guests'), @@ -175,6 +185,7 @@ 'delete': ('managers', RRQLExpression('O owned_by U')), } + class travaille(RelationDefinition): __permissions__ = { 'read': ('managers', 'users', 'guests'), @@ -186,16 +197,19 @@ constraints = [RQLVocabularyConstraint('S owned_by U'), RQLVocabularyConstraint('S created_by U')] + class comments(RelationDefinition): subject = 'Comment' object = 'Personne' + class fiche(RelationDefinition): inlined = True subject = 'Personne' object = 'Card' cardinality = '??' + class multisource_inlined_rel(RelationDefinition): inlined = True cardinality = '?*' @@ -207,11 +221,13 @@ name = 'see_also' subject = object = 'Folder' + class see_also_2(RelationDefinition): name = 'see_also' subject = ('Bookmark', 'Note') object = ('Bookmark', 'Note') + class evaluee(RelationDefinition): subject = ('Personne', 'CWUser', 'Societe') object = ('Note') @@ -220,15 +236,18 @@ RQLVocabularyConstraint('S owned_by U'), ] + class ecrit_par(RelationType): inlined = True + class ecrit_par_1(RelationDefinition): name = 'ecrit_par' subject = 'Note' object = 'Personne' cardinality = '?*' + class ecrit_par_2(RelationDefinition): name = 'ecrit_par' subject = 'Note' @@ -239,10 +258,12 @@ class copain(RelationDefinition): subject = object = 'CWUser' + class tags(RelationDefinition): subject = 'Tag' object = ('CWUser', 'CWGroup', 'State', 'Note', 'Card', 'Affaire') + class Folder(EntityType): """folders are used to classify entities. They may be defined as a tree. """ @@ -251,23 +272,28 @@ description = RichString(fulltextindexed=True) filed_under = SubjectRelation('Folder', description=_('parent folder')) + class filed_under(RelationDefinition): subject = ('Note', 'Affaire') object = 'Folder' + class require_permission(RelationDefinition): subject = ('Card', 'Note', 'Personne') object = 'CWPermission' + class require_state(RelationDefinition): subject = 'CWPermission' object = 'State' + class personne_composite(RelationDefinition): subject='Personne' object='Personne' composite='subject' + class personne_inlined(RelationDefinition): subject='Personne' object='Personne' @@ -280,6 +306,7 @@ object = 'CWUser' cardinality = '??' + class ambiguous_inlined(RelationDefinition): subject = ('Affaire', 'Note') object = 'CWUser' diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-schemaserial/schema.py --- a/cubicweb/server/test/data-schemaserial/schema.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-schemaserial/schema.py Thu Dec 19 15:13:10 2019 +0100 @@ -19,9 +19,11 @@ from yams.buildobjs import EntityType, SubjectRelation, String, make_type BabarTestType = make_type('BabarTestType') + class Affaire(EntityType): nom = String(unique=True, maxsize=64) + class Personne(EntityType): __unique_together__ = [('nom', 'prenom', 'inline2')] nom = String(fulltextindexed=True, required=True, maxsize=64) diff -r d29955a6dbba -r fceae84a22dd cubicweb/server/test/data-schemaserial/site_cubicweb.py --- a/cubicweb/server/test/data-schemaserial/site_cubicweb.py Wed Dec 18 05:39:03 2019 +0100 +++ b/cubicweb/server/test/data-schemaserial/site_cubicweb.py Thu Dec 19 15:13:10 2019 +0100 @@ -20,9 +20,11 @@ from logilab.database.sqlite import register_sqlite_pyfunc from rql.utils import register_function + class DUMB_SORT(FunctionDescr): pass + register_function(DUMB_SORT) def dumb_sort(something): return something