I don't know whether any of you are familiar with Grails (www.grails.org);  
I was using it for a few years but for a variety of reasons have moved to 
Python. However there are features of Grails that I did find particular 
useful and I felt that there may be some benefit, to me at least, in 
reproducing some of the features of Grails.

To summarise: I've written a little Python script that you can use to 
create a skeleton model file with the model as a class in its own file; you 
then complete the model by adding Field(...) definitions to the define_table
() entry and optionally add a few other attributes etc. The generator 
script can then write the controller and the set of views for that model. 
And then repeat for your various models. You will then have a working 
application immediately without writing any code but, of course, in reality 
most will want to tailor the views and controllers to their own 
requirements but the generated Python scripts provide a sound base from 
which anyone can work.

It can cope with one to one and one to many relationships, dealing with the 
data presentation by the use of modal pop-ups and with appropriate code in 
the controllers. 

Currently it works although I am in the process of putting the final 
touches and, needless to say, there are a good many little things that are 
still required. And there are some, but not many, conventions that must be 
used in order that the generator can make sense of the model.

I'm posting this to discover whether there is anyone else who may be 
interested in this type of application development and who may be 
interested in the generator script. I am minded to make the whole thing 
open source as it's hardly any of my ideas and others may want to make use 
of it to take a slightly different direction or whatever... 

If you are interested then either reply here or email me.

I would point out that the generated code does not make use of some web2py 
features: it does not use self-submission nor does it make use of features 
like SQLFORM, I did not feel that in my particular applications these 
offered me any great benefits and may have complicated some matters. If 
anything it tries to keep the whole thing simple with very visible code and 
HTML and I suppose could very readily be applied to other environments. The 
starting point was actually Bruno Rocha's http://www.web2pyslices.com/slice/
show/1478/using-modules-in-web2py where he describes using model classes 
in /modules.

And I do understand that this whole approach may be seen as not in the 
spirit of web2py so I'll apologise in advance if I am causing any distress.

graham

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to