QR Code missing when using Tickets

Hi to everyone,
I’m trying to setup Tickets/QR Code for events but when I click on QR Code Button under Registration / Tickets nothing appears.

When I press QR Code button in indico.log I see this error:

2019-01-30 14:58:04,651  INFO     6b00ea3a651048fa  indico.rh                 GET /event/155/manage/registration/46/tickets/qrcode?_=1548855305610 [IP=] [PID=31255] [UID=0]
2019-01-30 14:58:04,682  INFO     01906691dcf44fbe  indico.rh                 GET /event/155/manage/registration/46/tickets/qrcode.png [IP=] [PID=15057] [UID=0]
2019-01-30 14:58:04,697  ERROR    01906691dcf44fbe  indico.flask              No row was found for one()
Traceback (most recent call last):
  File "/opt/indico/.venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/indico/.venv/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/lib/python2.7/site-packages/indico/web/flask/util.py", line 114, in wrapper
    return obj().process()
  File "/opt/indico/.venv/lib/python2.7/site-packages/indico/web/rh.py", line 289, in process
    res = self._do_process()
  File "/opt/indico/.venv/lib/python2.7/site-packages/indico/web/rh.py", line 259, in _do_process
    rv = self._process()
  File "/opt/indico/.venv/lib/python2.7/site-packages/indico/modules/events/registration/controllers/management/tickets.py", line 73, in _process
    checkin_app = OAuthApplication.find_one(system_app_type=SystemAppType.checkin)
  File "/opt/indico/.venv/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/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()

I search for qrcode.png but under /event/155/ folder I do not have the manage folder and subfolder … so I think that I missed something…

Please, I’m glad to receive your assistance …



Hey Simone,

that is truly a bit weird. Apparently you are missing some data in the DB that should have been created when performing the initial steps when setting up an Indico server. I think that you could run the below-mentioned snippet using indico shell to create missing table rows

from indico.modules.oauth.models.applications import OAuthApplication, SystemAppType

for sat in SystemAppType:
    if sat != SystemAppType.none and OAuthApplication.query.filter_by(system_app_type=sat).first() is None:
        db.session.add(OAuthApplication(system_app_type=sat, **sat.default_data))

Hi kolodzie, thanks for your reply!! I run your snippet … and receive that:

IntegrityError                            Traceback (most recent call last)
<ipython-input-4-5435e503fa23> in <module>()
      2     if sat != SystemAppType.none and OAuthApplication.query.filter_by(system_app_type=sat).first() is None:
      3         db.session.add(OAuthApplication(system_app_type=sat, **sat.default_data))
----> 4         db.session.commit()

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/scoping.pyc in do(self, *args, **kwargs)
    151 def instrument(name):
    152     def do(self, *args, **kwargs):
--> 153         return getattr(self.registry(), name)(*args, **kwargs)
    154     return do

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in commit(self)
    941                 raise sa_exc.InvalidRequestError("No transaction is begun.")
--> 943         self.transaction.commit()
    945     def prepare(self):

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in commit(self)
    465         self._assert_active(prepared_ok=True)
    466         if self._state is not PREPARED:
--> 467             self._prepare_impl()
    469         if self._parent is None or self.nested:

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in _prepare_impl(self)
    445                 if self.session._is_clean():
    446                     break
--> 447                 self.session.flush()
    448             else:
    449                 raise exc.FlushError(

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in flush(self, objects)
   2252         try:
   2253             self._flushing = True
-> 2254             self._flush(objects)
   2255         finally:
   2256             self._flushing = False

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in _flush(self, objects)
   2378         except:
   2379             with util.safe_reraise():
-> 2380                 transaction.rollback(_capture_exception=True)
   2382     def bulk_save_objects(

/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.pyc in __exit__(self, type_, value, traceback)
     64             self._exc_info = None   # remove potential circular references
     65             if not self.warn_only:
---> 66                 compat.reraise(exc_type, exc_value, exc_tb)
     67         else:
     68             if not compat.py3k and self._exc_info and self._exc_info[1]:

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyc in _flush(self, objects)
   2342             self._warn_on_events = True
   2343             try:
-> 2344                 flush_context.execute()
   2345             finally:
   2346                 self._warn_on_events = False

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.pyc in execute(self)
    389                     self.dependencies,
    390                     postsort_actions):
--> 391                 rec.execute(self)
    393     def finalize_flush_changes(self):

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.pyc in execute(self, uow)
    554                              uow.states_for_mapper_hierarchy(
    555                                  self.mapper, False, False),
--> 556                              uow
    557                              )

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.pyc in save_obj(base_mapper, states, uowtransaction, single)
    179         _emit_insert_statements(base_mapper, uowtransaction,
    180                                 cached_connections,
--> 181                                 mapper, table, insert)
    183     _finalize_insert_update_commands(

/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.pyc in _emit_insert_statements(base_mapper, uowtransaction, cached_connections, mapper, table, i                                           nsert, bookkeeping)
    864                 else:
    865                     result = cached_connections[connection].\
--> 866                         execute(statement, params)
    868                 primary_key = result.context.inserted_primary_key

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.pyc in execute(self, object, *multiparams, **params)
    946             raise exc.ObjectNotExecutableError(object)
    947         else:
--> 948             return meth(self, multiparams, params)
    950     def _execute_function(self, func, multiparams, params):

/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyc in _execute_on_connection(self, connection, multiparams, params)
    267     def _execute_on_connection(self, connection, multiparams, params):
    268         if self.supports_execution:
--> 269             return connection._execute_clauseelement(self, multiparams, params)
    270         else:
    271             raise exc.ObjectNotExecutableError(self)

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_clauseelement(self, elem, multiparams, params)
   1058             compiled_sql,
   1059             distilled_params,
-> 1060             compiled_sql, distilled_params
   1061         )
   1062         if self._has_events or self.engine._has_events:

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args)
   1198                 parameters,
   1199                 cursor,
-> 1200                 context)
   1202         if self._has_events or self.engine._has_events:

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.pyc in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)
   1411                 util.raise_from_cause(
   1412                     sqlalchemy_exception,
-> 1413                     exc_info
   1414                 )
   1415             else:

/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.pyc in raise_from_cause(exception, exc_info)
    201     exc_type, exc_value, exc_tb = exc_info
    202     cause = exc_value if exc_value is not exception else None
--> 203     reraise(type(exception), exception, tb=exc_tb, cause=cause)
    205 if py3k:

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args)
   1191                         statement,
   1192                         parameters,
-> 1193                         context)
   1194         except BaseException as e:
   1195             self._handle_dbapi_exception(

/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.pyc in do_execute(self, cursor, statement, parameters, context)
    506     def do_execute(self, cursor, statement, parameters, context=None):
--> 507         cursor.execute(statement, parameters)
    509     def do_execute_no_params(self, cursor, statement, context=None):

IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "ix_uq_applications_name_lower"
DETAIL:  Key (lower(name::text))=(checkin app) already exists.
 [SQL: 'INSERT INTO oauth.applications (name, description, client_id, client_secret, default_scopes, redirect_uris, is_enabled, is_trusted, system_app_type) V                                           ALUES (%(name)s, %(description)s, %(client_id)s, %(client_secret)s, %(default_scopes)s, %(redirect_uris)s, %(is_enabled)s, %(is_trusted)s, %(system_app_type)s                                           ) RETURNING oauth.applications.id'] [parameters: {'is_enabled': True, 'redirect_uris': [u'http://localhost'], 'name': u'Checkin App', 'is_trusted': True, 'cli                                           ent_id': UUID('48b6be7e-8199-487c-b535-08f70e8e38f9'), 'client_secret': UUID('2ca87230-3187-48f3-a420-c4ab968eb93a'), 'system_app_type': <SystemAppType.checki                                           n: 1>, 'default_scopes': [u'registrants'], 'description': u'The checkin app for mobile devices allows scanning ticket QR codes and checking-in event participa                                           nts.'}] (Background on this error at: http://sqlalche.me/e/gkpj)

So, this is a bit weird how you ended up with such data in your DB, but you should probably go to the Admin Area of your instance, then “Applications” in the left menu and remove the “Checkin App” entry from there. After that run again the snippet that I sent you.

Yesss, great!!! it’s work!!

thanks a lot kolodzie!!