From 94fbb68004b3a349bde1f1766e60a8ee78895a40 Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Sat, 18 Aug 2018 12:58:42 +0200 Subject: [PATCH] Migrate to python 3. --- address.py | 3 +-- country_zip.py | 4 ++-- setup.py | 5 +---- tests/scenario_country_zip_es.rst | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/address.py b/address.py index a110aee..dbe7f59 100644 --- a/address.py +++ b/address.py @@ -5,8 +5,7 @@ from trytond.pool import PoolMeta __all__ = ['Address'] -class Address: - __metaclass__ = PoolMeta +class Address(metaclass=PoolMeta): __name__ = 'party.address' @classmethod diff --git a/country_zip.py b/country_zip.py index ddce9c5..20daad5 100644 --- a/country_zip.py +++ b/country_zip.py @@ -46,11 +46,11 @@ class LoadCountryZips(Wizard): os.path.dirname(__file__), 'country_zip_es.csv')) try: rows = reader(data, delimiter=delimiter, quotechar=quotechar) - except TypeError, e: + except TypeError as e: self.raise_user_error('error', error_description='read_error', error_description_args=('country_zip_es.csv', e)) - rows.next() + next(rows) records = [] for row in rows: diff --git a/setup.py b/setup.py index c9880b9..4b43e4e 100644 --- a/setup.py +++ b/setup.py @@ -7,10 +7,7 @@ from setuptools import setup import re import os import io -try: - from configparser import ConfigParser -except ImportError: - from ConfigParser import ConfigParser +from configparser import ConfigParser MODULE = 'country_zip_es' PREFIX = 'trytonspain' diff --git a/tests/scenario_country_zip_es.rst b/tests/scenario_country_zip_es.rst index 43b99ca..6c15e96 100644 --- a/tests/scenario_country_zip_es.rst +++ b/tests/scenario_country_zip_es.rst @@ -31,6 +31,6 @@ Ensure that banks are loaded:: >>> CountryZip = Model.get('country.zip') >>> czip, = CountryZip.find([('zip', '=', '25001')]) >>> czip.city - u'Lleida' + 'Lleida' >>> czip.country.code - u'ES' + 'ES'