I'm getting a ProgrammingError (I've pasted the last part of the traceback at the bottom of the page).
The error comes from my first heavy-AJAX page in Pylons (postgres backend). If I cause too many AJAX requests at a time, or even after doing 3 non-overlapping AJAX requests, I get the error. I wonder if there's some sort of handle releasing I need to do... or transaction releasing? As a side note... I test using SQLite and put in production with Postgres, and the page works wonderfully in SQLite -- it's only Postgres that has the problem. Thanks, Matt Here are the methods called during the AJAX request (it starts on toggle_property(option_id, 'select')): # session is the user's session (browser stuff) # Session = scoped_session(sessionmaker(autoflush=True, transactional=True, bind=config['pylons.g'].sa_engine)) def _single_row(self, option_id, message='', withrow=False): opt = Session.query(Option).filter_by(id=option_id).first() if opt: return render('tpp_manager/option_row.mtl', option=opt, updateid="option_%s"%opt.id, message=message, withrow=withrow) else: if not message: message = "Doesn't exist" return render('tpp_manager/option_row.mtl', message=message, withrow=withrow) def _toggle_property(self, option_id, prop): if prop == 'select': option_id = int(option_id) if session['tpp_select'].get(option_id, False): del(session['tpp_select'][option_id]) else: session['tpp_select'][option_id] = True session.save() return True else: opt = Session.query(Option).filter_by(id=option_id).first() if opt: if prop == 'whitelisted': opt.whitelisted = not opt.whitelisted if opt.whitelisted and opt.blacklisted: opt.blacklisted = False elif prop == 'blacklisted': opt.blacklisted = not opt.blacklisted if opt.blacklisted and opt.whitelisted: opt.whitelisted = False elif prop == 'approved': opt.approved = not opt.approved else: return False Session.commit() Session.refresh(opt) else: return False return True def toggle_property(self, option_id, prop): message = '' if not self._toggle_property(option_id, prop): message = 'Failed to change flag.' return self._single_row(option_id) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/orm/query.py', line 719 in first ret = list(self[0:1]) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/orm/query.py', line 748 in __iter__ return self._execute_and_instances(context) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/orm/query.py', line 751 in _execute_and_instances result = self.session.execute(querycontext.statement, params=self._params, mapper=self.mapper, instance=self._refresh_instance) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/orm/session.py', line 535 in execute return self.__connection(engine, close_with_result=True).execute(clause, params or {}) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 844 in execute return Connection.executors[c](self, object, multiparams, params) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 895 in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 907 in _execute_compiled self.__execute_raw(context) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 916 in __execute_raw self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 953 in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor) File '/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.2-py2.4.egg/ sqlalchemy/engine/base.py', line 935 in _handle_dbapi_exception raise exceptions.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) ProgrammingError: (ProgrammingError) current transaction is aborted, commands ignored until end of transaction block 'SELECT anon_1.tpp_options_question_id AS anon_1_tpp_options_question_id, anon_1.tpp_options_option AS anon_1_tpp_options_option, anon_1.tpp_options_id AS anon_1_tpp_options_id, anon_1.tpp_options_approved AS anon_1_tpp_options_approved, anon_1.tpp_options_blacklisted AS anon_1_tpp_options_blacklisted, anon_1.tpp_options_whitelisted AS anon_1_tpp_options_whitelisted, anon_1.tpp_options_entrydate AS anon_1_tpp_options_entrydate, tpp_answers_1.id AS tpp_answers_1_id, tpp_answers_1.customer_id AS tpp_answers_1_customer_id, tpp_answers_1.question_id AS tpp_answers_1_question_id, tpp_answers_1.answer AS tpp_answers_1_answer, tpp_answers_1.answerdate AS tpp_answers_1_answerdate, tpp_answers_1.visible AS tpp_answers_1_visible \nFROM (SELECT tpp_options.question_id AS tpp_options_question_id, tpp_options.option AS tpp_options_option, tpp_options.id AS tpp_options_id, tpp_options.approved AS tpp_options_approved, tpp_options.blacklisted AS tpp_options_blacklisted, tpp_options.whitelisted AS tpp_options_whitelisted, tpp_options.entrydate AS tpp_options_entrydate, tpp_options.id AS tpp_options_oid \nFROM tpp_options \nWHERE tpp_options.id = %(tpp_options_id_1)s ORDER BY tpp_options.id \n LIMIT 1 OFFSET 0) AS anon_1 LEFT OUTER JOIN tpp_answers AS tpp_answers_1 ON anon_1.tpp_options_option = tpp_answers_1.answer AND anon_1.tpp_options_question_id = tpp_answers_1.question_id AND tpp_answers_1.visible = % (tpp_answers_visible_1)s ORDER BY anon_1.tpp_options_id, tpp_answers_1.id' {'tpp_options_id_1': u'4169', 'tpp_answers_visible_1': True} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---