Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
51f99879
Commit
51f99879
authored
Apr 21, 2015
by
Cosmia Luna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lazy import helpers to prevent circular imports
parent
3f3fb543
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
babel.py
flask_admin/babel.py
+13
-10
No files found.
flask_admin/babel.py
View file @
51f99879
try
:
from
.helpers
import
get_current_view
from
flask_babelex
import
Domain
except
ImportError
:
def
gettext
(
string
,
**
variables
):
return
string
%
variables
def
ngettext
(
singular
,
plural
,
num
,
**
variables
):
return
(
singular
if
num
==
1
else
plural
)
%
variables
def
lazy_gettext
(
string
,
**
variables
):
return
gettext
(
string
,
**
variables
)
else
:
from
flask_admin
import
translations
class
CustomDomain
(
Domain
):
...
...
@@ -24,12 +33,6 @@ try:
gettext
=
domain
.
gettext
ngettext
=
domain
.
ngettext
lazy_gettext
=
domain
.
lazy_gettext
except
ImportError
:
def
gettext
(
string
,
**
variables
):
return
string
%
variables
def
ngettext
(
singular
,
plural
,
num
,
**
variables
):
return
(
singular
if
num
==
1
else
plural
)
%
variables
def
lazy_gettext
(
string
,
**
variables
):
return
gettext
(
string
,
**
variables
)
# lazy imports
from
.helpers
import
get_current_view
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment