def validate_template(context, request, data): if context.portal_type == 'seantis.reservation.emailtemplate': folder = context.aq_inner.aq_parent else: folder = context templates = utils.portal_type_in_context( folder, portal_type='seantis.reservation.emailtemplate' ) duplicate = False for template in templates: if template.id == context.id: continue if template.getObject().title == context.title: duplicate = True break if duplicate: msg = utils.translate( context, request, _(u"There's already an Email template in the same folder for the " u"same language") ) utils.form_error(msg)
def validate_template(context, request, data): if context.portal_type == 'seantis.reservation.emailtemplate': folder = context.aq_inner.aq_parent else: folder = context templates = utils.portal_type_in_context( folder, portal_type='seantis.reservation.emailtemplate') duplicate = False for template in templates: if template.id == context.id: continue if template.getObject().title == context.title: duplicate = True break if duplicate: msg = utils.translate( context, request, _(u"There's already an Email template in the same folder for the " u"same language")) utils.form_error(msg)
def validate_timeframe(context, request, data): overlap = overlapping_timeframe(context, data['start'], data['end']) if overlap: msg = utils.translate( context, request, _(u"Timeframe overlaps with '${overlap}' in the current folder", mapping={'overlap': overlap.title})) utils.form_error(msg)
def validate_timeframe(context, request, data): overlap = overlapping_timeframe(context, data['start'], data['end']) if overlap: msg = utils.translate( context, request, _( u"Timeframe overlaps with '${overlap}' in the current folder", mapping={'overlap': overlap.title} )) utils.form_error(msg)
def reservation_title(self, reservation): human_date_text = utils.translate(self.context, self.request, human_date(reservation.created)) return '{} - {}'.format(human_date_text, reservation.title)
def reservation_title(self, reservation): human_date_text = utils.translate( self.context, self.request, human_date(reservation.created) ) return '{} - {}'.format(human_date_text, reservation.title)