'NoneType' object has no attribute 'id' when using Tickets

Hi,

its me again…

I’m trying to setup Tickts for a Test-Lecture, but everytime I click on the “Configure” Button, Indico just throws an error saying the following:

2018-06-26 16:59:26,821  471c544019834633  indico.flask - ERROR errors.py:107 -- 'NoneType' object has no attribute 'id'

Traceback (most recent call last):
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/flask/util.py", line 114, in wrapper
    return obj().process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 289, in process
    res = self._do_process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 259, in _do_process
    rv = self._process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/modules/events/registration/controllers/management/tickets.py", line 56, in _process
    form = TicketsForm(obj=self.regform, event=self.event)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/forms/base.py", line 71, in __call__
    return super(IndicoFormMeta, cls).__call__(*args, **kwargs)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/wtforms/form.py", line 212, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/modules/events/registration/forms.py", line 288, in __init__
    badge_templates.insert(0, (default_tpl.id, '{} ({})'.format(default_tpl.title, _('Default category template'))))
AttributeError: 'NoneType' object has no attribute 'id'

{u'data': {u'get': {'_': u'1530025165442'},
           u'headers': {'Accept': u'*/*',
                        'Accept-Encoding': u'gzip, deflate, br',
                        'Accept-Language': u'en-GB,en;q=0.5',
                        'Connection': u'keep-alive',
                        'Cookie': u'skin=Bluberry; token=17h56xLm3eb8YjGxCPqNr-11CwndbiZBPK6pM8NR9J7zDxuMhW89bcDFNNXgaHcJ7tXUyeUkTay; preferredView=TABLE; indico_session=c8a211e2-1285-4e7a-b796-9d7ce57a28b6',
                        'Host': u'indico.fhi-berlin.mpg.de',
                        'Referer': u'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/',
                        'User-Agent': u'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
                        'X-Csrf-Token': u'62764777-cd62-4bc8-b157-be2e7da6917a',
                        'X-Requested-With': u'XMLHttpRequest'},
           u'json': None,
           u'post': {},
           u'url': {'confId': u'34', 'reg_form_id': 20}},
 u'endpoint': u'event_registration.tickets',
 u'id': '471c544019834633',
 u'ip': '141.14.138.81',
 u'method': 'GET',
 u'referrer': 'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/',
 u'rh': 'RHRegistrationFormTickets',
 u'time': '2018-06-26T16:59:26.833052',
 u'url': u'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/tickets?_=1530025165442',
 u'user': {u'email': u'kirstaedter@fhi-berlin.mpg.de',
           u'id': 130,
           u'name': u'William Kirstaedter'},
 u'user_agent': u'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'}

I think that my installation lacks some default template, but I’m not really able to trace down where or what I am missing…
may I ask for assistance again?

thank you in advance,
William from FHI

That sounds like there is no “default ticket template” defined at all. This shouldn’t be possible though, since we create the default ticket template during setup when also creating the tables, root category, etc.

Can you check if there is a “Default ticket” template here? https://indico.fhi-berlin.mpg.de/category/0/manage/designer/

1 Like

seems to bee missing :frowning:
can i copy the default template from github repository into my installation?
if yes, where shall it go and where can i find it?

ty,
William

Run this in indico shell:

from indico.modules.designer import TemplateType
from indico.core.db.sqlalchemy.util.management import DEFAULT_TEMPLATE_DATA
root = Category.get_root()
root.default_ticket_template = DesignerTemplate(category_id=root.id, title='Default ticket', type=TemplateType.badge, data=DEFAULT_TEMPLATE_DATA, is_system_template=True)
db.session.commit()
1 Like

nice, now there’s a template.
but it still generates errors when clicking on the QR-Code button…

2018-06-26 17:28:40,145  b61284eedd024d84  indico.flask - ERROR errors.py:107 -- No row was found for one()

Traceback (most recent call last):
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/flask/util.py", line 114, in wrapper
    return obj().process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 289, in process
    res = self._do_process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/web/rh.py", line 259, in _do_process
    rv = self._process()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/modules/events/registration/controllers/management/tickets.py", line 96, in _process
    checkin_app = OAuthApplication.find_one(system_app_type=SystemAppType.checkin)
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/indico/core/db/sqlalchemy/util/models.py", line 110, in find_one
    return cls.find(*args, **kwargs).one()
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2890, in one
    raise orm_exc.NoResultFound("No row was found for one()")
NoResultFound: No row was found for one()

{u'data': {u'get': {},
           u'headers': {'Accept': u'*/*',
                        'Accept-Encoding': u'gzip, deflate, br',
                        'Accept-Language': u'en-GB,en;q=0.5',
                        'Connection': u'keep-alive',
                        'Cookie': u'skin=Bluberry; token=17h56xLm3eb8YjGxCPqNr-11CwndbiZBPK6pM8NR9J7zDxuMhW89bcDFNNXgaHcJ7tXUyeUkTay; preferredView=TABLE; indico_session=c8a211e2-1285-4e7a-b796-9d7ce57a28b6',
                        'Host': u'indico.fhi-berlin.mpg.de',
                        'Referer': u'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/',
                        'User-Agent': u'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'},
           u'json': None,
           u'post': {},
           u'url': {'confId': u'34', 'reg_form_id': 20}},
 u'endpoint': u'event_registration.tickets_qrcode_image',
 u'id': 'b61284eedd024d84',
 u'ip': '141.14.138.81',
 u'method': 'GET',
 u'referrer': 'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/',
 u'rh': 'RHTicketConfigQRCodeImage',
 u'time': '2018-06-26T17:28:40.151676',
 u'url': u'https://indico.fhi-berlin.mpg.de/event/34/manage/registration/20/tickets/qrcode.png',
 u'user': {u'email': u'kirstaedter@fhi-berlin.mpg.de',
           u'id': 130,
           u'name': u'William Kirstaedter'},
 u'user_agent': u'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'}

Is this a migrated database or a fresh setup? This looks like half of the database setup logic didn’t run…

from indico.modules.oauth.models.applications import OAuthApplication, SystemAppType
for sat in SystemAppType:
    if sat != SystemAppType.none:
        db.session.add(OAuthApplication(system_app_type=sat, **sat.default_data))
db.session.commit()
1 Like

very nice, straight forward answers!

tickets are working now.

the only thing left is a “test” template which I created and then deleted afterwards: it now remains selectable in the event registration config, but cant be seen or accessed in the badge / poster menu of my main and sub category.

can I delete “test” via the shell as well?

and, my I send you some cookies for your support? :wink:

If there’s a template, it’s either defined in the event, or one of the parent categories - go up the chain and you should find it. You can delete it there. While deleting it via the shell would work, it’s better to do things the right way whenever possible :wink:

1 Like