예제 #1
0
 def sign_up(self, session, tournament_id, attendee_id, cellphone):
     from uber import model_checks as umc
     if umc._invalid_phone_number(cellphone):
         return {'error': 'That is not a valid phone number'}
     try:
         attendee = session.attendee(attendee_id)
         attendee.cellphone = cellphone
         session.add(TabletopEntrant(attendee_id=attendee_id, tournament_id=tournament_id))
         session.commit()
     except:
         session.rollback()
         log.error('unable to add tournament entrant tournament={} attendee={}', tournament_id, attendee_id, exc_info=True)
         return {'error': 'That attendee is already signed up for that tournament'}
     else:
         return {
             'message': 'Attendee signed up',
             'state': _state(session)
         }
 def sign_up(self, session, tournament_id, attendee_id, cellphone):
     from uber import model_checks as umc
     if umc._invalid_phone_number(cellphone):
         return {'error': 'That is not a valid phone number'}
     try:
         attendee = session.attendee(attendee_id)
         attendee.cellphone = cellphone
         session.add(
             TabletopEntrant(attendee_id=attendee_id,
                             tournament_id=tournament_id))
         session.commit()
     except Exception:
         session.rollback()
         log.error(
             'unable to add tournament entrant tournament={} attendee={}',
             tournament_id,
             attendee_id,
             exc_info=True)
         return {
             'error':
             'That attendee is already signed up for that tournament'
         }
     else:
         return {'message': 'Attendee signed up', 'state': _state(session)}
예제 #3
0
def dev_cellphone(dev):
    from uber.model_checks import _invalid_phone_number
    if (dev.primary_contact or dev.cellphone) and _invalid_phone_number(dev.cellphone):
        return 'Please enter a valid phone number'
예제 #4
0
 def test_invalid_number(selfself, number):
     assert True == _invalid_phone_number(number)
예제 #5
0
 def test_valid_number(self, number):
     assert False == _invalid_phone_number(number)
예제 #6
0
 def test_valid_number(self, number):
     assert not _invalid_phone_number(number)
예제 #7
0
def pa_phone(pa):
    from uber.model_checks import _invalid_phone_number
    if (pa.submitter or pa.cellphone) and _invalid_phone_number(pa.cellphone):
        return 'Please enter a valid phone number'
예제 #8
0
def pa_phone(pa):
    from uber.model_checks import _invalid_phone_number
    if (pa.submitter or pa.cellphone) and _invalid_phone_number(pa.cellphone):
        return 'Please enter a valid phone number'
예제 #9
0
def cellphone(app):
    from uber.model_checks import _invalid_phone_number
    if app.cellphone and _invalid_phone_number(app.cellphone):
        return 'You did not enter a valid cellphone number'
예제 #10
0
def dev_cellphone(dev):
    from uber.model_checks import _invalid_phone_number
    if (dev.primary_contact or dev.cellphone) and _invalid_phone_number(
            dev.cellphone):
        return 'Please enter a valid phone number'
예제 #11
0
 def test_invalid_number(selfself, number):
     assert _invalid_phone_number(number)