I'm using a form with form validator. 

When validation error occurs on a page I'd like to log this event along
with ip-address from which a request was made. The problem with this is
that validator knows nothing about request and form has no error info
from validator. My current code is this:

        def writePageContent(self):
                formProcessed, data = self.processForm()
                if data == 'invalid':
                        forms = self.formDefinitions()
                        form = forms['Login']
                        fv = form._formValidators[0]
                        message = fv.errorMessage # set by validator
                        addr = self.request().remoteAddress()
                        log.warn("Login from %s failed: %s", addr, message)


Is there any better way to achieve this?

Best way, imho, would be to make self.processForm() method return error
info from validator.


-- 
Regards, max.


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to