Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
94588f6e828d
Commit
f333f662
authored
Feb 17, 2021
by
Laurent Peuch
Browse files
fix: it's 2021 let's use utf-8
parent
5eade1b1c9d6
Pipeline
#35685
passed with stage
in 1 minute and 41 seconds
Changes
7
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
cubicweb/devtools/fill.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
@@ -47,7 +47,7 @@ def decompose_b26(index, ascii=False):
"""return a letter (base-26) decomposition of index"""
if
ascii
:
return
base_decompose_b26
(
index
)
return
base_decompose_b26
(
index
,
u
'abcdefghijklmnopqrstuvwxyz'
)
return
base_decompose_b26
(
index
,
u
'
é
abcdefghijklmnopqrstuvwxyz'
)
def
get_max_length
(
eschema
,
attrname
):
"""returns the maximum length allowed for 'attrname'"""
...
...
@@ -120,7 +120,7 @@ class _ValueGenerator(object):
# always use plain text when no format is specified
attrprefix
=
attrname
[:
max
(
attrlength
-
num_len
-
1
,
0
)]
if
format
==
'text/html'
:
value
=
u
'<span>%s<b>%d</b></span>'
%
(
attrprefix
,
index
)
value
=
u
'<span>
é
%s<b>%d</b></span>'
%
(
attrprefix
,
index
)
elif
format
==
'text/rest'
:
value
=
u
"""
title
...
...
@@ -128,10 +128,10 @@ title
* %s
* %d
* &
*
é
&
"""
%
(
attrprefix
,
index
)
else
:
value
=
u
'&%s%d'
%
(
attrprefix
,
index
)
value
=
u
'
é
&%s%d'
%
(
attrprefix
,
index
)
return
value
[:
attrlength
]
def
generate_password
(
self
,
entity
,
attrname
,
index
):
...
...
cubicweb/devtools/test/unittest_dbfill.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
@@ -66,7 +66,7 @@ class ValueGeneratorTC(TestCase):
def
test_string
(
self
):
"""test string generation"""
surname
=
self
.
person_valgen
.
generate_attribute_value
({},
'surname'
,
12
)
self
.
assertEqual
(
surname
,
u
'&surname12'
)
self
.
assertEqual
(
surname
,
u
'
é
&surname12'
)
def
test_domain_value
(
self
):
"""test value generation from a given domain value"""
...
...
cubicweb/devtools/test/unittest_i18n.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
cubicweb/server/test/unittest_querier.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
@@ -690,18 +690,18 @@ class QuerierTC(BaseQuerierTC):
## self.assertEqual(rset.rows[0][0], 'admin')
def
test_select_searchable_text_1
(
self
):
rset
=
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bidle'"
)
rset
=
self
.
qexecute
(
u
"INSERT Societe X: X nom 'bidle'"
)
rset
=
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bid
ü
le'"
)
rset
=
self
.
qexecute
(
u
"INSERT Societe X: X nom 'bid
ü
le'"
)
rset
=
self
.
qexecute
(
"INSERT Societe X: X nom 'chouette'"
)
rset
=
self
.
qexecute
(
'Any X where X has_text %(text)s'
,
{
'text'
:
u
'bidle'
})
rset
=
self
.
qexecute
(
'Any X where X has_text %(text)s'
,
{
'text'
:
u
'bid
ü
le'
})
self
.
assertEqual
(
len
(
rset
.
rows
),
2
,
rset
.
rows
)
rset
=
self
.
qexecute
(
u
'Any N where N has_text "bidle"'
)
rset
=
self
.
qexecute
(
u
'Any N where N has_text "bid
ü
le"'
)
self
.
assertEqual
(
len
(
rset
.
rows
),
2
,
rset
.
rows
)
biduleeids
=
[
r
[
0
]
for
r
in
rset
.
rows
]
rset
=
self
.
qexecute
(
u
'Any N where NOT N has_text "bidle"'
)
rset
=
self
.
qexecute
(
u
'Any N where NOT N has_text "bid
ü
le"'
)
self
.
assertFalse
([
r
[
0
]
for
r
in
rset
.
rows
if
r
[
0
]
in
biduleeids
])
# duh?
rset
=
self
.
qexecute
(
'Any X WHERE X has_text %(text)s'
,
{
'text'
:
u
'a'
})
rset
=
self
.
qexecute
(
'Any X WHERE X has_text %(text)s'
,
{
'text'
:
u
'
ç
a'
})
def
test_select_searchable_text_2
(
self
):
rset
=
self
.
qexecute
(
"INSERT Personne X: X nom 'bidule'"
)
...
...
@@ -718,11 +718,11 @@ class QuerierTC(BaseQuerierTC):
self
.
assertEqual
(
len
(
rset
.
rows
),
1
,
rset
.
rows
)
def
test_select_multiple_searchable_text
(
self
):
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bidle'"
)
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bid
ü
le'"
)
self
.
qexecute
(
"INSERT Societe X: X nom 'chouette', S travaille X"
)
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bidle'"
)
self
.
qexecute
(
u
"INSERT Personne X: X nom 'bid
ü
le'"
)
rset
=
self
.
qexecute
(
'Personne X WHERE X has_text %(text)s, X travaille S, S has_text %(text2)s'
,
{
'text'
:
u
'bidle'
,
{
'text'
:
u
'bid
ü
le'
,
'text2'
:
u
'chouette'
,}
)
self
.
assertEqual
(
len
(
rset
.
rows
),
1
,
rset
.
rows
)
...
...
@@ -1495,7 +1495,7 @@ Any P1,B,E WHERE P1 identity P2 WITH
self
.
qexecute
(
"INSERT Tag X: X name %(name)s,"
"X modification_date %(modification_date)s,"
"X creation_date %(creation_date)s"
,
{
'name'
:
u
'name0'
,
{
'name'
:
u
'
é
name0'
,
'modification_date'
:
'2003/03/12 11:00'
,
'creation_date'
:
'2000/07/03 11:00'
})
rset
=
self
.
qexecute
(
'Any lower(N) ORDERBY LOWER(N) WHERE X is Tag, X name N,'
...
...
cubicweb/server/test/unittest_repository.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
@@ -95,10 +95,10 @@ class RepositoryTC(CubicWebTC):
with
self
.
admin_access
.
repo_cnx
()
as
cnx
:
cnx
.
execute
(
'INSERT CWUser X: X login %(login)s, X upassword %(passwd)s, '
'X in_group G WHERE G name "users"'
,
{
'login'
:
u
"barnab"
,
'passwd'
:
u
"h
hh
"
.
encode
(
'UTF8'
)})
{
'login'
:
u
"barnab
é
"
,
'passwd'
:
u
"h
éhéhé
"
.
encode
(
'UTF8'
)})
cnx
.
commit
()
repo
=
self
.
repo
self
.
assertTrue
(
repo
.
authenticate_user
(
cnx
,
u
"barnab"
,
password
=
u
"h
hh
"
.
encode
(
'UTF8'
)))
self
.
assertTrue
(
repo
.
authenticate_user
(
cnx
,
u
"barnab
é
"
,
password
=
u
"h
éhéhé
"
.
encode
(
'UTF8'
)))
def
test_rollback_on_execute_validation_error
(
self
):
class
ValidationErrorAfterHook
(
Hook
):
...
...
cubicweb/server/test/unittest_rqlannotation.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
cubicweb/sobjects/test/unittest_supervising.py
View file @
94588f6e
# -*- coding:
iso-8859-1
-*-
# -*- coding:
utf-8
-*-
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
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