Author: ccahoon
Date: 2009-06-12 22:28:00 -0500 (Fri, 12 Jun 2009)
New Revision: 10990

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
   django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
Log:
Fixed #11216 and #11218 -- Corrected a few typos, thanks buriy.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
===================================================================
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
       2009-06-13 03:27:48 UTC (rev 10989)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
       2009-06-13 03:28:00 UTC (rev 10990)
@@ -12,12 +12,12 @@
 
 def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False):
     """
-    Given a DataSource, generates a dictionary that may be used 
+    Given a DataSource, generates a dictionary that may be used
     for invoking the LayerMapping utility.
 
     Keyword Arguments:
      `geom_name` => The name of the geometry field to use for the model.
-     
+
      `layer_key` => The key for specifying which layer in the DataSource to 
use;
        defaults to 0 (the first layer).  May be an integer index or a string
        identifier for the layer.
@@ -31,7 +31,7 @@
         pass
     else:
         raise TypeError('Data source parameter must be a string or a 
DataSource object.')
-    
+
     # Creating the dictionary.
     _mapping = {}
 
@@ -52,32 +52,32 @@
     model name this function will generate a GeoDjango model.
 
     Usage:
-    
+
     >>> from django.contrib.gis.utils import ogrinspect
     >>> ogrinspect('/path/to/shapefile.shp','NewModel')
-    
+
     ...will print model definition to stout
-    
+
     or put this in a python script and use to redirect the output to a new
     model like:
-    
+
     $ python generate_model.py > myapp/models.py
-    
-    # generate_model.py 
+
+    # generate_model.py
     from django.contrib.gis.utils import ogrinspect
     shp_file = 'data/mapping_hacks/world_borders.shp'
     model_name = 'WorldBorders'
 
     print ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
                      geom_name='shapes', blank=True)
-                     
+
     Required Arguments
      `datasource` => string or DataSource object to file pointer
-     
+
      `model name` => string of name of new model class to create
-      
+
     Optional Keyword Arguments
-     `geom_name` => For specifying the model name for the Geometry Field. 
+     `geom_name` => For specifying the model name for the Geometry Field.
        Otherwise will default to `geom`
 
      `layer_key` => The key for specifying which layer in the DataSource to 
use;
@@ -86,24 +86,24 @@
 
      `srid` => The SRID to use for the Geometry Field.  If it can be 
determined,
        the SRID of the datasource is used.
-      
+
      `multi_geom` => Boolean (default: False) - specify as multigeometry.
-     
+
      `name_field` => String - specifies a field name to return for the
        `__unicode__` function (which will be generated if specified).
-     
-     `imports` => Boolean (default: True) - set to False to omit the 
-       `from django.contrib.gis.db import models` code from the 
+
+     `imports` => Boolean (default: True) - set to False to omit the
+       `from django.contrib.gis.db import models` code from the
        autogenerated models thus avoiding duplicated imports when building
        more than one model by batching ogrinspect()
-     
+
      `decimal` => Boolean or sequence (default: False).  When set to True
        all generated model fields corresponding to the `OFTReal` type will
        be `DecimalField` instead of `FloatField`.  A sequence of specific
        field names to generate as `DecimalField` may also be used.
 
      `blank` => Boolean or sequence (default: False).  When set to True all
-       generated model fields will have `blank=True`.  If the user wants to 
+       generated model fields will have `blank=True`.  If the user wants to
        give specific fields to have blank, then a list/tuple of OGR field
        names may be used.
 
@@ -111,13 +111,13 @@
        model fields will have `null=True`.  If the user wants to specify
        give specific fields to have null, then a list/tuple of OGR field
        names may be used.
-     
+
     Note: This routine calls the _ogrinspect() helper to do the heavy lifting.
     """
     return '\n'.join(s for s in _ogrinspect(*args, **kwargs))
 
 def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, 
srid=None,
-                multi_geom=False, name_field=None, imports=True, 
+                multi_geom=False, name_field=None, imports=True,
                 decimal=False, blank=False, null=False):
     """
     Helper routine for `ogrinspect` that generates GeoDjango models 
corresponding
@@ -140,7 +140,7 @@
     # keyword arguments.
     def process_kwarg(kwarg):
         if isinstance(kwarg, (list, tuple)):
-            return [s.lower() for s in kwarg] 
+            return [s.lower() for s in kwarg]
         elif kwarg:
             return [s.lower() for s in ogr_fields]
         else:
@@ -164,18 +164,18 @@
         yield ''
 
     yield 'class %s(models.Model):' % model_name
-    
+
     for field_name, width, precision, field_type in izip(ogr_fields, 
layer.field_widths, layer.field_precisions, layer.field_types):
         # The model field name.
         mfield = field_name.lower()
         if mfield[-1:] == '_': mfield += 'field'
-        
+
         # Getting the keyword args string.
         kwargs_str = get_kwargs_str(field_name)
 
         if field_type is OFTReal:
             # By default OFTReals are mapped to `FloatField`, however, they
-            # may also be mapped to `DecimalField` if specified in the 
+            # may also be mapped to `DecimalField` if specified in the
             # `decimal` keyword.
             if field_name.lower() in decimal_fields:
                 yield '    %s = models.DecimalField(max_digits=%d, 
decimal_places=%d%s)' % (mfield, width, precision, kwargs_str)
@@ -192,8 +192,8 @@
         elif field_type is OFTDate:
             yield '    %s = models.TimeField(%s)' % (mfield, kwargs_str[2:])
         else:
-            raise TypeError('Unknown field type %s in %s' % (fld_type, mfield))
-    
+            raise TypeError('Unknown field type %s in %s' % (field_type, 
mfield))
+
     # TODO: Autodetection of multigeometry types (see #7218).
     gtype = layer.geom_type
     if multi_geom and gtype.num in (1, 2, 3):

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
===================================================================
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py    
    2009-06-13 03:27:48 UTC (rev 10989)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py    
    2009-06-13 03:28:00 UTC (rev 10990)
@@ -689,7 +689,7 @@
 
         If 'with_aliases' is true, any column names that are duplicated
         (without the table names) are given unique aliases. This is needed in
-        some cases to avoid ambiguitity with nested queries.
+        some cases to avoid ambiguity with nested queries.
         """
         qn = self.quote_name_unless_alias
         qn2 = self.connection.ops.quote_name
@@ -1303,7 +1303,7 @@
         opts = self.model._meta
         root_alias = self.tables[0]
         seen = {None: root_alias}
-        
+
         # Skip all proxy to the root proxied model
         proxied_model = get_proxied_model(opts)
 
@@ -1732,7 +1732,7 @@
                 raise MultiJoin(pos + 1)
             if model:
                 # The field lives on a base class of the current model.
-                # Skip the chain of proxy to the concrete proxied model        
        
+                # Skip the chain of proxy to the concrete proxied model
                 proxied_model = get_proxied_model(opts)
 
                 for int_model in opts.get_base_chain(model):
@@ -2362,7 +2362,7 @@
             return cursor
         if result_type == SINGLE:
             if self.ordering_aliases:
-                return cursor.fetchone()[:-len(results.ordering_aliases)]
+                return cursor.fetchone()[:-len(self.ordering_aliases)]
             return cursor.fetchone()
 
         # The MULTI case.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to