compat.py 760 B

123456789101112131415161718192021
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. """Imports that vary depending on available libraries or python versions."""
  5. # If funfactory is available, we want to use its locale-aware reverse
  6. # instead of Django's reverse, so we try to import funfactory's first
  7. # and fallback to Django's if it is not found.
  8. try:
  9. from funfactory.urlresolvers import reverse
  10. except ImportError:
  11. from django.core.urlresolvers import reverse
  12. # If PyBrowserID is installed, we can support local verification.
  13. try:
  14. import browserid
  15. pybrowserid_found = True
  16. except ImportError:
  17. pybrowserid_found = False