Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24661 closed Bug (needsinfo)

lookup_cast() takes 2 positional arguments but 3 were given

Reported by: Yusuf (Josè) Luis Owned by: nobody
Component: Internationalization Version: 1.8
Severity: Normal Keywords: lookup
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Good nights guys.

I have the next error when i run the server and i try see my page in the browser, and when i try use migra --fake-initial or other command too.

Environment:
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.8
Python Version: 3.4.0
Installed Applications:
('suit',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'ckeditor',
'django_extensions',
'embed_video',
'haystack',
'import_export',
'pipeline',
'permission',
'robots',
'smart_selects',
'sorl.thumbnail',
'taggit',
'authors',
'docs',
'news',
'tags',
'visuals')
Installed Middleware:
('django.middleware.cache.UpdateCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'pipeline.middleware.MinifyHTMLMiddleware')
Traceback:
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
108. response = middleware_method(request)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/middleware/locale.py" in process_request
32. request, check_path=check_path)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/utils/translation/__init__.py" in get_language_from_request
189. return _trans.get_language_from_request(request, check_path)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/utils/translation/trans_real.py" in get_language_from_request
496. lang_code = request.session.get(LANGUAGE_SESSION_KEY)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/contrib/sessions/backends/base.py" in get
59. return self._session.get(key, default)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/contrib/sessions/backends/base.py" in _get_session
181. self._session_cache = self.load()
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/contrib/sessions/backends/db.py" in load
21. expire_date__gt=timezone.now()
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/manager.py" in manager_method
127. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/query.py" in get
328. num = len(clone)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/query.py" in __len__
144. self._fetch_all()
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/query.py" in _fetch_all
965. self._result_cache = list(self.iterator())
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/query.py" in iterator
238. results = compiler.execute_sql()
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in execute_sql
818. sql, params = self.as_sql()
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in as_sql
376. where, w_params = self.compile(self.query.where)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in compile
346. sql, params = node.as_sql(self, self.connection)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/sql/where.py" in as_sql
104. sql, params = compiler.compile(child)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in compile
346. sql, params = node.as_sql(self, self.connection)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/lookups.py" in as_sql
205. lhs_sql, params = self.process_lhs(compiler, connection)
File "/home/tulipan/Proyectos/IspanyolHaber/lib/python3.4/site-packages/django/db/models/lookups.py" in process_lhs
201. lhs_sql = connection.ops.lookup_cast(self.lookup_name, field_internal_type) % lhs_sql
Exception Type: TypeError at /
Exception Value: lookup_cast() takes 2 positional arguments but 3 were given

I don't know what's happen here, can you help me?

Change History (5)

comment:1 by Tim Graham, 9 years ago

Resolution: needsinfo
Status: newclosed

It's difficult to say what the problem is without further details. Please see TicketClosingReasons/UseSupportChannels and reopen if you determine this to be a bug in Django.

comment:2 by Claude Paroz, 9 years ago

I guess you are using a custom database backend module which has not been updated for Django 1.8.

comment:3 by Yusuf (Josè) Luis, 9 years ago

No, my database backend is the of ever:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
}
}

comment:4 by Claude Paroz, 9 years ago

Then it's probably one of your third party application. You could try to grep for "def lookup_cast" in the code of all external apps to find the culprit.

comment:5 by Shai Berger, 9 years ago

lookup_cast() had 2 positional arguments in 1.7, but grew a third in 1.8. Is it possible that you have some old __pycache__ lying around, or some other weirdness that causes the versions to mix?

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