Flask extension and isinstance conflict

The way of importing Flask extensions is so annoying:

from flask.ext.foo import Bar

It is annoying because most of the Python IDEs (Komodo and PyCharm) cannot parse it to provide code navigation or autocompletion.

One workaround is to change the import line to

from flask_foo import Bar

However, the problem does not stop there. The isinstance function cannot know that flask.ext.foo.Parent and flask_foo.Parent are the same and thus it fail, like the case I encountered here.

Website này sử dụng Disqus cho comment. Nếu bạn không thấy các comment dưới đây, có lẽ Disqus đang bị chặn. Bạn cần đổi DNS.
comments powered by Disqus