[Catalyst] Re: [RHTMLO] RDBO/RHTMLO integration with Catalyst - work in progress

Peter Karman peter at peknet.com
Sat Jul 21 14:02:24 GMT 2007


check out Catalyst::Controller::Rose on cpan.

It has a different philosophy than what you've described. But if you find 
features missing that you think would make it more useful, please send me 
patches/tests/docs etc. You might consider writing a new 
Catalyst::Controller::Rose::SomeThing to implement what you're describing with YAML.

Alexandre Jousset wrote on 7/21/07 7:56 AM:
> 	Hello lists,
> 
> 	Since I haven't seen any work like this before (if I'm wrong please 
> give me pointers!) I started to write a Catalyst Controller called 
> "Catalyst::Controller::RHTMLO" to integrate RHTMLO (and a few bits of 
> RDBO) to Catalyst the same way "Catalyst::Controller::FormBuilder" do. 
> In fact my work is originally based on it.
> 
> 	For the moment the only thing one can do with it is to define a form in 
> YAML (or any config file recognized by "Config::Loader") and have it 
> displayed in the template (TT2 for the moment, but others are planned).
> 
> 	The module also defines, like the FormBuilder one, a 'Form' method 
> attribute. The plan is to have forms automagically validated and, if no 
> errors, give the user (developper) the ability to save them as objects 
> in the db. Else, the error messages are set for user convenience.
> 
> 	Here is an example of a YAML file for the action "/user/create", 
> located in .../root/forms/user/create.yaml:
> --------------------------------------------------------
> name:   UserCreateForm # optional, automatically computed
> method: post
> rdbo:   User # class of the rdbo object, used to load/save objects and 
> also for field init (see below, types are sometimes missing, but it works)
> fields_order:
>          - login
>          - disp_name
>          - mail
>          - disp_mail
>          - home_page
>          - pass
>          - pass2
>          - submit
> fields:
>          login:
>                  label:    Login
>                  validate: /^.{4\,40}$/, /^\w*$/
>                  message:  Between 4 and 40 characters, Only 
> alphanumeric characters
>                  required: 1
>          disp_name:
>                  label:    Real name (public)
>                  validate: /^.{0\,50}$/, /^[\w\.-\(\)]*$/
>                  message:  Max 50 characters, Forbidden character(s)
>          mail:
>                  label:    Real Email
>                  type:     email
>                  message:  Invalid Email
>                  required: 1
>          disp_mail:
>                  label:    Displayed Email (public)
>                  validate: /^.{0\,80}$/
>                  message:  Max 80 characters
>          home_page:
>                  label:    URL
>                  validate: /^.{0\,100}$/
>                  message:  Invalid URL
>          pass:
>                  label:    Password
>                  type:     password
>                  validate: /^.{4\,40}$/
>                  required: 1
>                  message:  Between 4 and 40 characters
>          pass2:
>                  label:    Password confirmation
>                  type:     password
>                  validate: /^.{4\,40}$/
>                  message:  Between 4 and 40 characters
>                  required: 1
>          submit:
>                  type:     submit
> --------------------------------------------------------
> 
> 	I haven't packaged it yet and I think it is too early (despite the 
> "release early, release often" moto) so I can't upload it to CPAN but I 
> have some question to ask to you all:
> 
> 	- Is the name I gave a good name? I don't think so. I think it should 
> mention the fact that it also concerns RDBO.
> 	- Are you interested in a module like this? I'm pretty sure somebody is 
> ;-) I'm the first ;-)
> 	- What are your requests / suggestions about a module like this? Feel 
> free to ask questions if my explanation wasn't enough.
> 	- Should I keep the validation system like this, or should I create 
> validation classes (better IMHO)? For the moment the error messages are 
> localized in the template with a macro.
> 
> 	Thank you for your attention.
> 
> 	Regards,

-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com



More information about the Catalyst mailing list