Merge pull request #48 from surik00/dev-1.x

Babel is not in requirements
This commit is contained in:
Alex Root Junior 2018-06-11 14:08:52 +03:00 committed by GitHub
commit a139ebee6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,9 @@
import babel
from . import base
from . import fields
from ..utils import markdown
try:
import babel
except ImportError:
babel = None
class User(base.TelegramObject):
"""
@ -46,15 +43,12 @@ class User(base.TelegramObject):
return self.full_name
@property
def locale(self) -> 'babel.core.Locale' or None:
def locale(self) -> babel.core.Locale or None:
"""
This property requires `Babel <https://pypi.python.org/pypi/Babel>`_ module
Get user's locale
:return: :class:`babel.core.Locale`
:raise: ImportError: when babel is not installed.
"""
if not babel:
raise ImportError('Babel is not installed!')
if not self.language_code:
return None
if not hasattr(self, '_locale'):