Timur and Max,

thanks for the tips,

On 9/8/06, Timur Izhbulatov <[EMAIL PROTECTED]> wrote:
> I'm facing a similar problem right now [1]. The solution I found is creating 
> my
> own decorator for validation. It receives a callable which generates the 
> schema
> for validation. I could send you some snippets if you need.

Thanks, I'd like to see that! Or maybe you can put your code on the wiki?

>
> But I believe in your case it would be better to use separate methods. What is
> the point of using single method? Code reuse? You could achieve it by 
> extracting
> common parts into separate reusable methods.
>

You are right i can do that. For this particular case it's more a
habbit of me for the /add/edit/save url pattern :)


On 9/8/06, Max Ischenko <[EMAIL PROTECTED]> wrote:
>
>
> Two ideas:
>
> 1. You can pass a callable to
> @turbogears.validate(form=...)
> that would return appropriate form. Of course, to select appropriate
> form you need info from a form submitted which is not available from a
> callable directly. Though you may check HTTP referer header.

I've noticed that @validate accepts a callable, but didnt think about
using referer! Good one, thanks.

>
> 2. You can validate inside your controller's method. Not as pretty but
> it works.
>

True, but this is the thing I like the most in TG - widgets with
validators separated from controller code :)


thanks,
Ksenia.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to