Wouldn't it be easy enough to support both strings and direct
references to the views? The callable() function can check that
The logic would be something like this:
if callable(viewfunc):
viewfunc()
else:
# resolve function using the older means.
or you could just check if viewfunc was an instance of str / unicode,
else try and call it.
I'd say there might still be some times you want to use the string references.
Also, how would this change affect reloading for e.g. when running
under django-admin.py runserver? Would it be as easy to detect when
something changed and re-load that module? What happens to the
urlconf which still contains a reference to the stale function?
On 5/7/06, Honza Král <[EMAIL PROTECTED]> wrote:
> I would like to see all the strings (eg INSTALLED_APPS) replaced by
> the actual objects, but I am not sure whether its
> a) wise
> b) possible
I'd say that doing this can be a minefield, as this would mean that
every app would have to be loaded at the settings.py parse time, even
if we only intended to use one of the apps. For example, you might be
doing something like:
./manage.py install app1
which in theory would only have to load things from app1,
but it'd have to load all the apps regardless in order for settings.py
to parse. This also might pose reload issues as well.
If there's an error importing the apps at this stage, manage.py would
bork out, with a not-helpful error: it will catch the ImportError and
give you an error saying your settings.py does not exist or could not
be found. This is an issue in and of itself, and I've run into it
before when I had one settings.py importing settings from another,
though it ought to be addressed separately.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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/django-developers
-~----------~----~----~----~------~----~------~--~---