PageRenderTime 50ms CodeModel.GetById 47ms app.highlight 1ms RepoModel.GetById 2ms 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 | 0 complexity | a5966cbee2ce6fd89d571b38623bdb7c MD5 | raw file
 1from django.conf import settings
 2from django.core.exceptions import ImproperlyConfigured
 3from django.utils.importlib import import_module
 4
 5geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
 6
 7try:
 8    module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
 9except ImportError, e:
10    try:
11        module = import_module(geom_backend)
12    except ImportError, e_user:
13        raise ImproperlyConfigured('Could not import user-defined GEOMETRY_BACKEND '
14                                   '"%s".' % geom_backend)
15
16try:
17    Geometry = module.Geometry
18    GeometryException = module.GeometryException
19except AttributeError:
20    raise ImproperlyConfigured('Cannot import Geometry from the "%s" '
21                               'geometry backend.' % geom_backend)