@@ -1973,7 +1973,7 @@ def field(self, showid=0, size=None, **kwargs):
19731973 ** kwargs )
19741974
19751975 def menu (self , size = None , height = None , showid = 0 , additional = [], value = None ,
1976- sort_on = None , html_kwargs = {} , ** conditions ):
1976+ sort_on = None , html_kwargs = {}, translate = True , ** conditions ):
19771977 """ Render a form select list for this property
19781978
19791979 "size" is used to limit the length of the list labels
@@ -1986,6 +1986,11 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
19861986 (direction, property) where direction is '+' or '-'. A
19871987 single string with the direction prepended may be used.
19881988 For example: ('-', 'order'), '+name'.
1989+ "html_kwargs" specified additional html args for the
1990+ generated html <select>
1991+ "translate" indicates if we should do translation of labels
1992+ using gettext -- this is often desired (e.g. for status
1993+ labels) but sometimes not.
19891994
19901995 The remaining keyword arguments are used as conditions for
19911996 filtering the items in the list - they're passed as the
@@ -2074,7 +2079,10 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
20742079 lab = lab + ' (%s)' % ', ' .join (m )
20752080
20762081 # and generate
2077- lab = cgi .escape (self ._ (lab ))
2082+ tr = str
2083+ if translate :
2084+ tr = self ._
2085+ lab = cgi .escape (tr (lab ))
20782086 l .append ('<option %svalue="%s">%s</option>' % (s , optionid , lab ))
20792087 l .append ('</select>' )
20802088 return '\n ' .join (l )
@@ -2198,7 +2206,8 @@ def field(self, size=30, showid=0, **kwargs):
21982206 return self .input (name = self ._formname , size = size , ** kwargs )
21992207
22002208 def menu (self , size = None , height = None , showid = 0 , additional = [],
2201- value = None , sort_on = None , html_kwargs = {}, ** conditions ):
2209+ value = None , sort_on = None , html_kwargs = {}, translate = True ,
2210+ ** conditions ):
22022211 """ Render a form <select> list for this property.
22032212
22042213 "size" is used to limit the length of the list labels
@@ -2299,7 +2308,10 @@ def menu(self, size=None, height=None, showid=0, additional=[],
22992308 lab = lab + ' (%s)' % ', ' .join (m )
23002309
23012310 # and generate
2302- lab = cgi .escape (self ._ (lab ))
2311+ tr = str
2312+ if translate :
2313+ tr = self ._
2314+ lab = cgi .escape (tr (lab ))
23032315 l .append ('<option %svalue="%s">%s</option>' % (s , optionid ,
23042316 lab ))
23052317 l .append ('</select>' )
0 commit comments