Ok, compatibility is a reason I understand. You are right: if I make a decision, which error message would be appropriate for each single field it works fine.
If there is a lot of fields with IS_INT_IN_RANGE requirements like T('enter an integer between %(min)g and %(max)g') I will use an additional variable, e.g.: mm=T('enter an integer between %(min)g and %(max)g') db.pet.legs.requires=IS_INT_IN_RANGE(0,9,mm) 2011/3/5 Jonathan Lundell <jlund...@pobox.com> > On Mar 5, 2011, at 4:01 AM, Martin Weissenboeck wrote: > > This solution is not very beautiful, because I have to repeat the string 'fill > this', but it works. > *It does not work for classes like IS_INT_IN_RANGE,* because there is a > lot of error messages, depending on the values: > > if minimum is None: > if maximum is None: > self.error_message = error_message or 'enter an integer' > else: > self.maximum = int(maximum) > if error_message is None: > error_message = 'enter an integer less than or equal > to %(max)g' > self.error_message = error_message % > dict(max=self.maximum-1) > elif maximum is None: > self.minimum = int(minimum) > if error_message is None: > error_message = 'enter an integer greater than or equal to > %(min)g' > self.error_message = error_message % dict(min=self.minimum) > else: > self.minimum = int(minimum) > self.maximum = int(maximum) > if error_message is None: > error_message = 'enter an integer between %(min)g and > %(max)g' > self.error_message = error_message % dict(min=self.minimum, > max=self.maximum-1) > > Using the T-"operator" there is no way to translate these error message for > example to German. > And I think it looks very unprofessional to have mixes English and German > messages. > > > 1.93 was intended as a stable release without big changes, so that it can > serve as the ongoing release for legacy support of Python 2.4. We'll have > general support for translation in gluon fairly soon. > > In the meantime, using T in the constructor for IS_INT_IN_RANGE should work > just fine. Is there some specific case that isn't working for you? >