Re: Issue 3614 in reviewboard: djblets prevents handling of generic django IntegrityErrors

2014-10-30 Thread reviewboard


Comment #2 on issue 3614 by trowb...@gmail.com: djblets prevents handling  
of generic django IntegrityErrors

https://code.google.com/p/reviewboard/issues/detail?id=3614

I don't really understand this. The djblets wrapper doesn't do anything  
substantially different from the django one.


--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
reviewboard-issues group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To post to this group, send email to reviewboard-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.


Issue 3614 in reviewboard: djblets prevents handling of generic django IntegrityErrors

2014-10-10 Thread reviewboard

Status: New
Owner: 
Labels: Type-Defect Priority-Medium

New issue 3614 by mrcote: djblets prevents handling of generic django  
IntegrityErrors

https://code.google.com/p/reviewboard/issues/detail?id=3614

What version are you running?

2.0.8

What's the URL of the page containing the problem?

account/login/

What steps will reproduce the problem?
1. Create a simple extension with the AuthBackend below
2. Try logging in with any username and password.

What is the expected output? What do you see instead?

In the logs, we should see INTEGRITY ERROR and a traceback.  Instead, we  
get the following traceback:


UNIQUE constraint failed: auth_user.username
Traceback (most recent call last):
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/core/handlers/base.py,  
line 112, in get_response

response = wrapped_callback(request, *callback_args, **callback_kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/views/decorators/debug.py,  
line 75, in sensitive_post_parameters_wrapper

return view(request, *args, **kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/utils/decorators.py,  
line 99, in _wrapped_view

response = view_func(request, *args, **kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/views/decorators/cache.py,  
line 52, in _wrapped_view_func

response = view_func(request, *args, **kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/contrib/auth/views.py,  
line 36, in login

if form.is_valid():
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/forms/forms.py,  
line 129, in is_valid

return self.is_bound and not bool(self.errors)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/forms/forms.py,  
line 121, in errors

self.full_clean()
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/forms/forms.py,  
line 274, in full_clean

self._clean_form()
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/forms/forms.py,  
line 300, in _clean_form

self.cleaned_data = self.clean()
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/contrib/auth/forms.py,  
line 189, in clean

password=password)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/contrib/auth/__init__.py,  
line 49, in authenticate

user = backend.authenticate(**credentials)
   
File /home/mcote/experiment/reviewboard/src/integritytest/integritytest/extension.py,  
line 35, in authenticate

email='f...@example.org')
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/manager.py,  
line 157, in create

return self.get_queryset().create(**kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/query.py,  
line 322, in create

obj.save(force_insert=True, using=self.db)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/base.py,  
line 545, in save

force_update=force_update, update_fields=update_fields)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/base.py,  
line 573, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using,  
update_fields)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/base.py,  
line 654, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk,  
raw)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/base.py,  
line 687, in _do_insert

using=using, raw=raw)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/manager.py,  
line 232, in _insert

return insert_query(self.model, objs, fields, **kwargs)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/query.py,  
line 1514, in insert_query

return query.get_compiler(using=using).execute_sql(return_id)
   
File /home/mcote/experiment/reviewboard/local/lib/python2.7/site-packages/Django-1.6.7-py2.7.egg/django/db/models/sql/compiler.py,  
line 903, in execute_sql

cursor.execute(sql, params)
   
File 

Re: Issue 3614 in reviewboard: djblets prevents handling of generic django IntegrityErrors

2014-10-10 Thread reviewboard


Comment #1 on issue 3614 by mrcote: djblets prevents handling of generic  
django IntegrityErrors

https://code.google.com/p/reviewboard/issues/detail?id=3614

Forgot to include my extension code.  I created an extension with the  
generate_extension.py tool and added this backend to extension.py (with the  
appropriate entry point in setup.py).  This extension just tries to add  
an 'admin' user, which already exists in my setup (created as part of  
prepare-dev.py).  As mentioned, this should be caught by a generic  
django.db.IntegrityError, but it isn't.


class IntegrityTestBackend(AuthBackend):

backend_id = _('integritytest')
name = _('IntegrityTest')

def authenticate(self, username, password):
username = username.strip()
try:
user = User.objects.create(username='admin', password='!',
   email='f...@example.org')
except IntegrityError:
logging.exception('INTEGRITY ERROR')
return None

def get_or_create_user(self, username, request):
try:
return User.objects.get(username=username)
except User.DoesNotExist:
return None


--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
reviewboard-issues group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard-issues+unsubscr...@googlegroups.com.
To post to this group, send email to reviewboard-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.