google-code-export / django-pyodbc

Automatically exported from code.google.com/p/django-pyodbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Backend isn't handling order_with_respect_to model Meta option #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a setting file that specify usage of the backed for DATABASE_ENGINE
2. Run the order_with_respect_to model tests from the Django test suite

What is the expected output? What do you see instead?

Expected: Tests pass

Actual results:

======================================================================
FAIL: Doctest: modeltests.order_with_respect_to.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "~/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
modeltests.order_with_respect_to.models.__test__.API_TESTS
  File "~/tests/modeltests/order_with_respect_to/models.py", line unknown
line number, in API_TESTS

----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    q1.answer_set.all()
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[10]>", line 1,
in <module>
        q1.answer_set.all()
      File "~/django/db/models/query.py", line 148, in __repr__
        data = list(self[:REPR_OUTPUT_SIZE + 1])
      File "~/django/db/models/query.py", line 163, in __len__
        self._result_cache.extend(list(self._iter))
        for row in self.query.results_iter():
      File "~/django/db/models/sql/query.py", line 238, in results_iter
        for rows in self.execute_sql(MULTI):
      File "~/django/db/models/sql/query.py", line 1934, in execute_sql
        cursor.execute(sql, params)
      File "~/django-pyodbc/trunk/sql_server/pyodbc/base.py", line 221, in
execute
        return self.cursor.execute(sql, params)
    ProgrammingError: ('42S22', "[42S22] [FreeTDS][SQL Server]Invalid
column name '_order'. (207) (SQLPrepare)")
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a1
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[12]>", line 1,
in <module>
        a1
    NameError: name 'a1' is not defined
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a2 = a1.get_next_in_order()
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[13]>", line 1,
in <module>
        a2 = a1.get_next_in_order()
    NameError: name 'a1' is not defined
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a2
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[14]>", line 1,
in <module>
        a2
    NameError: name 'a2' is not defined
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a4.get_previous_in_order()
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[17]>", line 1,
in <module>
        a4.get_previous_in_order()
      File "~/django/utils/functional.py", line 55, in _curried
        return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
      File "~/django/db/models/base.py", line 497, in
_get_next_or_previous_in_order
        obj = self._default_manager.filter(**{order_field.name:
getattr(self, order_field.attname)}).extra(where=where,
params=params).order_by(order)[:1].get()
      File "~/django/db/models/query.py", line 334, in get
        num = len(clone)
      File "~/django/db/models/query.py", line 161, in __len__
        self._result_cache = list(self.iterator())
      File "~/django/db/models/query.py", line 281, in iterator
        for row in self.query.results_iter():
      File "~/django/db/models/sql/query.py", line 238, in results_iter
        for rows in self.execute_sql(MULTI):
      File "~/django/db/models/sql/query.py", line 1934, in execute_sql
        cursor.execute(sql, params)
      File "~/django-pyodbc/trunk/sql_server/pyodbc/base.py", line 221, in
execute
        return self.cursor.execute(sql, params)
    ProgrammingError: ('42S22', "[42S22] [FreeTDS][SQL Server]Invalid
column name '_order'. (207) (SQLPrepare)")
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a2.question.get_answer_order() == id_list
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[19]>", line 1,
in <module>
        a2.question.get_answer_order() == id_list
    NameError: name 'a2' is not defined
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    a2.question.get_answer_order() == a5.question.get_answer_order()
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[22]>", line 1,
in <module>
        a2.question.get_answer_order() == a5.question.get_answer_order()
    NameError: name 'a2' is not defined
----------------------------------------------------------------------
File "~/tests/modeltests/order_with_respect_to/models.py", line ?, in
modeltests.order_with_respect_to.models.__test__.API_TESTS
Failed example:
    q1.answer_set.all()
Exception raised:
    Traceback (most recent call last):
      File "~/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest
modeltests.order_with_respect_to.models.__test__.API_TESTS[28]>", line 1,
in <module>
        q1.answer_set.all()
      File "~/django/db/models/query.py", line 148, in __repr__
        data = list(self[:REPR_OUTPUT_SIZE + 1])
      File "~/django/db/models/query.py", line 163, in __len__
        self._result_cache.extend(list(self._iter))
      File "~/django/db/models/query.py", line 281, in iterator
        for row in self.query.results_iter():
      File "~/django/db/models/sql/query.py", line 238, in results_iter
        for rows in self.execute_sql(MULTI):
      File "~/django/db/models/sql/query.py", line 1934, in execute_sql
        cursor.execute(sql, params)
      File "~/django-pyodbc/trunk/sql_server/pyodbc/base.py", line 221, in
execute
        return self.cursor.execute(sql, params)
    ProgrammingError: ('42S22', "[42S22] [FreeTDS][SQL Server]Invalid
column name '_order'. (207) (SQLPrepare)")

----------------------------------------------------------------------
Ran 1 test in 0.269s

FAILED (failures=1)

Note: This is against SQL Server 2000, will update the issue when I can
test against another SQL Server version.

Original issue reported on code.google.com by cra...@gmail.com on 18 Jan 2009 at 3:20

GoogleCodeExporter commented 9 years ago
Fixed in r135.

Original comment by cra...@gmail.com on 24 Jan 2009 at 5:05