Ticket #13396: django-pypy.diff

File django-pypy.diff, 2.0 KB (added by Alex Gaynor, 14 years ago)
  • django/db/backends/sqlite3/introspection.py

    diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py
    index ce64908..c243e58 100644
    a b class DatabaseIntrospection(BaseDatabaseIntrospection):  
    6666        relations = {}
    6767
    6868        # Schema for this table
    69         cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s", [table_name])
     69        cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s", [table_name, "table"])
    7070        results = cursor.fetchone()[0].strip()
    7171        results = results[results.index('(')+1:results.rindex(')')]
    7272
  • tests/regressiontests/introspection/tests.py

    diff --git a/tests/regressiontests/introspection/tests.py b/tests/regressiontests/introspection/tests.py
    index 1025029..2a81aa8 100644
    a b from django.utils import functional  
    55
    66from models import Reporter, Article
    77
    8 try:
    9     set
    10 except NameError:
    11     from sets import Set as set     # Python 2.3 fallback
    12 
    138#
    149# The introspection module is optional, so methods tested here might raise
    1510# NotImplementedError. This is perfectly acceptable behavior for the backend
    class IntrospectionTests(TestCase):  
    7671    def test_get_table_description_types(self):
    7772        cursor = connection.cursor()
    7873        desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table)
    79         self.assertEqual([datatype(r[1], r) for r in desc],
    80                           ['IntegerField', 'CharField', 'CharField', 'CharField', 'BigIntegerField'])
     74        self.assertEqual(
     75            [datatype(r[1], r) for r in desc],
     76            ['IntegerField', 'CharField', 'CharField', 'CharField', 'BigIntegerField']
     77        )
    8178
    8279    # Regression test for #9991 - 'real' types in postgres
    8380    if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].startswith('django.db.backends.postgresql'):
Back to Top