Back to index

plone3  3.1.7
Public Member Functions | Private Attributes | Static Private Attributes
validation.service.Service Class Reference

List of all members.

Public Member Functions

def __init__
def validate
def validatorFor
def register
def items
def keys
def values
def unregister

Private Attributes

 _validator

Static Private Attributes

 __implements__ = IValidationService
 __call__ = validate

Detailed Description

Definition at line 11 of file service.py.


Constructor & Destructor Documentation

Definition at line 14 of file service.py.

00014 
00015     def __init__(self):
00016         self._validator = {}


Member Function Documentation

Definition at line 44 of file service.py.

00044 
00045     def items(self):
00046         return self._validator.items()

Here is the caller graph for this function:

Definition at line 47 of file service.py.

00047 
00048     def keys(self):
00049         return [k for k, v in self.items()]

Here is the call graph for this function:

Here is the caller graph for this function:

def validation.service.Service.register (   self,
  validator 
)

Definition at line 34 of file service.py.

00034 
00035     def register(self, validator):
00036         if not IValidator.isImplementedBy(validator):
00037             IValidator.isImplementedBy(validator)
00038             raise FalseValidatorError, validator
00039         name = validator.name
00040         # The following code prevents refreshing
00041         ##if self._validator.has_key(name):
00042         ##    raise AlreadyRegisteredValidatorError, name
00043         self._validator[name] = validator

def validation.service.Service.unregister (   self,
  name_or_validator 
)

Definition at line 53 of file service.py.

00053 
00054     def unregister(self, name_or_validator):
00055         if type(name_or_validator) is StringType:
00056             name = name_or_validator
00057         elif IValidator.isImplementedBy(name_or_validator):
00058             name = name_or_validator.name
00059         if self._validator.has_key(name):
00060             del self._validator[name]
def validation.service.Service.validate (   self,
  name_or_validator,
  value,
  args,
  kwargs 
)

Definition at line 17 of file service.py.

00017 
00018     def validate(self, name_or_validator, value, *args, **kwargs):
00019         v = self.validatorFor(name_or_validator)
00020         return v(value, *args, **kwargs)

Here is the call graph for this function:

Here is the caller graph for this function:

def validation.service.Service.validatorFor (   self,
  name_or_validator 
)

Definition at line 23 of file service.py.

00023 
00024     def validatorFor(self, name_or_validator):
00025         if type(name_or_validator) in StringTypes:
00026             try:
00027                 return self._validator[name_or_validator]
00028             except KeyError:
00029                 raise UnknowValidatorError, name_or_validator
00030         elif IValidator.isImplementedBy(name_or_validator):
00031             return name_or_validator
00032         else:
00033             raise FalseValidatorError, name_or_validator

Here is the caller graph for this function:

Definition at line 50 of file service.py.

00050 
00051     def values(self):
00052         return [v for k, v in self.items()]

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 21 of file service.py.

Definition at line 12 of file service.py.

Definition at line 15 of file service.py.


The documentation for this class was generated from the following file: