#21226 closed Bug (invalid)

Simple index view test fails with error "'NoneType' object has no attribute 'converter'"

Reported by: heraldhoi@… Owned by: nobody
Component: Testing framework Version: 1.5
Severity: Normal Keywords: mysql automated-tests connector index-view
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Test of index view with no polls mentioned in this tutorial fails with AttributeError: 'NoneType' object has no attribute 'converter'

Complete traceback:

python manage.py test polls
Creating test database for alias 'default'...
.....E....
======================================================================
ERROR: test_index_view_with_no_polls (polls.tests.PollViewTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/radio_py/polls/tests.py", line 54, in test_index_view_with_no_polls
    response = self.client.get( reverse( 'polls:index' ) )
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/test/client.py", line 453, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/test/client.py", line 279, in get
    return self.request(**r)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/test/client.py", line 424, in request
    six.reraise(*exc_info)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/core/handlers/base.py", line 140, in get_response
    response = response.render()
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/response.py", line 82, in rendered_content
    content = template.render(context)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/base.py", line 140, in render
    return self._render(context)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/test/utils.py", line 66, in instrumented_test_render
    return self.nodelist.render(context)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/debug.py", line 74, in render_node
    return node.render(context)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/template/defaulttags.py", line 284, in render
    if match:
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 157, in __nonzero__
    return type(self).__bool__(self)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 151, in __bool__
    next(iter(self))
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 139, in _result_iter
    self._fill_cache()
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 941, in _fill_cache
    self._result_cache.append(next(self._iter))
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 317, in iterator
    for row in compiler.results_iter():
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 830, in execute_sql
    sql, params = self.as_sql()
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 85, in as_sql
    where, w_params = self.query.where.as_sql(qn=qn, connection=self.connection)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/where.py", line 97, in as_sql
    sql, params = child.as_sql(qn=qn, connection=connection)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/where.py", line 100, in as_sql
    sql, params = self.make_atom(child, qn, connection)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/where.py", line 161, in make_atom
    lvalue, params = lvalue.process(lookup_type, params_or_value, connection)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/sql/where.py", line 352, in process
    connection=connection, prepared=True)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 359, in get_db_prep_lookup
    prepared=prepared)]
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 836, in get_db_prep_value
    return connection.ops.value_to_db_datetime(value)
  File "/Users/arthurfayzrakhmanov/Documents/Labour/Python/ENV/lib/python2.7/site-packages/mysql/connector/django/base.py", line 343, in value_to_db_datetime
    return self.connection.connection.converter._datetime_to_mysql(value)
AttributeError: 'NoneType' object has no attribute 'converter'

Python 2.7
Django 1.5.4
MySQL 5.6.13-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
DB Connector mysql_connector_python-1.1.1a1 ('mysql.connector.django')

This error only happen if there is no object creation in test_index_view_with_no_polls, if I add something like

create_poll( question = "Past poll.", days = -30 )

test fails with AssertionError: Couldn't find 'No polls are available.' in response (as expected)

I don't know is this related to connector itself, it's alfa-vesion.

Change History (1)

comment:1 Changed 20 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

As documented: "MySQLdb is the Python interface to MySQL. Version 1.2.1p2 or later is required for full MySQL support in Django."

Perhaps we should support this connector someday, but that's a larger question for the django-developers mailing list.

Note: See TracTickets for help on using tickets.
Back to Top