PageRenderTime 163ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/django/contrib/gis/geometry/backend/__init__.py

https://code.google.com/p/mango-py/
Python | 21 lines | 18 code | 3 blank | 0 comment | 6 complexity | a5966cbee2ce6fd89d571b38623bdb7c MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from django.conf import settings
  2. from django.core.exceptions import ImproperlyConfigured
  3. from django.utils.importlib import import_module
  4. geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
  5. try:
  6. module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
  7. except ImportError, e:
  8. try:
  9. module = import_module(geom_backend)
  10. except ImportError, e_user:
  11. raise ImproperlyConfigured('Could not import user-defined GEOMETRY_BACKEND '
  12. '"%s".' % geom_backend)
  13. try:
  14. Geometry = module.Geometry
  15. GeometryException = module.GeometryException
  16. except AttributeError:
  17. raise ImproperlyConfigured('Cannot import Geometry from the "%s" '
  18. 'geometry backend.' % geom_backend)