/usr/share/pyshared/sprox/validators.py is in python-sprox 0.6.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """
validators Module
Copyright (c) 2008 Christopher Perkins
Original Version by Christopher Perkins 2008
Released under MIT license.
"""
from formencode import FancyValidator, Invalid
class UniqueValue(FancyValidator):
def __init__(self, provider, entity, field_name, *args, **kw):
self.provider = provider
self.entity = entity
self.field_name = field_name
FancyValidator.__init__(self, *args, **kw)
def _to_python(self, value, state):
if not self.provider.is_unique(self.entity, self.field_name, value):
raise Invalid(
'That value already exists',
value, state)
return value
|