Person+vouchers AttributeError 'tuple' object has no attribute 'append'

Bug #931479 reported by Curtis Hovey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Curtis Hovey

Bug Description

I broke applying vouchers. with a vocab change to permit any project to have a commercial subscription. A secondary change was to change the vocab to only return a resultset because it can be expensize converting all projects to a list. The TB suggests that the view's cache rules expect a list.

Module zope.app.form.browser.itemswidgets, line 122, in convertTokensToValues
term = self.vocabulary.getTermByToken(token)
Module lp.registry.vocabularies, line 1552, in getTermByToken
for search_result in search_results:
Module lp.services.database.decoratedresultset, line 112, in __iter__
self.pre_iter_hook(results)
Module lp.registry.model.product, line 1602, in eager_load
cache._cached_licenses.append(license.license)
AttributeError: 'tuple' object has no attribute 'append'

Related branches

Curtis Hovey (sinzui)
tags: added: commercial
Revision history for this message
Curtis Hovey (sinzui) wrote :

Oh This is about ProductLicense, not CommercialSubscription. +voucher has always had a performance problem because the saleforce voucher data is slow to collect, the data is cached. When a voucher is applied to add the commercial subscription to the projects, the view issues a next_url signal to itself to reload the data cached by setUpFields and SetUpWidgets. This breaks because I switched the Commercial Admin query to (not the query used by most users) use productset.search which is fast and has cached goodness. next_url is in conflict with the model cache which does not want to reload the object.

There are two paths to resolve the conflict. Clear the cache on the model, or clear the cache on the view. I favour the view because When a voucher is applied, the only data invalid in the form is the voucher in its vocab.

Revision history for this message
Curtis Hovey (sinzui) wrote :

The cache issue was caused more by the vocabulary than by the view. The view calls the vocabulary multiple times during field and widget setup. The the getTermByToken() performed a search of search was previously called during a iter operation. Search is not needed in the case of for commercial admins...the token must be an active project name and that ias faster to lookup that doing another search.

Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
tags: added: qa-untestable
removed: qa-needstesting
William Grant (wgrant)
Changed in launchpad:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
tags: added: disclosure entitlement
removed: commercial
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.