﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13012	Model.objects.get_or_create() try/except is slightly yet insideously broken	brantley (deadwisdom@…	nobody	"What is wrong with this code:
{{{
    except self.model.DoesNotExist:
        raise e
}}}

That's right, e is not defined.  But what if e is previously defined in a surrounding except block?  Then we will be raising the previous exception, not the current one.  That's exactly what is happening in {{{get_or_create()}}}, and caused me some consternation as I was getting a ""PRIMARY_KEY must be unique"" exception, even though the real exception was something else.

Patch, in all its three character glory, is included."		closed	Database layer (models, ORM)	1.1		invalid	get_or_create		Unreviewed	1	0	0	0	0	0
