On Aug 19, 8:32 pm, "Yuri Baburov" <[EMAIL PROTECTED]> wrote:
> Hi devs,
>
> Happily there's ihooks.py that does 99% of work (and a bit more).
>
> Please see ticket and applied patch:http://code.djangoproject.com/ticket/8413
> Working for me on windows and linux.
Hmmm, I thought one had to be careful using ihooks going forward. I
thought:
http://www.python.org/dev/peps/pep-0302/
defined proper way of doing things now. The PEP says:
Forward Compatibility
Existing __import__ hooks will not invoke new-style hooks by
magic,
unless they call the original __import__ function as a fallback.
For example, ihooks.py, iu.py and imputil.py are in this sense not
forward compatible with this PEP.
I haven't got source code for Python to look at at moment to work it
out.
Graham
> Also one can use the patch to track wrong imports, and it might be
> useful to add warn() to tell people they are doing wrong thing and
> that might have unpleasant consequences for them:
> # It's recommended to fix django to never reach this place
> # and remove this except case, seehttp://bugs.python.org/issue2090
> # and related django bugs: #6587 and #6579
> # XXX: Turn it on to catch empty-name module imports.
> # print 'Importing empty module with __import__:', m.__name__
>
> I'm not sure if the patch can be in 1.0: some more testing required,
> and problem is not very important.
> But, well, it can be mentioned in release notes :)
>
> On Mon, Aug 18, 2008 at 6:28 AM, Steve Holden <[EMAIL PROTECTED]> wrote:
> > Not only that, but the Python import system is a maze of twisty little
> > passages, all alike. Overloading __import__ isn't as straightforward as
> > it might casually appear.
>
> --
> Best regards, Yuri V. Baburov, ICQ# 99934676, Skype: yuri.baburov,
> MSN: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---