Multiple framworks crash the ClickPackageUploadForm

Bug #1293157 reported by James Westby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Developer registration portal
Fix Released
High
Matias Bordese

Bug Description

https://oops.canonical.com/?oopsid=OOPS-ea0cc4492bbe47758af47b7ea7d137a3

 MultipleObjectsReturned: get() returned more than one ClickPackageFramework -- it returned 2!

      File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/views/decorators/cache.py", line 89, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/utils/decorators.py", line 25, in _wrapper
    return bound_func(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/utils/decorators.py", line 21, in bound_func
    return func(self, *args2, **kwargs2)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/utils/decorators.py", line 25, in _wrapper
    return bound_func(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/decorators.py", line 125, in inner_decorator
    request, application, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/decorators.py", line 111, in check_non_arb_request
    return func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/utils/decorators.py", line 21, in bound_func
    return func(self, *args2, **kwargs2)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/clickapp_views.py", line 239, in dispatch
    ClickPackageUpdateView, self).dispatch(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/views/generic/base.py", line 86, in dispatch
    return handler(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/views.py", line 643, in get
    form = form_class(data=data, instance=instance)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/clickapp_forms.py", line 313, in __init__
    super(ClickPackageUploadForm, self).__init__(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/clickapp_forms.py", line 264, in __init__
    super(ClickPackageVersionForm, self).__init__(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/forms.py", line 627, in __init__
    self.initial = self.get_form_data_from_app(self.instance)
  File "/srv/sc.ubuntu.com/production/software-center-agent-rev-1254/src/devportal/clickapp_forms.py", line 277, in get_form_data_from_app
    framework = current.frameworks.get()
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/db/models/manager.py", line 143, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/lib/django/db/models/query.py", line 407, in get
    (self.model._meta.object_name, num))

It looks like maybe get_form_data_from_app should use current.click_framework instead of current.frameworks.get()?

Matias I believe you know this code best. If you let me know what the fix is I'll be happy to implement it.

Thanks,

James

Revision history for this message
Matias Bordese (matiasb) wrote :

Thanks James, working on this.

Frameworks should be restricted to be 1 per upload, that's why it is using .get() there. Problem seems related to the way frameworks are updated for an upload, before really uploading the app.

Matias Bordese (matiasb)
Changed in developer-portal:
status: New → 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.