Exemplo n.º 1
0
	def check(self, value):
		# Only ascii chars allowed in these keys
		value = BaseString.check(self, value)
		if isinstance(value, unicode) \
		and value.encode('utf-8') != value:
			raise ValueError, 'ASCII string required'
		return value
Exemplo n.º 2
0
	def check(self, value):
		# Only ascii chars allowed in these keys
		value = BaseString.check(self, value)
		if isinstance(value, unicode) \
		and value.encode('utf-8') != value:
			raise ValueError, 'ASCII string required'
		return value
Exemplo n.º 3
0
 def check(self, value):
     # Only ascii chars allowed in these keys
     value = BaseString.check(self, value)
     if isinstance(value, str):
         try:
             x = value.encode('ascii')
         except UnicodeEncodeError:
             raise ValueError('ASCII string required')
         else:
             pass
     return value