Merge remote-tracking branch 'pycountry/pycountry'

This commit is contained in:
Ozzieisaacs 2019-04-13 16:34:04 +02:00
commit e754ce313c
3 changed files with 31 additions and 4 deletions

View File

@ -21,7 +21,7 @@ import zipfile
from lxml import etree
import os
import uploader
from iso639 import languages as isoLanguages
import isoLanguages
def extractCover(zipFile, coverFile, coverpath, tmp_file_name):

28
cps/isoLanguages.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from iso639 import languages, __version__
get = languages.get
except ImportError:
from pycountry import languages as pyc_languages
try:
import pkg_resources
__version__ = pkg_resources.get_distribution('pycountry').version + ' (PyCountry)'
del pkg_resources
except (ImportError, Exception):
__version__ = "? (PyCountry)"
def _copy_fields(l):
l.part1 = l.alpha_2
l.part3 = l.alpha_3
return l
def get(name=None, part1=None, part3=None):
if (part3 is not None):
return _copy_fields(pyc_languages.get(alpha_3=part3))
if (part1 is not None):
return _copy_fields(pyc_languages.get(alpha_2=part1))
if (name is not None):
return _copy_fields(pyc_languages.get(name=name))

View File

@ -61,8 +61,7 @@ import base64
from sqlalchemy.sql import *
import json
import datetime
from iso639 import languages as isoLanguages
from iso639 import __version__ as iso639Version
import isoLanguages
from pytz import __version__ as pytzVersion
from uuid import uuid4
import os.path
@ -1657,7 +1656,7 @@ def stats():
versions['Flask'] = 'v' + flaskVersion
versions['Flask Login'] = 'v' + flask_loginVersion
versions['Flask Principal'] = 'v' + flask_principalVersion
versions['Iso 639'] = 'v' + iso639Version
versions['Iso 639'] = 'v' + isoLanguages.__version__
versions['pytz'] = 'v' + pytzVersion
versions['Requests'] = 'v' + requests.__version__