Closed Bug 973630 Opened 12 years ago Closed 12 years ago

[Groups] Group add/edit form should check that group name doesn't exist in aliases too.

Categories

(Participation Infrastructure :: Phonebook, defect)

2014-02.4
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: giorgos, Assigned: giorgos)

Details

(Whiteboard: [kb=1275283] )

Attachments

(1 file)

The new curated groups add/edit form doesn't check if the name for the group already exists in the aliases table. If a name already exists in the aliases database, then group save() does not complete, because GroupAlias is never created as the unique field name already exists in the database. This results in created groups without a url. Instead the form should not allow the user to create a group with the given name. Here the traceback generated: Traceback (most recent call last): File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/api/object_wrapper.py", line 220, in __call__ self._nr_instance, args, kwargs) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/hooks/framework_django.py", line 475, in wrapper return wrapped(*args, **kwargs) File "/data/www/mozillians.org/mozillians/mozillians/groups/views.py", line 326, in group_add_edit group = form.save() File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/forms/models.py", line 364, in save fail_message, commit, construct=False) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/forms/models.py", line 86, in save_instance instance.save() File "/data/www/mozillians.org/mozillians/mozillians/groups/models.py", line 34, in save alias = self.ALIAS_MODEL.objects.create(name=self.name, alias=self) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/manager.py", line 137, in create return self.get_query_set().create(**kwargs) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/query.py", line 377, in create obj.save(force_insert=True, using=self.db) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/base.py", line 463, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/base.py", line 551, in save_base result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/manager.py", line 203, in _insert return insert_query(self.model, objs, fields, **kwargs) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/query.py", line 1593, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/models/sql/compiler.py", line 912, in execute_sql cursor.execute(sql, params) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/db/backends/mysql/base.py", line 114, in execute return self.cursor.execute(query, args) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/hooks/database_dbapi2.py", line 36, in execute return self._nr_cursor.execute(sql, *args, **kwargs) File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute self.errorhandler(self, exc, value) File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue IntegrityError: (1062, "Duplicate entry 'mozilla ph' for key 'name'")
Whiteboard: [kb=1275283]
Commits pushed to master at https://github.com/mozilla/mozillians https://github.com/mozilla/mozillians/commit/d952d0035756b1c39abca0c76307923f4716b5b4 [fix bug 973630] Check group aliases for name uniqueness. Check that GroupBase.name is unique in ALIAS_MODEL. https://github.com/mozilla/mozillians/commit/a1c26e913bde1321125f3f79b09d960a2ac7aed9 Merge pull request #821 from glogiotatidis/973630 [fix bug 973630] Check group aliases for name uniqueness.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Version: other → next
Verified that new group names are compared to both groups and group aliases. 1) merged "us" into "usa" 2) tried to create "us" and got an error 3) tried to create "usa" and got the same error
Status: RESOLVED → VERIFIED
Version: next → 2014-02.2
Version: 2014-02.2 → 2014-02.4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: