Loading django/contrib/gis/db/models/sql/compiler.py +5 −4 Original line number Diff line number Diff line from itertools import izip from future_builtins import zip from django.db.backends.util import truncate_name, typecast_timestamp from django.db.models.sql import compiler from django.db.models.sql.constants import MULTI Loading Loading @@ -32,7 +33,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): if self.query.select: only_load = self.deferred_to_columns() # This loop customized for GeoQuery. for col, field in izip(self.query.select, self.query.select_fields): for col, field in zip(self.query.select, self.query.select_fields): if isinstance(col, (list, tuple)): alias, column = col table = self.query.alias_map[alias].table_name Loading Loading @@ -78,7 +79,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): ]) # This loop customized for GeoQuery. for (table, col), field in izip(self.query.related_select_cols, self.query.related_select_fields): for (table, col), field in zip(self.query.related_select_cols, self.query.related_select_fields): r = self.get_field_select(field, table, col) if with_aliases and col in col_aliases: c_alias = 'Col%d' % len(col_aliases) Loading Loading @@ -184,7 +185,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): values = [self.query.convert_values(v, self.query.extra_select_fields.get(a, None), self.connection) for v, a in izip(row[rn_offset:index_start], aliases)] for v, a in zip(row[rn_offset:index_start], aliases)] if self.connection.ops.oracle or getattr(self.query, 'geo_values', False): # We resolve the rest of the columns if we're on Oracle or if # the `geo_values` attribute is defined. Loading django/contrib/gis/utils/ogrinspect.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ models for GeoDjango and/or mapping dictionaries for use with the Author: Travis Pinney, Dane Springmeyer, & Justin Bronn """ from itertools import izip from future_builtins import zip # Requires GDAL to use. from django.contrib.gis.gdal import DataSource from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime Loading Loading @@ -165,7 +165,7 @@ def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non 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): for field_name, width, precision, field_type in zip(ogr_fields, layer.field_widths, layer.field_precisions, layer.field_types): # The model field name. mfield = field_name.lower() if mfield[-1:] == '_': mfield += 'field' Loading django/db/models/base.py +4 −4 Original line number Diff line number Diff line import copy import sys from functools import update_wrapper from itertools import izip from future_builtins import zip import django.db.models.manager # Imported to register signal handler. from django.conf import settings Loading Loading @@ -292,15 +292,15 @@ class Model(object): fields_iter = iter(self._meta.fields) if not kwargs: # The ordering of the izip calls matter - izip throws StopIteration # The ordering of the zip calls matter - zip throws StopIteration # when an iter throws it. So if the first iter throws it, the second # is *not* consumed. We rely on this, so don't change the order # without changing the logic. for val, field in izip(args, fields_iter): for val, field in zip(args, fields_iter): setattr(self, field.attname, val) else: # Slower, kwargs-ready version. for val, field in izip(args, fields_iter): for val, field in zip(args, fields_iter): setattr(self, field.attname, val) kwargs.pop(field.name, None) # Maintain compatibility with existing calls. Loading django/db/models/sql/compiler.py +3 −3 Original line number Diff line number Diff line from itertools import izip from future_builtins import zip from django.core.exceptions import FieldError from django.db import transaction Loading Loading @@ -882,7 +882,7 @@ class SQLInsertCompiler(SQLCompiler): placeholders = [["%s"] * len(fields)] else: placeholders = [ [self.placeholder(field, v) for field, v in izip(fields, val)] [self.placeholder(field, v) for field, v in zip(fields, val)] for val in values ] if self.return_id and self.connection.features.can_return_id_from_insert: Loading @@ -899,7 +899,7 @@ class SQLInsertCompiler(SQLCompiler): else: return [ (" ".join(result + ["VALUES (%s)" % ", ".join(p)]), vals) for p, vals in izip(placeholders, params) for p, vals in zip(placeholders, params) ] def execute_sql(self, return_id=False): Loading Loading
django/contrib/gis/db/models/sql/compiler.py +5 −4 Original line number Diff line number Diff line from itertools import izip from future_builtins import zip from django.db.backends.util import truncate_name, typecast_timestamp from django.db.models.sql import compiler from django.db.models.sql.constants import MULTI Loading Loading @@ -32,7 +33,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): if self.query.select: only_load = self.deferred_to_columns() # This loop customized for GeoQuery. for col, field in izip(self.query.select, self.query.select_fields): for col, field in zip(self.query.select, self.query.select_fields): if isinstance(col, (list, tuple)): alias, column = col table = self.query.alias_map[alias].table_name Loading Loading @@ -78,7 +79,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): ]) # This loop customized for GeoQuery. for (table, col), field in izip(self.query.related_select_cols, self.query.related_select_fields): for (table, col), field in zip(self.query.related_select_cols, self.query.related_select_fields): r = self.get_field_select(field, table, col) if with_aliases and col in col_aliases: c_alias = 'Col%d' % len(col_aliases) Loading Loading @@ -184,7 +185,7 @@ class GeoSQLCompiler(compiler.SQLCompiler): values = [self.query.convert_values(v, self.query.extra_select_fields.get(a, None), self.connection) for v, a in izip(row[rn_offset:index_start], aliases)] for v, a in zip(row[rn_offset:index_start], aliases)] if self.connection.ops.oracle or getattr(self.query, 'geo_values', False): # We resolve the rest of the columns if we're on Oracle or if # the `geo_values` attribute is defined. Loading
django/contrib/gis/utils/ogrinspect.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ models for GeoDjango and/or mapping dictionaries for use with the Author: Travis Pinney, Dane Springmeyer, & Justin Bronn """ from itertools import izip from future_builtins import zip # Requires GDAL to use. from django.contrib.gis.gdal import DataSource from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime Loading Loading @@ -165,7 +165,7 @@ def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non 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): for field_name, width, precision, field_type in zip(ogr_fields, layer.field_widths, layer.field_precisions, layer.field_types): # The model field name. mfield = field_name.lower() if mfield[-1:] == '_': mfield += 'field' Loading
django/db/models/base.py +4 −4 Original line number Diff line number Diff line import copy import sys from functools import update_wrapper from itertools import izip from future_builtins import zip import django.db.models.manager # Imported to register signal handler. from django.conf import settings Loading Loading @@ -292,15 +292,15 @@ class Model(object): fields_iter = iter(self._meta.fields) if not kwargs: # The ordering of the izip calls matter - izip throws StopIteration # The ordering of the zip calls matter - zip throws StopIteration # when an iter throws it. So if the first iter throws it, the second # is *not* consumed. We rely on this, so don't change the order # without changing the logic. for val, field in izip(args, fields_iter): for val, field in zip(args, fields_iter): setattr(self, field.attname, val) else: # Slower, kwargs-ready version. for val, field in izip(args, fields_iter): for val, field in zip(args, fields_iter): setattr(self, field.attname, val) kwargs.pop(field.name, None) # Maintain compatibility with existing calls. Loading
django/db/models/sql/compiler.py +3 −3 Original line number Diff line number Diff line from itertools import izip from future_builtins import zip from django.core.exceptions import FieldError from django.db import transaction Loading Loading @@ -882,7 +882,7 @@ class SQLInsertCompiler(SQLCompiler): placeholders = [["%s"] * len(fields)] else: placeholders = [ [self.placeholder(field, v) for field, v in izip(fields, val)] [self.placeholder(field, v) for field, v in zip(fields, val)] for val in values ] if self.return_id and self.connection.features.can_return_id_from_insert: Loading @@ -899,7 +899,7 @@ class SQLInsertCompiler(SQLCompiler): else: return [ (" ".join(result + ["VALUES (%s)" % ", ".join(p)]), vals) for p, vals in izip(placeholders, params) for p, vals in zip(placeholders, params) ] def execute_sql(self, return_id=False): Loading