from zope.interface import implements from Products.MetadataPortal.waramulib.interfaces import ICombinedWidget from Products.MetadataPortal.utils import translate, getLanguage class AgeRange(object): implements(ICombinedWidget) def __init__(self, context): self.context = context def combines(self): return ['min', 'max'] def view(self, left, right): r = u"" r += '\t\n' lval = self.context.get(left.get('name')) rval = self.context.get(right.get('name')) r += '' if lval == '-1': lval = 'U' r += lval r += " - " if rval in ('998', '9999'): rval = 'U' r += rval r += '' return r def edit(self, left, right): r = u"" r += '\t\n' for f in [left, right]: fval = self.context.get(f.get('name')) r += '\n' return r