root / trunk / twisted / internet / qtreactor.py

Revision 19009, 0.5 kB (checked in by exarkun, 3 years ago)

Merge qtreactor-stub-2137

Author: PenguinOfDoom?
Reviewer: glyph
Fixes #2137

This adds a reactor plugin which will attempt to import qtreactor and
warn that the name qt is now deprecated. If qtreactor cannot be
imported it will point to the location from which it can be retrieved.

This also adds a similar backwards-compatibility stub for
twisted.internet.qtreactor for applications which install it themselves
rather than using twistd.

Line 
1 try:
2     # 'import qtreactor' would have imported this file instead of the
3     # top-level qtreactor. __import__ does the right thing
4     # (kids, don't repeat this at home)
5     install = __import__('qtreactor').install
6 except ImportError:
7     from twisted.plugins.qtreactor_stub import errorMessage
8     raise ImportError(errorMessage)
9 else:
10     import warnings
11     warnings.warn("Please use qtreactor instead of twisted.internet.qtreactor",
12                   category=DeprecationWarning)
13
14 __all__ = ['install']
15
Note: See TracBrowser for help on using the browser.