TypeError: Type str doesn't support the buffer API in modeltests.or_lookups

Issue #40 resolved
Jason Chen created an issue

{{{

!python

====================================================================== FAIL: Doctest: modeltests.or_lookups.models.test.API_TESTS


Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 2222, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for modeltests.or_lookups.models.test.API_TESTS File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line unknown line number, in API_TESTS


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(headlinestartswith='Hello') | Article.objects.filter(headlinestartswith='Goodbye') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[8]>", line 1, in <module> Article.objects.filter(headlinestartswith='Hello') | Article.objects.filter(headlinestartswith='Goodbye') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(headlinestartswith='Hello') | Q(headlinestartswith='Goodbye')) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[9]>", line 1, in <module> Article.objects.filter(Q(headlinestartswith='Hello') | Q(headlinestartswith='Goodbye')) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: articles.filter(headlinestartswith='Hello') & articles.filter(headlinecontains='bye') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[13]>", line 1, in <module> articles.filter(headlinestartswith='Hello') & articles.filter(headlinecontains='bye') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(headlinecontains='bye'), headlinestartswith='Hello') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[14]>", line 1, in <module> Article.objects.filter(Q(headlinecontains='bye'), headlinestartswith='Hello') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(headlinecontains='Hello') | Article.objects.filter(headlinecontains='bye') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[15]>", line 1, in <module> Article.objects.filter(headlinecontains='Hello') | Article.objects.filter(headlinecontains='bye') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(headlineiexact='Hello') | Article.objects.filter(headlinecontains='ood') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[16]>", line 1, in <module> Article.objects.filter(headlineiexact='Hello') | Article.objects.filter(headlinecontains='ood') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(pk=1) | Q(pk=2)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[17]>", line 1, in <module> Article.objects.filter(Q(pk=1) | Q(pk=2)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(pk=1) | Q(pk=2) | Q(pk=3)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[18]>", line 1, in <module> Article.objects.filter(Q(pk=1) | Q(pk=2) | Q(pk=3)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(pkin=[1,2,3]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[19]>", line 1, in <module> Article.objects.filter(pkin=[1,2,3]) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(pkin=(1,2,3)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[20]>", line 1, in <module> Article.objects.filter(pkin=(1,2,3)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(pkin=[1,2,3,4]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[21]>", line 1, in <module> Article.objects.filter(pkin=[1,2,3,4]) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(pkin=[]) | Q(headlineicontains='goodbye')) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[23]>", line 1, in <module> Article.objects.filter(Q(pkin=[]) | Q(headlineicontains='goodbye')) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(headlinestartswith='Hello'), Q(headlinecontains='bye')) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[24]>", line 1, in <module> Article.objects.filter(Q(headlinestartswith='Hello'), Q(headlinecontains='bye')) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(headlinecontains='bye'), headlinestartswith='Hello') Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[25]>", line 1, in <module> Article.objects.filter(Q(headlinecontains='bye'), headlinestartswith='Hello') File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(pk=1) | ~Q(pk=2)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[26]>", line 1, in <module> Article.objects.filter(Q(pk=1) | ~Q(pk=2)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(~Q(pk=1) & ~Q(pk=2)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[27]>", line 1, in <module> Article.objects.filter(~Q(pk=1) & ~Q(pk=2)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(pk=1) & (~Q(pk=2) | Q(pk=3))) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[28]>", line 1, in <module> Article.objects.filter(Q(pk=1) & (~Q(pk=2) | Q(pk=3))) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.get(Q(headlinestartswith='Hello'), Q(headlinecontains='bye')) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[29]>", line 1, in <module> Article.objects.get(Q(headlinestartswith='Hello'), Q(headlinecontains='bye')) File "/usr/local/lib/python3.1/dist-packages/django/db/models/manager.py", line 132, in get return self.get_query_set().get(args, *kwargs) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 334, in get num = len(clone) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 79, in len__ self._result_cache = list(self.iterator()) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.filter(Q(headlinestartswith='Hello')).in_bulk([1,2]) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[33]>", line 1, in <module> Article.objects.filter(Q(headline__startswith='Hello')).in_bulk([1,2]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 408, in in_bulk return dict([(obj._get_pk_val(), obj) for obj in qs.iterator()]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 408, in <listcomp> return dict([(obj._get_pk_val(), obj) for obj in qs.iterator()]) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.exclude(Q(headlinestartswith='Hello')) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[34]>", line 1, in <module> Article.objects.exclude(Q(headlinestartswith='Hello')) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.complex_filter({'pk': 1}) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[35]>", line 1, in <module> Article.objects.complex_filter({'pk': 1}) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API


File "/home/jason/Desktop/workspace/django-3k/build/tests/modeltests/or_lookups/models.py", line ?, in modeltests.or_lookups.models.test.API_TESTS Failed example: Article.objects.complex_filter(Q(pk=1) | Q(pk=2)) Exception raised: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.or_lookups.models.test.API_TESTS[36]>", line 1, in <module> Article.objects.complex_filter(Q(pk=1) | Q(pk=2)) File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1278, in py3_displayhook if not value: File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 110, in bool__ next(iter(self)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 104, in _result_iter self._fill_cache() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 755, in _fill_cache self._result_cache.append(next(self._iter)) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 267, in iterator for row in compiler.results_iter(): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 678, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/compiler.py", line 733, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/sqlite3/base.py", line 198, in execute return Database.Cursor.execute(self, query, params) File "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py", line 73, in typecast_timestamp if not ' ' in s: return typecast_date(s) TypeError: Type str doesn't support the buffer API

}}}

This is a separate issue from Andrew's ticket #39

Comments (2)

  1. Jason Chen reporter
    The error occurs in "/usr/local/lib/python3.1/dist-packages/django/db/backends/util.py"
    
    def typecast_timestamp(s): # does NOT store time zone information
        # "2005-07-29 15:48:00.590358-05"
        # "2005-07-29 09:56:00-05"
        if not s: return None
        # XXX should the database pass in Unicode here already?
        #s = s.decode("ascii")
    
        if not ' ' in s: return typecast_date(s)
    

    Strangely, Dave's issue #5 commented out #s = s.decode("ascii") and fixed the OperationalError in modeltests.basic, but introduced this error that "Type str doesn't support the buffer API". Undoing ticket #5 fixes this TypeError, but also reintroduces OperationalError back into the mix.

  2. Log in to comment