jfinkels/flask-restless — pull request #178 by glyphobet (2013-04-09 17:59:47+00:00)
Title: fix _get_or_create

This code queried for the instance using the key returned by `_primary_key_name`. That function however only returns the *first* primary key. And it may be that several primary keys are needed to uniquely identify a row, so it wasn't guaranteed to always get the correct row.

It also did not check whether the result of `_get_by` returned `None`, in which case it would go on to assign attributes to `None` rather than a model object.