Custom Reports problem

Hi,

I have some problem with custom reports: When I want render report, I
got an error 500 instead, and in django console, I got following stacktrace:

Traceback (most recent call last):
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/core/handlers/base.py",
line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/views/generic/base.py",
line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line
235, in dispatch
return self.dispatch_with_priv(request, *args, **kwargs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/utils/decorators.py",
line 25, in _wrapper
return bound_func(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/accounting/decorators.py”, line
68, in wrapped
request, *args, **kwargs
File
"/home/luki/commcare/submodules/django-prbac-src/django_prbac/decorators.py",
line 21, in wrapped
return fn(request, *args, **kwargs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/utils/decorators.py",
line 21, in bound_func
return func(self, *args2, **kwargs2)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line
242, in dispatch_with_priv
return super(CustomProjectReportDispatcher, self).dispatch(request,
*args, **kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line
148, in outer
return additional_decorator(inner)(request, domain, *args,
**new_kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line 78,
in _inner
return view_func(req, domain_name, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line
145, in inner
return func(cls, request, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line
220, in dispatch
return super(ProjectReportDispatcher, self).dispatch(request,
*args, **kwargs)
File
"/home/luki/commcare/submodules/dimagi-utils-src/dimagi/utils/decorators/datespan.py",
line 44, in wrapped_func
return f(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line
135, in dispatch
return getattr(report, ‘%s_response’ % render_as)
File “/home/luki/commcare/corehq/apps/reports/cache.py”, line 84, in
decorated
return fn(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/generic.py”, line 548,
in async_response
return HttpResponse(json.dumps(self._async_context()),
content_type=‘application/json’)
File “/home/luki/commcare/corehq/apps/reports/generic.py”, line 561,
in _async_context
context_instance=RequestContext(self.request)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader.py",
line 177, in render_to_string
return t.render(context_instance)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 140, in render
return self._render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 134, in _render
return self.nodelist.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 830, in render
bit = self.render_node(node, context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/debug.py",
line 74, in render_node
return node.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader_tags.py",
line 124, in render
return compiled_parent._render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 134, in _render
return self.nodelist.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 830, in render
bit = self.render_node(node, context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/debug.py",
line 74, in render_node
return node.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader_tags.py",
line 124, in render
return compiled_parent._render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 134, in _render
return self.nodelist.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 830, in render
bit = self.render_node(node, context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/debug.py",
line 74, in render_node
return node.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader_tags.py",
line 63, in render
result = block.nodelist.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 830, in render
bit = self.render_node(node, context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/debug.py",
line 74, in render_node
return node.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader_tags.py",
line 63, in render
result = block.nodelist.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/base.py",
line 830, in render
bit = self.render_node(node, context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/debug.py",
line 74, in render_node
return node.render(context)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader_tags.py",
line 166, in render
template = get_template(template_name)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader.py",
line 146, in get_template
template, origin = find_template(template_name)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader.py",
line 135, in find_template
source, display_name = loader(name, dirs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader.py",
line 43, in call
return self.load_template(template_name, template_dirs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loader.py",
line 46, in load_template
source, display_name = self.load_template_source(template_name,
template_dirs)
File
"/home/luki/.virtualenvs/commcare-hq/local/lib/python2.7/site-packages/django/template/loaders/eggs.py",
line 24, in load_template_source
pkg_name = ‘templates/’ + template_name
TypeError: coercing to Unicode: need string or buffer, NoneType found

Do you have any ideas what could be cause of this problem?

Regards,
Łukasz

Are you able to drop into a debugger and inspect the variables around
there?

··· On Wed, May 28, 2014 at 7:08 AM, Łukasz Wyszomirski < lwyszomirski@soldevelo.com> wrote:

Hi,

I have some problem with custom reports: When I want render report, I got
an error 500 instead, and in django console, I got following stacktrace:

Traceback (most recent call last):
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/core/handlers/base.py”, line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/views/generic/base.py”, line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line 235,
in dispatch
return self.dispatch_with_priv(request, *args, **kwargs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/utils/decorators.py”, line 25, in _wrapper
return bound_func(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/accounting/decorators.py”, line
68, in wrapped
request, *args, **kwargs
File “/home/luki/commcare/submodules/django-prbac-src/django_prbac/decorators.py”,
line 21, in wrapped
return fn(request, *args, **kwargs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/utils/decorators.py”, line 21, in bound_func
return func(self, *args2, **kwargs2)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line 242,
in dispatch_with_priv
return super(CustomProjectReportDispatcher, self).dispatch(request,
*args, **kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line 148,
in outer
return additional_decorator(inner)(request, domain, *args,
**new_kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line 78,
in _inner
return view_func(req, domain_name, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/domain/decorators.py”, line 145,
in inner
return func(cls, request, *args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line 220,
in dispatch
return super(ProjectReportDispatcher, self).dispatch(request, *args,
**kwargs)
File “/home/luki/commcare/submodules/dimagi-utils-src/
dimagi/utils/decorators/datespan.py”, line 44, in wrapped_func
return f(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/dispatcher.py”, line 135,
in dispatch
return getattr(report, ‘%s_response’ % render_as)
File “/home/luki/commcare/corehq/apps/reports/cache.py”, line 84, in
decorated
return fn(*args, **kwargs)
File “/home/luki/commcare/corehq/apps/reports/generic.py”, line 548, in
async_response
return HttpResponse(json.dumps(self._async_context()),
content_type=‘application/json’)
File “/home/luki/commcare/corehq/apps/reports/generic.py”, line 561, in
_async_context
context_instance=RequestContext(self.request)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader.py”, line 177, in render_to_string
return t.render(context_instance)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 140, in render
return self._render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 134, in _render
return self.nodelist.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 830, in render
bit = self.render_node(node, context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/debug.py”, line 74, in render_node
return node.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader_tags.py”, line 124, in render
return compiled_parent._render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 134, in _render
return self.nodelist.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 830, in render
bit = self.render_node(node, context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/debug.py”, line 74, in render_node
return node.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader_tags.py”, line 124, in render
return compiled_parent._render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 134, in _render
return self.nodelist.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 830, in render
bit = self.render_node(node, context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/debug.py”, line 74, in render_node
return node.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader_tags.py”, line 63, in render
result = block.nodelist.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 830, in render
bit = self.render_node(node, context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/debug.py”, line 74, in render_node
return node.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader_tags.py”, line 63, in render
result = block.nodelist.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/base.py”, line 830, in render
bit = self.render_node(node, context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/debug.py”, line 74, in render_node
return node.render(context)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader_tags.py”, line 166, in render
template = get_template(template_name)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader.py”, line 146, in get_template
template, origin = find_template(template_name)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader.py”, line 135, in find_template
source, display_name = loader(name, dirs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader.py”, line 43, in call
return self.load_template(template_name, template_dirs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loader.py”, line 46, in load_template
source, display_name = self.load_template_source(template_name,
template_dirs)
File “/home/luki/.virtualenvs/commcare-hq/local/lib/python2.
7/site-packages/django/template/loaders/eggs.py”, line 24, in
load_template_source
pkg_name = ‘templates/’ + template_name
TypeError: coercing to Unicode: need string or buffer, NoneType found

Do you have any ideas what could be cause of this problem?

Regards,
Łukasz

— You received this message because you are subscribed to the Google
Groups “CommCare Developers” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.