예제 #1
0
 def validate_system(self,value):
     try:
         if not validSystem(value):
             raise serializers.ValidationError('This is not a valid system.')
     except Exception as e:
         raise serializers.ValidationError(str(e))
     return value
예제 #2
0
 def __validate_system(self, system):
     ''' Validate the system id
     '''
     if not system:
         raise ValueError('This basket is not associated with any system.')
     elif not len(system) == 4:
         raise ValueError('The system id should be 4 characters long.')
     elif not validSystem(system):
         raise ValueError('The System id is not valid.')
     self.checkout_session.use_system(system)
예제 #3
0
파일: views.py 프로젝트: scottp-dpaw/ledger
 def __validate_system(self, system):
     ''' Validate the system id
     '''
     if not system:
         raise ValueError('This basket is not associated with any system.')
     elif not len(system) == 4:
         raise ValueError('The system id should be 4 characters long.')
     elif not validSystem(system):
         raise ValueError('The System id is not valid.')
     self.checkout_session.use_system(system)