Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
fceae84a22dd
Commit
1e3cea07
authored
Dec 19, 2019
by
Nicola Spanti
Browse files
[py] Make flake8 less angry with cubicweb/server/test/
parent
d29955a6dbba
Changes
11
Hide whitespace changes
Inline
Side-by-side
cubicweb/server/test/data-migractions/cubicweb_basket/schema.py
View file @
fceae84a
...
...
@@ -9,7 +9,7 @@ class Basket(EntityType):
'add'
:
(
'managers'
,
'users'
,),
'delete'
:
(
'managers'
,
'owners'
,),
'update'
:
(
'managers'
,
'owners'
,),
}
}
name
=
String
(
required
=
True
,
indexed
=
True
,
internationalizable
=
True
,
maxsize
=
128
)
...
...
cubicweb/server/test/data-migractions/cubicweb_card/schema.py
View file @
fceae84a
...
...
@@ -7,7 +7,7 @@ class Card(EntityType):
'add'
:
(
'managers'
,
'users'
),
'delete'
:
(
'managers'
,
'owners'
),
'update'
:
(
'managers'
,
'owners'
,),
}
}
title
=
String
(
required
=
True
,
fulltextindexed
=
True
,
maxsize
=
256
)
synopsis
=
String
(
fulltextindexed
=
True
,
maxsize
=
512
,
...
...
cubicweb/server/test/data-migractions/cubicweb_comment/schema.py
View file @
fceae84a
...
...
@@ -10,7 +10,7 @@ class Comment(EntityType):
'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 @@ class comments(RelationType):
'read'
:
(
'managers'
,
'users'
,
'guests'
),
'add'
:
(
'managers'
,
'users'
,),
'delete'
:
(
'managers'
,
RRQLExpression
(
'S owned_by U'
),),
}
}
inlined
=
True
composite
=
'object'
cardinality
=
'1*'
cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py
View file @
fceae84a
from
yams.buildobjs
import
EntityType
,
make_type
Numeric
=
make_type
(
'Numeric'
)
class
Location
(
EntityType
):
num
=
Numeric
(
scale
=
10
,
precision
=
18
)
cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py
View file @
fceae84a
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 @@ def pg_numeric_sqltype(rdef):
"""
return
'numeric(%s, %s)'
%
(
rdef
.
precision
,
rdef
.
scale
)
pghelper
.
TYPE_MAPPING
[
'Numeric'
]
=
pg_numeric_sqltype
cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py
View file @
fceae84a
...
...
@@ -13,10 +13,10 @@ author_email = "contact@logilab.fr"
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 @@ from glob import glob
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
...
...
cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py
View file @
fceae84a
...
...
@@ -42,7 +42,7 @@ class EmailPart(EntityType):
'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 @@ class EmailThread(EntityType):
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
):
...
...
cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py
View file @
fceae84a
...
...
@@ -10,7 +10,7 @@ class Comment(EntityType):
'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 @@ class comments(RelationType):
'read'
:
(
'managers'
,
'users'
,
'guests'
),
'add'
:
(
'managers'
,
'users'
,),
'delete'
:
(
'managers'
,
RRQLExpression
(
'S owned_by U'
),),
}
}
inlined
=
True
composite
=
'object'
cardinality
=
'1*'
cubicweb/server/test/data-migractions/schema.py
View file @
fceae84a
...
...
@@ -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 <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU Lesser General Public License
#
along
with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
from
yams.buildobjs
import
(
EntityType
,
RelationType
,
RelationDefinition
,
ComputedRelation
,
SubjectRelation
,
RichString
,
String
,
Int
,
Float
,
...
...
@@ -30,10 +30,14 @@ from cubicweb import _
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 @@ class Societe(EntityType):
'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 Societe(EntityType):
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 @@ class Note(WorkflowableEntityType):
})
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 Old(EntityType):
class
connait
(
RelationType
):
symmetric
=
True
class
concerne
(
RelationType
):
__permissions__
=
{
'read'
:
(
'managers'
,
'users'
,
'guests'
),
...
...
@@ -175,6 +185,7 @@ class concerne(RelationType):
'delete'
:
(
'managers'
,
RRQLExpression
(
'O owned_by U'
)),
}
class
travaille
(
RelationDefinition
):
__permissions__
=
{
'read'
:
(
'managers'
,
'users'
,
'guests'
),
...
...
@@ -186,16 +197,19 @@ class travaille(RelationDefinition):
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 @@ class see_also_1(RelationDefinition):
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 @@ class evaluee(RelationDefinition):
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 ecrit_par_2(RelationDefinition):
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 @@ class Folder(EntityType):
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 @@ class login_user(RelationDefinition):
object
=
'CWUser'
cardinality
=
'??'
class
ambiguous_inlined
(
RelationDefinition
):
subject
=
(
'Affaire'
,
'Note'
)
object
=
'CWUser'
...
...
cubicweb/server/test/data-schemaserial/schema.py
View file @
fceae84a
...
...
@@ -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
)
...
...
cubicweb/server/test/data-schemaserial/site_cubicweb.py
View file @
fceae84a
...
...
@@ -20,9 +20,11 @@ from logilab.database import FunctionDescr
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment