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

Registrant list: Error if accomodation display is selected and a no-accomodation registration exists #3272

Closed
bpedersen2 opened this Issue Mar 20, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@bpedersen2
Contributor

bpedersen2 commented Mar 20, 2018

Patch coming...
Traceback:

Traceback (most recent call last):
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/flask/util.py", line 114, in wrapper
    return obj().process()
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/rh.py", line 270, in process
    res = self._do_process()
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/rh.py", line 249, in _do_process
    return self._process()
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/registration/controllers/management/reglists.py", line 90, in _process
    has_badges=has_badges, has_tickets=has_tickets, **reg_list_kwargs)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/views.py", line 123, in render_template
    return cls(g.rh, *wp_args, **context).display()
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/views.py", line 231, in display
    body = to_unicode(self._display(params))
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/views.py", line 261, in _display
    return self._applyDecoration(self._getBody(params))
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/management/views.py", line 74, in _getBody
    return self._getPageContent(params)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/views.py", line 150, in _getPageContent
    return self.render_template_func(template, **params)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/registration/templates/management/regform_reglist.html", line 2, in top-level template code
    {% from 'events/registration/management/_reglist.html' import render_registration_list %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/management/templates/full_width_base.html", line 2, in top-level template code
    {% extends 'events/management/base.html' %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/management/templates/base.html", line 3, in top-level template code
    {% from 'message_box.html' import message_box %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/templates/layout/management_page.html", line 4, in top-level template code
    {% set show_banner_area = self.display_view_button() or self.banner_title() or self.banner_actions() %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/templates/layout/base.html", line 1, in top-level template code
    {% block page %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/management/templates/full_width_base.html", line 6, in block "page"
    {{ super() }}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/management/templates/base.html", line 49, in block "page"
    {{ super() }}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/templates/layout/management_page.html", line 39, in block "page"
    {{ super() }}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/web/templates/layout/base.html", line 47, in block "page"
    {% block content %}{% endblock %}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/registration/templates/management/regform_reglist.html", line 213, in block "content"
    {{ render_registration_list(regform, registrations, dynamic_columns, static_columns, total_registrations) }}
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/jinja2/runtime.py", line 553, in _invoke
    rv = self._func(*arguments)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/modules/events/registration/templates/management/_reglist.html", line 93, in template
    {% trans nights=data[item.id].friendly_data.nights,
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/jinja2/ext.py", line 149, in ngettext
    rv = __context.call(func, __singular, __plural, __num)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/util/i18n.py", line 112, in _wrap
    **kwargs)
  File "/usr/home/indicoadm/indicov2/.indicov2/lib/python2.7/site-packages/indico/util/i18n.py", line 77, in gettext_unicode
    res = getattr(translations, func_name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/gettext.py", line 485, in ungettext
    tmsg = self._catalog[(msgid1, self.plural(n))]
  File "<string>", line 4, in func
  File "/usr/local/lib/python2.7/gettext.py", line 163, in _as_int
    i = round(n)
UndefinedError: 'dict object' has no attribute 'nights'

bpedersen2 added a commit to bpedersen2/indico that referenced this issue Mar 20, 2018

Fix listing of accomodations in registrant listing indico#3272
As the templates assume nights to  always be set, add a default
value for the no_accomodation case as well.
@ThiefMaster

This comment has been minimized.

Member

ThiefMaster commented Mar 20, 2018

You are right, it doesn't. But Jinja is smart enough to do an item lookup in this case (and vice versa) so you can always use the dot notation no matter if it's something with items or attributes.

So it's strange you are getting this error...

@ThiefMaster

This comment has been minimized.

Member

ThiefMaster commented Mar 20, 2018

nevermind. just saw your PR, if the attributes don't exist as items either it makes sense that it breaks ;)

bpedersen2 added a commit to bpedersen2/indico that referenced this issue Mar 20, 2018

Fix listing of accomodations in registrant listing indico#3272
As the templates assume nights to  always be set, add a default
value for the no_accomodation case as well.

bpedersen2 added a commit to bpedersen2/indico that referenced this issue Mar 20, 2018

Fix listing of accomodations in registrant listing indico#3272
As the templates assume nights to  always be set, add a default
value for the no_accomodation case as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment