Re: App-loading reloaded

2013-12-31 Thread Jannis Leidel
On 23.12.2013, at 22:50, Aymeric Augustin wrote: > The time frame I had allocated to this project expires tomorrow. With > reference to my original list, I’ve reached goals 1, 2, 6 and 7, with the > caveat that I still have to write documentation. > > I ran out of time before looking serious

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Marc Tamlyn
I'd also suggest that the ORM is only disallowed until such as time as the models are set up - we require Queryset creation at module level in forms for example. Obviously your models.py should not import your forms.py, but that's another issue. On 31 December 2013 10:31, Anssi Kääriäinen wrote:

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Anssi Kääriäinen
On 12/31/2013 12:13 PM, Aymeric Augustin wrote: On 31 déc. 2013, at 10:40, Anssi Kääriäinen wrote: Another solution is to prevent generation of QuerySets before models are fully loaded. I think Django does that since I removed the re-entracy hack in Apps.populate(). get_models() now raises

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Aymeric Augustin
On 31 déc. 2013, at 10:46, Anssi Kääriäinen wrote: > A question: what happens if you have multiple name = "django.contrib.auth" > AppConfigs in your project? https://code.djangoproject.com/ticket/21679 :-) -- Aymeric. -- You received this message because you are subscribed to the Google Gro

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Aymeric Augustin
On 31 déc. 2013, at 10:40, Anssi Kääriäinen wrote: > Another solution is to prevent generation of QuerySets before models are > fully loaded. I think Django does that since I removed the re-entracy hack in Apps.populate(). get_models() now raises an exception until all models are fully loaded,

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Anssi Kääriäinen
On 12/30/2013 11:05 PM, Aymeric Augustin wrote: On 30 déc. 2013, at 21:59, Marc Tamlyn > wrote: On another note, if you're going to muck about with a model in an existing app (perhaps for a very good reason like Permission) the best way of doing that (IMO) would b

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Anssi Kääriäinen
On 12/31/2013 10:54 AM, Aymeric Augustin wrote: On 31 déc. 2013, at 05:41, Daniel Lindsley wrote: On Problem #1, IMO, I'd prefer to see something akin to an ``AppConfig.setup`` (before anything is imported or built) & an ``AppConfig.complete`` (after all classes have been setup for the

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Anssi Kääriäinen
On 12/31/2013 10:41 AM, Aymeric Augustin wrote: On 31 déc. 2013, at 04:28, Russell Keith-Magee mailto:russ...@keith-magee.com>> wrote: On Mon, Dec 30, 2013 at 8:29 PM, Aymeric Augustin > wrote: Logically, this would get called when the app cache

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Anssi Kääriäinen
On 12/30/2013 10:10 PM, Anssi Kääriäinen wrote: First, a big +1 for improved app-loading sequence. Problem 2: my vote for solution 2.b. This seems to be the most reliable way. Quick throwaway scripts will need two more lines of boilerplate code but that is easily worth the added reliability.

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Aymeric Augustin
On 31 déc. 2013, at 05:41, Daniel Lindsley wrote: > On Problem #1, IMO, I'd prefer to see something akin to an > ``AppConfig.setup`` (before anything is imported or built) & an > ``AppConfig.complete`` (after all classes have been setup for the app). I > think this would make it clearer as

Re: App-loading reloaded - running code at startup

2013-12-31 Thread Aymeric Augustin
On 31 déc. 2013, at 04:28, Russell Keith-Magee wrote: > On Mon, Dec 30, 2013 at 8:29 PM, Aymeric Augustin > wrote: > > Logically, this would get called when the app cache is fully populated. > Running user code while the app cache isn’t ready will backfire. > > But at this point it’s too lat