Remove support for Python 2.7

issue7497
review53261002
This commit is contained in:
Cédric Krier committed 2018-06-26 19:11:48 +02:00
1 parent 58a5301a69
commit 6c5f4f9d70
10 files changed
+27 -38

No files matched your search

-6
View File
@@ -25,12 +25,6 @@ services:
matrix:
include:
- IMAGE: python:2.7
TOXENV: py27
DATABASE: sqlite
- IMAGE: python:2.7
TOXENV: py27
DATABASE: postgresql
- IMAGE: python:3.4
TOXENV: py34
DATABASE: sqlite
+2
View File
@@ -1,3 +1,5 @@
* Remove support for Python 2.7
Version 4.8.0 - 2018-04-23
* Bug fixes (see mercurial logs for details)
* Add Erase Party wizard
+1 -1
View File
@@ -4,7 +4,7 @@ Installing trytond_party
Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
* Python 3.4 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
* trytond_country (http://www.tryton.org/)
* python-stdnum (http://arthurdejong.org/python-stdnum/)
+3 -3
View File
@@ -148,7 +148,7 @@ class Address(DeactivableMixin, sequence_ordered(), ModelSQL, ModelView):
if context.get('address_with_party', False):
substitutions['party_name'] = (self.party.full_name
if getattr(self, 'party', None) else '')
for key, value in substitutions.items():
for key, value in list(substitutions.items()):
substitutions[key.upper()] = value.upper()
return substitutions
@@ -276,7 +276,7 @@ ${COUNTRY}"""
try:
Template(self.format_).substitute(
**address._get_address_substitutions())
except Exception, exception:
except Exception as exception:
self.raise_user_error('invalid_format', {
'format': self.format_,
'exception': exception,
@@ -303,7 +303,7 @@ ${COUNTRY}"""
language = None
pattern.setdefault('language', language.id if language else None)
key = tuple(sorted(pattern.iteritems()))
key = tuple(sorted(pattern.items()))
format_ = cls._get_format_cache.get(key)
if format_ is not None:
return format_
+1 -1
View File
@@ -271,6 +271,6 @@ class ContactMechanism(
"Returns the selection list of usage"
usages = [(None, "")]
if _fields:
for name, desc in cls.fields_get(_fields).iteritems():
for name, desc in cls.fields_get(_fields).items():
usages.append((name, desc['string']))
return usages
+4 -4
View File
@@ -240,7 +240,7 @@ class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin):
"""
default_mechanism = None
if types:
if isinstance(types, basestring):
if isinstance(types, str):
types = {types}
mechanisms = [m for m in self.contact_mechanisms
if m.type in types]
@@ -431,7 +431,7 @@ class CheckVIES(Wizard):
parties_failed.append(party.id)
else:
parties_succeed.append(party.id)
except Exception, e:
except Exception as e:
if hasattr(e, 'faultstring') \
and hasattr(e.faultstring, 'find'):
if e.faultstring.find('INVALID_INPUT'):
@@ -604,7 +604,7 @@ class PartyErase(Wizard):
table = table.join(right, condition=condition)
else:
table = right
for k, sub_tables in tables.iteritems():
for k, sub_tables in tables.items():
if k is None:
continue
table = convert_from(table, sub_tables)
@@ -615,7 +615,7 @@ class PartyErase(Wizard):
with Transaction().set_context(active_test=False):
while replacing:
replacing = Party.search([
('replaced_by', 'in', map(int, replacing)),
('replaced_by', 'in', list(map(int, replacing))),
])
parties += replacing
for party in parties:
+7 -14
View File
@@ -1,15 +1,12 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from setuptools import setup
import re
import os
import io
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
import os
import re
from configparser import ConfigParser
from setuptools import setup
def read(fname):
@@ -27,6 +24,7 @@ def get_require_version(name):
major_version, minor_version + 1)
return require
config = ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
@@ -103,7 +101,6 @@ setup(name=name,
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
@@ -112,6 +109,7 @@ setup(name=name,
'Topic :: Office/Business',
],
license='GPL-3',
python_requires='>=3.4',
install_requires=requires,
extras_require={
'VIES': ['python-stdnum[VIES]'],
@@ -127,9 +125,4 @@ setup(name=name,
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
convert_2to3_doctests=[
'tests/scenario_party_replace.rst',
'tests/scenario_party_erase.rst',
],
)
+1 -1
View File
@@ -55,7 +55,7 @@ Check fields have been erased::
>>> party.name
>>> identifier.reload()
>>> identifier.code
u'****'
'****'
>>> address.reload()
>>> address.street
>>> address.city
+5 -5
View File
@@ -28,7 +28,7 @@ class PartyTestCase(ModuleTestCase):
category1, = Category.create([{
'name': 'Category 1',
}])
self.assert_(category1.id)
self.assertTrue(category1.id)
@with_transaction()
def test_category_recursion(self):
@@ -42,7 +42,7 @@ class PartyTestCase(ModuleTestCase):
'name': 'Category 2',
'parent': category1.id,
}])
self.assert_(category2.id)
self.assertTrue(category2.id)
self.assertRaises(Exception, Category.write, [category1], {
'parent': category2.id,
@@ -56,7 +56,7 @@ class PartyTestCase(ModuleTestCase):
party1, = Party.create([{
'name': 'Party 1',
}])
self.assert_(party1.id)
self.assertTrue(party1.id)
@with_transaction()
def test_party_code(self):
@@ -92,7 +92,7 @@ class PartyTestCase(ModuleTestCase):
'street': 'St sample, 15',
'city': 'City',
}])
self.assert_(address.id)
self.assertTrue(address.id)
self.assertMultiLineEqual(address.full_address,
"St sample, 15\n"
"City")
@@ -219,7 +219,7 @@ class PartyTestCase(ModuleTestCase):
pool = Pool()
Party = pool.get('party.party')
party2, = Party.create([{}])
self.assert_(party2.id)
self.assertTrue(party2.id)
code = party2.code
self.assertEqual(party2.rec_name, '[' + code + ']')
+3 -3
View File
@@ -1,11 +1,11 @@
[tox]
envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql}
envlist = {py34,py35,py36}-{sqlite,postgresql},pypy3-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
{py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy3-postgresql: psycopg2cffi >= 2.5
sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}