pymensago/keycard.py
def __validate_common_data(self) -> RetVal:
		'''Checks the validity of data fields common to orgs and users'''
		
		# Required field: Index
		outStatus = self.__validate_integer('Index', 1)
		if outStatus.error():
			return outStatus
		
		# Field: Name, required for orgs, optional for users
		# Although mostly freeform, the Name field has a couple requirements:
		# 1) at least 1 printable character
		# 2) No more than 64 code points
		if 'Name' in self.fields.keys():
			m = re.match(r'\w+', self.fields['Name'])
			if not m or len(self.fields['Name']) >= 64:
				return RetVal(ErrBadData, 'bad name value')

		# Required field: Time to Live
		outStatus = self.__validate_integer('Time-To-Live', 1, 30)
		if outStatus.error():
			return outStatus

		# is_timestamp_valid() validates both of the required fields Timestamp and Expires
		return self.is_timestamp_valid()
Checks the validity of data fields common to orgs and users
Checks the validity of data fields common to orgs and users
Checks the validity of data fields common to orgs and users
def __validate_common_data(self) -> RetVal:
		outStatus = self.__validate_integer('Index', 1)
		if outStatus.error():
			return outStatus
		if 'Name' in self.fields.keys():
			m = re.match(r'\w+', self.fields['Name'])
			if not m or len(self.fields['Name']) >= 64:
				return RetVal(ErrBadData, 'bad name value')
		outStatus = self.__validate_integer('Time-To-Live', 1, 30)
		if outStatus.error():
			return outStatus
		return self.is_timestamp_valid()
def __validate_common_data ( self ) -> RetVal : outStatus = self . __validate_integer ( 'Index' , 1 ) if outStatus . error ( ) : return outStatus if 'Name' in self . fields . keys ( ) : m = re . match ( r'\w+' , self . fields [ 'Name' ] ) if not m or len ( self . fields [ 'Name' ] ) >= 64 : return RetVal ( ErrBadData , 'bad name value' ) outStatus = self . __validate_integer ( 'Time-To-Live' , 1 , 30 ) if outStatus . error ( ) : return outStatus return self . is_timestamp_valid ( )
Checks the validity of data fields common to orgs and users
Checks the validity of data fields common to orgs and users
'''Checks the validity of data fields common to orgs and users''' # Required field: Index # Field: Name, required for orgs, optional for users # Although mostly freeform, the Name field has a couple requirements: # 1) at least 1 printable character # 2) No more than 64 code points # Required field: Time to Live # is_timestamp_valid() validates both of the required fields Timestamp and Expires
self