コード例 #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)
         }
コード例 #2
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 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
ファイル: model_checks.py プロジェクト: magfest/mivs
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
ファイル: model_checks.py プロジェクト: namalic/panels
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
ファイル: test_attendee.py プロジェクト: magfest/ubersystem
 def test_invalid_number(selfself, number):
     assert _invalid_phone_number(number)