Update of /cvsroot/mailman/mailman/Mailman
In directory usw-pr-cvs1:/tmp/cvs-serv22782/Mailman
Modified Files:
i18n.py
Log Message:
We can simplify the logic here because Python 2.1 is a minimum
requirement, and that comes with sys._getframe().
_x(): Removed.
Index: i18n.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/i18n.py,v
retrieving revision 2.4
retrieving revision 2.5
diff -C2 -d -r2.4 -r2.5
*** i18n.py 18 May 2001 20:14:53 -0000 2.4
--- i18n.py 16 Mar 2002 02:06:50 -0000 2.5
***************
*** 52,56 ****
! def _x(s, frame):
# Do translation of the given string into the current language, and do
# Ping-string interpolation into the resulting string.
--- 52,56 ----
! def _(s):
# Do translation of the given string into the current language, and do
# Ping-string interpolation into the resulting string.
***************
*** 64,67 ****
--- 64,69 ----
# original string is 1) locals dictionary, 2) globals dictionary.
#
+ # First, get the frame of the caller
+ frame = sys._getframe(1)
# A `safe' dictionary is used so we won't get an exception if there's a
# missing key in the dictionary.
***************
*** 70,96 ****
# Translate the string, then interpolate into it.
return _translation.gettext(s) % dict
-
-
-
- # Public version, to be used by most modules. There are three ways to get the
- # stack frame to serve as the namespace source. First, we try to use the
- # Python 2.1 extension to the sys module. If that's not there, we fall back
- # to the optional Mailman enhancement module, and finally use the
- # tried-and-true (but slow) pure Python approach. The latter should work in
- # every supported version of Python.
- if hasattr(sys, '_getframe'):
- def _(s):
- return _x(s, sys._getframe(1))
- else:
- try:
- import _mailman
- def _(s):
- return _x(s, _mailman._getframe(1))
- except ImportError:
- def _(s):
- exc = 'exc'
- try: raise exc
- except exc:
- # Get one frame up the stack.
- frame = sys.exc_info()[2].tb_frame.f_back
- return _x(s, frame)
--- 72,73 ----
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins