def printed_badge_change(attendee): if attendee.badge_printed_name != attendee.orig_value_of('badge_printed_name') \ and not AdminAccount.admin_name() \ and localized_now() > c.get_printed_badge_deadline_by_type(attendee.badge_type_real): return '{} badges have already been ordered, so you cannot change the badge printed name.'.format( attendee.badge_type_label if attendee.badge_type in c.PREASSIGNED_BADGE_TYPES else "Supporter")
def invalid_badge_name(attendee): if attendee.badge_printed_name and localized_now() <= c.get_printed_badge_deadline_by_type(attendee.badge_type) \ and re.search(c.INVALID_BADGE_PRINTED_CHARS, attendee.badge_printed_name): return 'Your printed badge name has invalid characters. Please use only printable ASCII characters.'
def test_new_dealer_supporter_deadline(self, monkeypatch): monkeypatch.setattr(c, 'SUPPORTER_BADGE_DEADLINE', (c.PRINTED_BADGE_DEADLINE + timedelta(days=1))) assert c.SUPPORTER_BADGE_DEADLINE == c.get_printed_badge_deadline_by_type( c.PSEUDO_DEALER_BADGE)
def test_supporter_badge_deadline_later(self, monkeypatch): monkeypatch.setattr(c, 'SUPPORTER_BADGE_DEADLINE', (c.PRINTED_BADGE_DEADLINE + timedelta(days=1))) assert c.SUPPORTER_BADGE_DEADLINE == c.get_printed_badge_deadline_by_type( c.ATTENDEE_BADGE)
def test_staff_badge_deadline(self): assert c.PRINTED_BADGE_DEADLINE == c.get_printed_badge_deadline_by_type( c.STAFF_BADGE)
def invalid_badge_name(attendee): if attendee.badge_printed_name and c.PRINTED_BADGE_DEADLINE \ and localized_now() <= c.get_printed_badge_deadline_by_type(attendee.badge_type_real) \ and re.search(c.INVALID_BADGE_PRINTED_CHARS, attendee.badge_printed_name): return 'Your printed badge name has invalid characters. Please use only alphanumeric characters and symbols.'