# -*- coding: iso8859-1 -*- # # Copyright (C) 2006 CSIRO Australia # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # This software consists of voluntary contributions made by many # individuals. For exact contribution history, see the revision # history and logs. # # Author: Conrad Parker from anxvalidator.blurb import Blurb from anxvalidator.form import Form from anxvalidator.result import Result from anxvalidator.page import Page from anxvalidator.response import Response class Validate (object): def __init__(self, form): try: self.uri = form['uri'].value except KeyError: self.uri = None try: self.force_media = (form['force_media'].value == 'true') except: self.force_media = False def __str__(self): if (self.uri): html = Form(self.uri).__str__() + Result(self.uri, self.force_media).__str__() title = "Result for " + self.uri return Response(Page(Blurb(html), title=title)).__str__() else: return Response(Page(Blurb(Form()))).__str__()