One of the points that Rails ActiveRecord got right IMHO is the fact that models should validate themselves. So I started to work on adding rail-like validation to Elixir entities, using formencode. Here's a first Q&D and incomplete attempt, I'm awaiting for criticism, suggestions and other feedback.
On 4/25/07, bruno.desthuilli...@gmail.com <bruno.desthuilli...@gmail.com> wrote:
> Hi all
> One of the points that Rails ActiveRecord got right IMHO is the fact > that models should validate themselves. So I started to work on adding > rail-like validation to Elixir entities, using formencode. Here's a > first Q&D and incomplete attempt, I'm awaiting for criticism, > suggestions and other feedback.
At first glance, it looks GREAT. I'll have a more thorough look tomorrow and I'll try to think how and if we should include that directly in Elixir.
bruno.desthuilli...@gmail.com wrote: > One of the points that Rails ActiveRecord got right IMHO is the fact > that models should validate themselves. So I started to work on adding > rail-like validation to Elixir entities, using formencode. Here's a > first Q&D and incomplete attempt, I'm awaiting for criticism, > suggestions and other feedback.
> One of the points that Rails ActiveRecord got right IMHO is the fact > that models should validate themselves. So I started to work on adding > rail-like validation to Elixir entities, using formencode. Here's a > first Q&D and incomplete attempt, I'm awaiting for criticism, > suggestions and other feedback.
Doesn't that kind of validation belong to form library ?
On 26 avr, 07:18, "黄毅" <yi.codepla...@gmail.com> wrote:
> > One of the points that Rails ActiveRecord got right IMHO is the fact > > that models should validate themselves. So I started to work on adding > > rail-like validation to Elixir entities, using formencode. Here's a > > first Q&D and incomplete attempt, I'm awaiting for criticism, > > suggestions and other feedback.
> Doesn't that kind of validation belong to form library ?
Nope. Forms do of course have to handle their own conversion/ validation, but this is a different issue.
Looks like my previous answer got lost somewhere in the ether, so...
On 25 avr, 23:02, Jonathan LaCour <jonathan-li...@cleverdevil.org> wrote:
> Wow!
> I was considering adding statements exactly like these to Elixir, but it > looks like you have done all the work for us :)
Not quite *all* the work yet !-)
There's still a lot to do like pre/post validation hooks, more validate_XXX statements, etc, etc, and of course test, test, test.
> I'll take a closer look as soon as I can. Some examples that illustrate > how to use your statements would be very helpful.
Yes, indeed. Anyway, I won't go much further without first adding real unit-tests, so there should be working examples pretty soon now.
Gaetan : if adding a dependency on formencode is not a problem for you (I mean you three guys), I'd of course be happy (and honored) to see this code becoming part of Elixir - when it'll be a bit less dirty and a bit more tested.
Thanks you two for these first feedbacks. I'm awaiting your observations and suggestions after a closer look.
On 4/26/07, bruno.desthuilli...@gmail.com <bruno.desthuilli...@gmail.com> wrote:
> Gaetan : if adding a dependency on formencode is not a problem for you > (I mean you three guys), I'd of course be happy (and honored) to see > this code becoming part of Elixir - when it'll be a bit less dirty > and a bit more tested.
Sorry for the delay. I still haven't had the opportunity to look more closely at your code and probably won't have for some time (sorry about that... you know... life and all that stuff).
But anyway, after giving it some thoughts, I don't thing this belongs in. Don't get me wrong, I'm pretty sure your code is very useful (and I'll probably use it on a later project) but if we include your code that would be a important change of the scope of the library.
For now, it has been: "a declarative layer on top of SQLAlchemy", and that's it nothing more.
I'm open for discussion about this, but my personal stance at the moment is to try to keep the scope of Elixir as it is (ie quite narrow) but fill it as well as we can rather than going in all sorts of directions and ending up with a semi-complete-framework.
Gaetan de Menten wrote: > Sorry for the delay. I still haven't had the opportunity to look more > closely at your code and probably won't have for some time (sorry > about that... you know... life and all that stuff).
Its the same response from me! I have a lot going on right now between life and work, so I haven't had much time to spend on Elixir in a while :/ But, I am excited by the initial code that I have seen in your validation statements, but haven't gone over it enough to really provide feedback.
> I'm open for discussion about this, but my personal stance at the > moment is to try to keep the scope of Elixir as it is (ie quite > narrow) but fill it as well as we can rather than going in all sorts > of directions and ending up with a semi-complete-framework.
I would be open to providing an additional egg and including details about it on the Elixir page. Ideally, I would like a lot of people to start creating their own DSL statements for doing various things, including validation, tagging, etc. If we get enough of these rolling, I'd like to have something on the Elixir website that lists these "plugins" and provides a place to hold their documentation. I'd even be in favor of placing these plugins into our subversion repository, each in their own separate projects.
To me, this is a great way to build up Elixir. The core provides just what Gaetan said: a declarative layer on top of SQLAlchemy, along with a basis for extending it with plugins.
On 3 mai, 17:18, Jonathan LaCour <jonathan-li...@cleverdevil.org> wrote:
> Gaetan de Menten wrote: > > Sorry for the delay. I still haven't had the opportunity to look more > > closely at your code and probably won't have for some time (sorry > > about that... you know... life and all that stuff).
> Its the same response from me! I have a lot going on right now between > life and work, so I haven't had much time to spend on Elixir in a while
Don't worry you both and don't feel sorry - I have a life too, and had almost no time to work on this since my OP.
> > I'm open for discussion about this, but my personal stance at the > > moment is to try to keep the scope of Elixir as it is (ie quite > > narrow) but fill it as well as we can rather than going in all sorts > > of directions and ending up with a semi-complete-framework.
> I would be open to providing an additional egg and including details > about it on the Elixir page. Ideally, I would like a lot of people > to start creating their own DSL statements for doing various things, > including validation, tagging, etc. If we get enough of these rolling, > I'd like to have something on the Elixir website that lists these > "plugins" and provides a place to hold their documentation. I'd even be > in favor of placing these plugins into our subversion repository, each > in their own separate projects.
> To me, this is a great way to build up Elixir. The core provides just > what Gaetan said: a declarative layer on top of SQLAlchemy, along with a > basis for extending it with plugins.
All this seems quite sensible. But then it would be useful (IMHO) to have some (more or less) standardized way to organize/package/deploy these plugins...
These statements seem like they would make wonderful additions to elixir, and we'd just need to contact the author of the statements about adding them in. I would be happy to write some tests and documentation updates for the new statements.
> These statements seem like they would make wonderful additions to > elixir, and we'd just need to contact the author of the statements about > adding them in. I would be happy to write some tests and documentation > updates for the new statements.
> What does everyone (Gaetan, Daniel, etc.) think?
Well, I had already seen that code (notice the reference to it in the TODO file ;-)) and I'm fully in favor of providing an easy way to extend the mapper, but, as I said in the TODO file:
"Beachcoder's code seem pretty cool but I wonder if it wouldn't be possible to do something simpler." (ie less repetitive).
Btw: I've got quite a few changes in Elixir in my pipeline... Stay tuned... -- Gaëtan de Menten http://openhex.org