On Tue, Feb 21, 2012 at 2:12 PM, Guilherme Salgado <guilherme.salg...@linaro.org> wrote: > And this means the parsing (which implies validating the input as well) > will happen twice: once when the form machinery validates the input and > again when it passes the raw input to updateWorkItems(). Since the > parsing involves looking up objects in the DB, doing this twice is not > ideal.
Perhaps you can cache the result of parsing in a location shared between the form validation and updateWorkItems() and use the string (or its ID) passed to updateWorkItems() to look up the parsed value (falling back to parsing from scratch if none is found). Another thought: if the form validators are allowed to return mutated values, you can return a subclass of str that has an attribute which stashes the parsed value. updateWorkItems() can then check to see if the string it is passed has an already-parsed value along for the ride. -- Benji York _______________________________________________ Mailing list: https://launchpad.net/~launchpad-dev Post to : launchpad-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-dev More help : https://help.launchpad.net/ListHelp