Malcolm,

As always, your expedient and thoughtful reply is appreciated.

On 10/3/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> The only thing that is really guaranteed to be loaded sufficiently early
> in the process is the settings module (along with the __init__.py file
> in the directory containing settings.py). So one solution is to place
> the hook loading in there.

This was my first thought, but it feels very hackish.  As you point
out, there are reasons why this is not desirable (dependence on
settings and portability of the app).


> Another solution is to subclass the handler for the types of request you
> are doing (modpython or wsgi) and install your hooks as part of the
> request processing in the subclass.

This is certainly a possibility, but again it doesn't feel right.


> [...] in this case, there is no reliable way to ensure your code is run
> sufficiently early.

Thus, my question :-)

> There might be an argument for putting a hook in all
> the handlers (and the interactive shell setup in django-admin.py) to
> call a Python function that you specify in your settings file. That
> would allow use to do any pre-runtime setup in a portable fashion.

I like the direction of this approach, and think it is worth looking
into further.  I assume that your vision is for an iterable object
like MIDDLEWARE_CLASSES that can specify multiple pre-runtime
functions?

I'd be happy to file a ticket and provide a patch (assuming there's no
nastiness I'm overlooking).  I'll bring this up on django-dev once I
have the ticket and patch in place.


> The workaround [for the management shell] will be removed eventually
> [...] It's harmless in any case, so not a really high priority.

Understood.  I've tested it without the work-around, and have had no
problems (other than the one discussed here).


Many thanks,
  - Ben

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

Reply via email to