On Fri, Oct 17, 2008 at 2:25 PM, Christopher Arndt <[EMAIL PROTECTED]> wrote: > > Ken Kuhlman schrieb: >> On Thu, Oct 16, 2008 at 9:39 AM, Christopher Arndt <[EMAIL PROTECTED]> wrote: >>> 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. >> Ticket 2013 seems to be a duplicate of #1793. > > Well, #1793 is the documentation ticket and #2013 the implementation. > Even if we commit this, we still need to document it (and ideally also > some other techniques for pre-populating the db). But I just added some > cross-references to both tickets. > >> I like the technique >> that Chris Z. posted in the first link listed in that ticket [1]. >> Basically, he recommends putting a initdb() function in model.py. > > Yes, the 'initdb' function he suggests is basically the 'bootstrap' > function in my patch minus the option parsing stuff. > >> Would you be willing to consider a hybrid that puts the actual logic >> in model.py, but also adds a command wrapper to call it? > > Yes, I don't like it to have the database-related code in commands.py > either, hence my doubt about adding too much complexity to commands.py, > but I didn't know where to put it best. Honestly, I didn't think of > model.py, but now that you suggest it, it seems the obvious choice. > >> I don't have a patch, but could put one together if you'd like. > > Thanks, but I'll update the patch myself.
Ok, cool. > >> Two minor notes: >> * A command-based solution won't work with AppEngine, where there is >> no command line access to the DB. Of course we have a lot of other, >> bigger, issues with GAE, but this will be one more. > > Well, you could change the dburi, so you can execute the script > remotely. But does SQAlchemy/SQLObject even work with GAE's database > engine? If not, I don't really care about this point, since the whole > code of the patch is dependent on SA/SO. > GAE wants people to drink the BigTable kool-aide, so SA & SO won't support it anytime soon. So I agree that you're position is reasonable. >> * Why not go ahead and add the bootstrap line to the project's >> startup.py instead of having it be a separate step for the user? > > It is already there, the user just needs to uncomment it. I didn't > enable it by default, because with this script and the configuration > file, anybody who can access the script can wipe the database. So I > thought it better to have a safe default. But I'll be easily convinced > otherwise, if you have good arguments. > Well, the arguments would be (1) that they could also create & drop the tables already via "tg-admin sql", and (2) that this is such a common function that it should be as easy & obvious as possible. I'll let you decide if those are good enough. For whatever it's worth, you have my +1. > > Chris thanks, -Ken --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
