def template_validator(request):
 settings_modules = {}
 for mod in settings.ADMIN_FOR:
  settings_module = __import__(mod, {}, {}, [''])
  settings_modules[settings_module.SITE_ID] = settings_module
 manipulator = TemplateValidator(settings_modules)
 (new_data, errors) = ({}, {})
 if request.POST:
  new_data = request.POST.copy()
  errors = manipulator.get_validation_errors(new_data)
  if (not errors):
   request.user.message_set.create(message='The template is valid.')
 return render_to_response('admin/template_validator.html', {'title': 'Template validator', 'form': oldforms.FormWrapper(manipulator, new_data, errors)}, context_instance=template.RequestContext(request))

def template_validator ( request ) : settings_modules = { } for mod in settings . ADMIN_FOR : settings_module = __import__ ( mod , { } , { } , [ '' ] ) settings_modules [ settings_module . SITE_ID ] = settings_module manipulator = TemplateValidator ( settings_modules ) ( new_data , errors ) = ( { } , { } ) if request . POST : new_data = request . POST . copy ( ) errors = manipulator . get_validation_errors ( new_data ) if ( not errors ) : request . user . message_set . create ( message = 'The template is valid.' ) return render_to_response ( 'admin/template_validator.html' , { 'title' : 'Template validator' , 'form' : oldforms . FormWrapper ( manipulator , new_data , errors ) } , context_instance = template . RequestContext ( request ) )
displays the template validator form .