[Catalyst] Where should constraints go

Matt S Trout dbix-class at trout.me.uk
Fri Nov 3 16:26:39 GMT 2006


Ian Docherty wrote:
> My problem is finding a clean way of getting these constraints out of 
> the Model and into the View so that I can generate meaningful error 
> messages without hard-coding them in the templates. By 'clean' I mean 
> not having to code the Controller to act as the middle-man and just pass 
> them from the Model to the View.
> 
> Perhaps I am expecting too much.

No, I understand entirely, and you aren't expecting too much at all - except 
perhaps any expectation that this would already be fully implemented :)

We're doing this in Reaction using Moose to provide an introspectable 
metamodel so the update action class reflects its constraints off the model 
and then the form reflects its field types off the update action and the 
fields just have the constraints "already there" when they're doing 
validation. It's been hard work and there's a lot of hard work still to come 
but so far it works bloody well.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list