|
From: <mic...@ya...> - 2004-06-28 18:46:45
|
Hi guys, I think I can´t but I won´t kill anyone asking :), is there a way to import from a psp? See my problem, to implment forms I create 2 pages, a FormDoSomething.py and a DoSomething.py, the first show the form presentation, the second verifies the data, if the data is wrong, shows a error message on the top of the page and then show the Form.writeContent(self), else do something with the data and shows a ok message. I have an example in http://www.portaldofornecedor.com.br/cgi-bin/wkcgi/ControleVendas/FormTest The code for the example is above: # file FormTest.py from Modelo import Modelo class FormTest(Modelo): def title(self): return 'The test form' def writeContent(self): self.writeln('''\ <form method="post" action="Test"> <p>Name: <input type="text" name="name" value="%s"></p> <p><input type="submit" value="Send Data"></p> </form>''' % self.request().value('name', '')) # file Test.py from FormTest import FormTest class Test(FormTest): def validarRequest(self): if self.request().value('name', '')!='michel': self.erro.append('The name must be michel!') def writeContent(self): if self.erro: FormTest.writeContent(self) else: self.writeln('<p class="sucesso">Hi michel!</p>') The form Test only shows the form presentation, I could derivate the Test class from a TestSucess class where there is a sucess message, so I can show the FormTest.writeContent or TestSucess.writeContent, and these 2 files could be generated by a designer, I only will mantain the data control... The designer could do this with psp or cheetah (I don´t want to need to compile the cheetah code each change :) or even zpt... Sorry if I couldn´t be more especific, but my english is too bad. Thanks for any help... ===== -- Michel Thadeu Sabchuk Curitiba/PR ______________________________________________________________________ Yahoo! Mail - agora com 100MB de espaço, anti-spam e antivírus grátis! http://br.info.mail.yahoo.com/ |