Ticket #27397: Overflow_handel.diff

File Overflow_handel.diff, 1.9 KB (added by Ramin Farajpour Cami, 8 years ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index 499d27d..58049ed 100644
    a b class ModelAdmin(BaseModelAdmin):  
    668668        try:
    669669            object_id = field.to_python(object_id)
    670670            return queryset.get(**{field.name: object_id})
    671         except (model.DoesNotExist, ValidationError, ValueError):
     671        except (model.DoesNotExist, ValidationError, ValueError, OverflowError):
    672672            return None
    673673
    674674    def get_changelist_form(self, request, **kwargs):
  • django/db/backends/sqlite3/base.py

    diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
    index 66ad278..36c1351 100644
    a b class SQLiteCursorWrapper(Database.Cursor):  
    325325        if params is None:
    326326            return Database.Cursor.execute(self, query)
    327327        query = self.convert_query(query)
    328         return Database.Cursor.execute(self, query, params)
    329 
     328        try:
     329            return Database.Cursor.execute(self, query, params)
     330        except OverflowError:
     331            return None
     332           
    330333    def executemany(self, query, param_list):
    331334        query = self.convert_query(query)
    332335        return Database.Cursor.executemany(self, query, param_list)
  • django/db/backends/sqlite3/operations.py

    diff --git a/django/db/backends/sqlite3/operations.py b/django/db/backends/sqlite3/operations.py
    index 47a26b5..6404ea6 100644
    a b class DatabaseOperations(BaseDatabaseOperations):  
    122122        # Native sqlite3 cursors cannot be used as context managers.
    123123        try:
    124124            return cursor.execute(sql, params).fetchone()
     125        except OverflowError:
     126            return None   
    125127        finally:
    126128            cursor.close()
    127129
Back to Top