Multiple bundles with the same name

Ralf Baechle ralf at linux-mips.org
Sun Jul 18 15:13:03 EST 2010


It is possible that multiple users create with the same name:

mysql> use patchwork;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from patchwork_bundle where name = 'jz4740';
+----+----------+------------+--------+--------+
| id | owner_id | project_id | name   | public |
+----+----------+------------+--------+--------+
| 28 |        5 |          1 | jz4740 |      1 |
| 31 |       26 |          1 | jz4740 |      1 |
+----+----------+------------+--------+--------+
2 rows in set (0.00 sec)

mysql>

The attempt to access such a bundle's public URL results in an error:

Traceback (most recent call last):

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/views/bundle.py", line 183, in public
    bundle = get_object_or_404(Bundle, name = bundlename, public = True)

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/shortcuts/__init__.py", line 46, in get_object_or_404
    return queryset.get(*args, **kwargs)

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/db/models/query.py", line 305, in get
    % (self.model._meta.object_name, num, kwargs))

MultipleObjectsReturned: get() returned more than one Bundle -- it returned 2! Lookup parameters were {'name': u'jz4740', 'public': True}

It would appear that patchwork_bundle should be searched for an
(owner, name) tuple but is only searched for (name).

  Ralf


More information about the Patchwork mailing list