                          'Oracle or MySQL spatial backends.')
      SpatialRefSys = connection.ops.spatial_ref_sys()
  
      if not isinstance(srs, SpatialReference):
          srs = SpatialReference(srs)
  
      if srs.srid is None:
          raise Exception('Spatial reference requires an SRID to be '
                          'compatible with the spatial backend.')
 
</s> remove         raise Exception('Spatial reference requires an SRID to be compatible with PostGIS.')
 </s> add         raise Exception('Spatial reference requires an SRID to be '
                        'compatible with the spatial backend.') </s> remove     if SpatialBackend.oracle or SpatialBackend.mysql:
        raise Exception('This utility not supported on Oracle or MySQL spatial backends.')
 </s> add      database:
      The name of the database connection to use; the default is the value
      of `django.db.DEFAULT_DB_ALIAS` (at the time of this writing, it's value
      is 'default').
    """
    connection = connections[database]
    if not hasattr(connection.ops, 'spatial_version'):
        raise Exception('The `add_srs_entry` utility only works '
                        'with spatial backends.')
    if connection.ops.oracle or connection.ops.mysql:
        raise Exception('This utility does not support the '
                        'Oracle or MySQL spatial backends.')
    SpatialRefSys = connection.ops.spatial_ref_sys() </s> remove     # Initializing the keyword arguments dictionary for both PostGIS and SpatiaLite.
 </s> add     # Initializing the keyword arguments dictionary for both PostGIS
    # and SpatiaLite. </s> remove      ref_sys_name: For SpatiaLite users only, sets the value of the
                   the `ref_sys_name` field.  Defaults to the name
                   determined by GDAL.
    """
    from django.contrib.gis.db.backend import SpatialBackend
    from django.contrib.gis.models import SpatialRefSys
    from django.contrib.gis.gdal import SpatialReference
 </s> add      ref_sys_name:
       For SpatiaLite users only, sets the value of the the `ref_sys_name` field.
       Defaults to the name determined by GDAL. </s> remove     This function takes a GDAL SpatialReference system and adds its
    information to the PostGIS `spatial_ref_sys` table -- enabling
    spatial transformations with PostGIS.  This is handy for adding
    spatial reference systems not included by default with PostGIS.
    For example, the following adds the so-called "Google Maps Mercator
    Projection" (available in GDAL 1.5):
 </s> add     This function takes a GDAL SpatialReference system and adds its information
    to the `spatial_ref_sys` table of the spatial backend.  Doing this enables
    database-level spatial transformations for the backend.  Thus, this utility
    is useful for adding spatial reference systems not included by default with
    the backend -- for example, the so-called "Google Maps Mercator Projection"
    is excluded in PostGIS 1.3 and below, and the following adds it to the
    `spatial_ref_sys` table:
    # If argument is not a `SpatialReference` instance, use it as parameter
    # to construct a `SpatialReference` instance.
                          'Oracle or MySQL spatial backends.')
      SpatialRefSys = connection.ops.spatial_ref_sys()
  
    # If argument is not a `SpatialReference` instance, use it as parameter
    # to construct a `SpatialReference` instance.
      if not isinstance(srs, SpatialReference):
          srs = SpatialReference(srs)
  
      if srs.srid is None:
          raise Exception('Spatial reference requires an SRID to be '
                          'compatible with the spatial backend.')
keep keep add keep keep keep keep keep keep
 Fixed #12591 -- Renamed `add_postgis_srs` to `add_srs_entry` (keeping backwards-compatible alias), added `database` keyword for multi-db, removed deprecated `SpatialBackend` references; no longer use `get_or_create` and look for existing entry based on SRID value. 


git-svn-id: http://code.djangoproject.com/svn/django/trunk@12228 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/contrib/gis/utils/srs.py