On Oct 13, 3:12 pm, Benjamin Slavin <benjamin.sla...@gmail.com> wrote:

> It looks like I may actually be able to put a bit of time toward a new
> implementation for this, so I'll keep the list posted.

As I said, great! But I thought I would have a go, too. Here's what I
did: changed Django in two places, conf/__init__.py and db/models/
loading.py. Here's a link to the diff (relative to r11620):

http://gist.github.com/209519

The two changes are to look for settings called BOOTSTRAP_CALLBACKS
and PRE_MODEL_CALLBACKS, each of which supposed to be a tuple of
callables, and all the callbacks are called at the appropriate times.

Next, I ran django-admin.py startproject logtest to create a brand-new
project. I changed settings.py, here's a link to it. The interesting
changes are at the end, after "import logging".

http://gist.github.com/209522

So, I've actually added (in BOOTSTRAP_CALLBACKS) a callable to
initialise logging (and another callable to test it, commented out for
now). In PRE_MODEL_CALLBACKS, I've added a callable which registers a
listener for class_prepared.

I then ran "python manage.py validate" in the project directory, which
gave me 0 errors. The logtest.log file shows that the listener was
registered and called back as expected. Here's the link to the log
file:

http://gist.github.com/209526

So, we can initialise logging, register a class_prepared listener, and
log some information when it's called.

Ben, what do you think about this?

Regards,

Vinay Sajip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to