On Thu, Oct 16, 2008 at 8:39 AM, Christopher Arndt <[EMAIL PROTECTED]> wrote:
>
> Florent Aide schrieb:
>> On Wed, Oct 15, 2008 at 10:28 PM, Jorge Vargas <[EMAIL PROTECTED]> wrote:
>>> I have answer this two times in the past 2 days on IRC, which i think
>>> is something that could be back ported or at least write some
>>> documentation.
>>>
>>> The issue at hand is that people want to prepopulate either test data
>>> or default SQL rows values, to their models.
>>>
>>
>> If you document a method please document this one which is the
>> cleaner. I recommend naming the entry point bootstrap
>> (myapp-bootstrap). If you need more info to begin writing docs on this
>> method don't hesitate I'll gladly help.
>
> I have written an example command.py that provides a "bootstrap"
> function for a console script "bootstrap-<yourpkg>", which creates all
> tables and optionally creates a user.
>
>    http://paste.turbogears.org/paste/10038
>
> The example is SQLAlchemy, but I have also written a patch against
> current TG 1.1 HEAD that adds support for this in commands.py in the
> default quickstart template and which also works for SQLObject-based
> projects.
>
>    http://trac.turbogears.org/ticket/2013
>
> Would this be something that should be added to the default quickstart
> template or will this make the code in commands.py too complex?
>
that is awesome. In fact it's less obscure than how websetup.py works.
I think most of it should go inside TG, and we should write docs on
how to modify it, for that part I think the best will be to provide a
callback by means of a callable to add more stuff to the default
initialization.

So everything goes in commands except create_default_user which will
go in quickstart and after it something of the likes of.

#provide boostrap functions with default data to be inserted into the database,
#each of this should create an instance and take care of saving it
tg.commands.bootstrap.add(create_default_user)

then of course bootstrap will store that in a list and execute them
after create_tables.

>
> Chris
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to