Commit 48e01d2b authored by Karen Tracey's avatar Karen Tracey
Browse files

Fixed up the introspection code and tests added for #9779 to run under Python...

Fixed up the introspection code and tests added for #9779 to run under Python 2.3, which has neither set nor rsplit.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10392 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent bb31cf37
Loading
Loading
Loading
Loading
+36 −36
Original line number Diff line number Diff line
@@ -67,8 +67,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
        # Schema for this table
        cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s", [table_name])
        results = cursor.fetchone()[0].strip()
        results = results.split('(', 1)[1] 
        results = results.rsplit(')', 1)[0] 
        results = results[results.index('(')+1:results.rindex(')')]

        # Walk through and look for references to other tables. SQLite doesn't
        # really have enforced references, but since it echoes out the SQL used
@@ -89,8 +88,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
            if not result:
                continue
            other_table_results = result[0].strip()
            other_table_results = other_table_results.split('(', 1)[1] 
            other_table_results = other_table_results.rsplit(')', 1)[0] 
            li, ri = other_table_results.index('('), other_table_results.rindex(')')
            other_table_results = other_table_results[li+1:ri]


            for other_index, other_desc in enumerate(other_table_results.split(',')):
                other_desc = other_desc.strip()
+20 −15
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@ from django.utils import functional

from models import Reporter, Article

try:
    set
except NameError:
    from sets import Set as set     # Python 2.3 fallback

#
# The introspection module is optional, so methods tested here might raise
# NotImplementedError. This is perfectly acceptable behavior for the backend