def _to_python(self, value, state): try: return Decimal(value) except DecimalException: raise formencode.Invalid('Please enter a number', value, state)