Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'ret_query' referenced before assignment #909

Closed
ukanga opened this issue Feb 9, 2017 · 0 comments
Closed

Comments

@ukanga
Copy link
Member

ukanga commented Feb 9, 2017

Internal Server Error: /api/v1/forms/[pk]/export_async.json

UnboundLocalError at /api/v1/forms/[pk]/export_async.json
local variable 'ret_query' referenced before assignment

Request Method: GET
Request URL: https://api.ona.io/api/v1/forms/[pk]/export_async.json?format=csv&query=%7B%22_submission_time%22%3A%20%7B%22%24gte%22%3A%20%222017-01-01T00%3A00%3A00%22%2C%22%24lte%22%3A%20%222017-01-31T23%3A59%3A59%22%7D%7D&win_excel_utf8=false
Django Version: 1.9.5
Python Executable: /..../.virtualenvs/onadata/bin/uwsgi
Python Version: 2.7.6
Python Path: ['/..../.virtualenvs/onadata/src/savreaderwriter/savReaderWriter', '/..../.virtualenvs/onadata/src/savreaderwriter/savReaderWriter/cWriterow', '.', '', '/..../.virtualenvs/onadata/src/django-nose', '/..../.virtualenvs/onadata/src/django-digest', '/..../.virtualenvs/onadata/src/j2xclient', '/..../.virtualenvs/onadata/src/cors-headers', '/..../.virtualenvs/onadata/src/pricing', '/..../.virtualenvs/onadata/src/savreaderwriter', '/..../.virtualenvs/onadata/src/google-export', '/..../.virtualenvs/onadata/lib/python2.7', '/..../.virtualenvs/onadata/lib/python2.7/plat-x86_64-linux-gnu', '/..../.virtualenvs/onadata/lib/python2.7/lib-tk', '/..../.virtualenvs/onadata/lib/python2.7/lib-old', '/..../.virtualenvs/onadata/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/..../.virtualenvs/onadata/local/lib/python2.7/site-packages']
Server time: Tue, 7 Feb 2017 11:38:27 -0500
Installed Applications:
('google_export',
 'pricing',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'django.contrib.gis',
 'registration',
 'django_nose',
 'django_digest',
 'corsheaders',
 'oauth2_provider',
 'rest_framework',
 'rest_framework.authtoken',
 'taggit',
 'readonly',
 'onadata.apps.logger',
 'onadata.apps.viewer',
 'onadata.apps.main',
 'onadata.apps.restservice',
 'onadata.apps.api',
 'guardian',
 'djcelery',
 'onadata.apps.sms_support',
 'onadata.libs',
 'reversion')
Installed Middleware:
('multidb.middleware.PinningRouterMiddleware',
 'onadata.libs.profiling.sql.SqlTimingMiddleware',
 'django.middleware.http.ConditionalGetMiddleware',
 'django.middleware.cache.UpdateCacheMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'onadata.libs.utils.middleware.LocaleMiddlewareWithTweaks',
 'django.middleware.csrf.CsrfViewMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'onadata.libs.utils.middleware.HTTPResponseNotAllowedMiddleware',
 'readonly.middleware.DatabaseReadOnlyMiddleware')


Traceback:

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
  87.             return self.dispatch(request, *args, **kwargs)

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  466.             response = self.handle_exception(exc)

File "/..../.virtualenvs/onadata/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  463.             response = handler(request, *args, **kwargs)

File "./onadata/apps/api/viewsets/xform_viewset.py" in export_async
  637.             resp = process_async_export(request, xform, export_type, options)

File "./onadata/libs/utils/api_export_tools.py" in process_async_export
  376.                                                      query)

File "./onadata/libs/permissions.py" in filter_queryset_xform_meta_perms_sql
  399.     return ret_query

Exception Type: UnboundLocalError at /api/v1/forms/[pk]/export_async.json
Exception Value: local variable 'ret_query' referenced before assignment
Request information:
GET:
query = u'{"_submission_time": {"$gte": "2017-01-01T00:00:00","$lte": "2017-01-31T23:59:59"}}'
win_excel_utf8 = u'false'
format = u'csv'

POST: No POST data

FILES: No FILES data

COOKIES: No cookie data

Aha! Link: https://ona.aha.io/features/PROD-628

@denniswambua denniswambua modified the milestones: Week 8, Week 10 Feb 13, 2017
@denniswambua denniswambua modified the milestones: Week 10, Week 12 Feb 27, 2017
@ukanga ukanga closed this as completed in 2867292 Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants