magfest-archive / guests

Magfest band management plugin for ubersystem
GNU Affero General Public License v3.0
1 stars 1 forks source link

Band info page throws an exception if you pass an empty value instead of 0 #66

Closed RobRuana closed 7 years ago

RobRuana commented 7 years ago
 Traceback (most recent call last):
      File "/usr/local/uber/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 670, in respond
        response.body = self.handler()
      File "/usr/local/uber/env/lib/python3.4/site-packages/cherrypy/lib/encoding.py", line 220, in __call__
        self.body = self.oldhandler(*args, **kwargs)
      File "/usr/local/uber/env/lib/python3.4/site-packages/cherrypy/_cpdispatch.py", line 60, in __call__
        return self.callable(*self.args, **self.kwargs)
      File "/usr/local/uber/plugins/uber/uber/decorators.py", line 240, in with_timing
        return func(*args, **kwargs)
      File "/usr/local/uber/plugins/uber/uber/decorators.py", line 231, in with_caching
        return func(*args, **kwargs)
      File "/usr/local/uber/plugins/uber/uber/decorators.py", line 259, in with_session
        session.commit()
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 874, in commit
        self.transaction.commit()
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 461, in commit
        self._prepare_impl()
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
        self.session.flush()
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2139, in flush
        self._flush(objects)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2259, in _flush
        transaction.rollback(_capture_exception=True)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
        compat.reraise(exc_type, exc_value, exc_tb)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
        raise value
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/session.py", line 2223, in _flush
        flush_context.execute()
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
        rec.execute(self)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
        uow
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 177, in save_obj
        mapper, table, update)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/orm/persistence.py", line 737, in _emit_update_statements
        execute(statement, multiparams)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 945, in execute
        return meth(self, multiparams, params)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
        return connection._execute_clauseelement(self, multiparams, params)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
        compiled_sql, distilled_params
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
        context)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
        exc_info
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
        reraise(type(exception), exception, tb=exc_tb, cause=cause)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
        raise value.with_traceback(tb)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
        context)
      File "/usr/local/uber/env/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
        cursor.execute(statement, parameters)
    sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) null value in column "vehicles" violates not-null constraint
    DETAIL:  Failing row contains (4a1d964a-12b9-4233-ba5a-6ed743b52422, d849b30b-89fc-4948-9911-05c53d354e68, null, 100, null, 20, 40).
     [SQL: 'UPDATE band SET payment=%(payment)s, vehicles=%(vehicles)s WHERE band.id = %(band_id)s'] [parameters: {'payment': 100, 'vehicles': None, 'band_id': UUID('4a1d964a-12b9-4233-ba5a-6ed743b52422')}]
kitsuta commented 7 years ago

Turns out there's no checks for this stuff whatsoever on the admin side. Whoops.