validators optionally require globals
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.7 (2012-03-12 21:59:21) dev
|
Version 1.99.7 (2012-03-12 22:34:49) dev
|
||||||
|
|||||||
+7
-2
@@ -55,11 +55,16 @@ __all__ = [
|
|||||||
'IS_URL',
|
'IS_URL',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
try:
|
||||||
|
from globals import current
|
||||||
|
have_current = True
|
||||||
|
except ImportError:
|
||||||
|
have_current = False
|
||||||
|
|
||||||
def translate(text):
|
def translate(text):
|
||||||
if text is None:
|
if text is None:
|
||||||
return None
|
return None
|
||||||
elif isinstance(text,(str,unicode)):
|
elif isinstance(text,(str,unicode)) and have_current:
|
||||||
from globals import current
|
|
||||||
if hasattr(current,'T'):
|
if hasattr(current,'T'):
|
||||||
return str(current.T(text))
|
return str(current.T(text))
|
||||||
return str(text)
|
return str(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user