You can use library without Babel

This commit is contained in:
Alex Root Junior 2017-06-02 05:10:22 +03:00
parent 92b3e027db
commit d5d4e9c90e

View file

@ -1,4 +1,7 @@
import babel
try:
import babel
except ImportError:
babel = None
from .base import Deserializable
@ -38,6 +41,8 @@ class User(Deserializable):
@property
def locale(self) -> babel.core.Locale or None:
if not babel:
raise ImportError('Babel is not installed!')
if not self.language_code:
return None
if not hasattr(self, '_locale'):