Commit f333f662 authored by Laurent Peuch's avatar 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
# -*- 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):
......
# -*- 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"""
......
# -*- 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
#
......
# -*- 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,'
......
# -*- 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"hhh".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"hhh".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):
......
# -*- 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
#
......
# -*- 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
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment