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',
|
||||
]
|
||||
|
||||
try:
|
||||
from globals import current
|
||||
have_current = True
|
||||
except ImportError:
|
||||
have_current = False
|
||||
|
||||
def translate(text):
|
||||
if text is None:
|
||||
return None
|
||||
elif isinstance(text,(str,unicode)):
|
||||
from globals import current
|
||||
elif isinstance(text,(str,unicode)) and have_current:
|
||||
if hasattr(current,'T'):
|
||||
return str(current.T(text))
|
||||
return str(text)
|
||||
|
||||
Reference in New Issue
Block a user