Thanks for the suggestion, it is good to know all the options I have. I'll take a look and see if the boilerplate functionality is similar enough between various views to be factored out into a decorator, in which case this solution would work, otherwise I'd have to go back to the testing style I described at the beginning.
On Tuesday, December 23, 2014 5:55:45 PM UTC+1, Randall Leeds wrote: > > On Tue, Dec 23, 2014, 04:35 pyramidX <[email protected] <javascript:>> > wrote: > > Extracting the appstruct logic into a separate function is one way to go, > though it still would be useful to have a way to conveniently create > peppercorn POST values from appstructs. Especially for cases where the view > logic is quite simple boilerplate (validate the form, submit the resulting > appstruct somewhere and do a redirect) separating every view function into > 2 could be avoided (e.g. register() and do_register(), with the latter > being appstruct-only logic). > > > > You could probably use venusian to make a decorator for this boilerplate > so that you just have one function that receives the request and appstruct. > The benefit of venusian is that you can decorate the function for pyramid > but import the function undecorated for testing. > > Of course, I understand what you're saying and maybe I'm trying too hard > to avoid what could be a simple thing, but it's a nice opportunity to look > at the options you have. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
