Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Private Attributes
ATContentTypes.lib.validators.TidyHtmlWithCleanupValidator Class Reference

List of all members.

Public Member Functions

def __init__
def __call__

Public Attributes

 name
 title
 description

Static Private Attributes

 __implements__ = IValidator

Detailed Description

use mxTidy to check HTML

Fail only on errors
Clean up

Definition at line 134 of file validators.py.


Constructor & Destructor Documentation

def ATContentTypes.lib.validators.TidyHtmlWithCleanupValidator.__init__ (   self,
  name,
  title = '',
  description = '' 
)

Definition at line 143 of file validators.py.

00143 
00144     def __init__(self, name, title='', description=''):
00145         self.name = name
00146         self.title = title or name
00147         self.description = description
00148 


Member Function Documentation

def ATContentTypes.lib.validators.TidyHtmlWithCleanupValidator.__call__ (   self,
  value,
  args,
  kw 
)

Definition at line 149 of file validators.py.

00149 
00150     def __call__(self, value, *args, **kw):
00151         if not (HAS_MX_TIDY and MX_TIDY_ENABLED):
00152             # no mxTidy installed
00153             return 1
00154 
00155         request = kw['REQUEST']
00156         field   = kw['field']
00157 
00158         result = doTidy(value, field, request, cleanup=1)
00159         if result is None:
00160             return 1
00161 
00162         nerrors, nwarnings, outputdata, errordata = result
00163         errors = nerrors
00164 
00165         # save the changed output in the request
00166         tidyAttribute = '%s_tidier_data' % field.getName()
00167         request[tidyAttribute] = outputdata
00168 
00169         if nwarnings:
00170             tidiedFields = list(request.get('tidiedFields', []))
00171             tidiedFields.append(field)
00172             request.set('tidiedFields', tidiedFields)
00173 
00174         if errors:
00175             return ("Validation Failed(%s): \n %s" % (self.name, errordata))
00176         else:
00177             return 1
00178 
00179 
00180 validatorList.append(TidyHtmlWithCleanupValidator('isTidyHtmlWithCleanup', title='', description=''))

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 141 of file validators.py.

Definition at line 146 of file validators.py.

Definition at line 144 of file validators.py.

Definition at line 145 of file validators.py.


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