Cannot import for-purchase apps when archive_id=None

Bug #993813 reported by Michael Nelson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Apps Directory
Fix Released
Medium
Michael Nelson

Bug Description

Currently the import_for_purchase_apps assumes that all published apps have a non-null archive_id, but this is no longer the case (as ARB apps can be published with a null archive_id). This leads to:

{{{
michael@server-7804:~/ca/webcat/current_work$ fab manage:'import_for_purchase_apps'
[localhost] local: virtualenv/bin/python django_project/manage.py import_for_purchase_apps
Traceback (most recent call last):
  File "django_project/manage.py", line 18, in <module>
    execute_manager(settings)
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django_configglue-0.6.1-py2.7.egg/django_configglue/management/__init__.py", line 71, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/michael/ca/webcat/current_work/src/webcatalog/management/commands/import_for_purchase_apps.py", line 69, in handle
    self.import_app_from_data(app_data, icon_data, distroseries)
  File "/home/michael/ca/webcat/current_work/src/webcatalog/management/commands/import_for_purchase_apps.py", line 73, in import_app_from_data
    form = ForPurchaseApplicationForm.from_json(app_data, distroseries)
  File "/home/michael/ca/webcat/current_work/src/webcatalog/forms.py", line 151, in from_json
    distroseries=distroseries)
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django/db/models/manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/home/michael/ca/webcat/current_work/virtualenv/local/lib/python2.7/site-packages/django/db/models/query.py", line 351, in get
    % (self.model._meta.object_name, num, kwargs))
webcatalog.models.applications.MultipleObjectsReturned: get() returned more than one Application -- it returned 31792! Lookup parameters were {'archive_id': None, 'distroseries': <DistroSeries: Ubuntu Precise ()>}

Fatal error: local() encountered an error (return code 1) while executing 'virtualenv/bin/python django_project/manage.py import_for_purchase_apps '
}}}

Related branches

Changed in ubuntu-webcatalog:
status: In Progress → Fix Committed
Changed in ubuntu-webcatalog:
milestone: none → 12.05
Dave Morley (davmor2)
Changed in ubuntu-webcatalog:
status: Fix Committed → Fix Released
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.