#336: bhdashboard.model.ModelBase insert method fails if no unique fields specified ---------------------------+-------------------- Reporter: franco | Owner: nobody Type: defect | Status: new Priority: critical | Milestone: Component: multiproduct | Version: 0.3.0 Resolution: | Keywords: ---------------------------+--------------------
Comment (by gjm): Thanks franco. Good find. The diff below would be similar to your suggestion. {{{ #!diff Index: bloodhound_dashboard/bhdashboard/model.py =================================================================== --- bloodhound_dashboard/bhdashboard/model.py (revision 1429887) +++ bloodhound_dashboard/bhdashboard/model.py (working copy) @@ -145,7 +145,7 @@ for k in self._meta['key_fields']]))): sdata = {'keys':','.join(["%s='%s'" % (k, self._data[k]) for k in self._meta['key_fields']])} - elif len(self.select(self._env, where = + elif self._meta['unique_fields'] and len(self.select(self._env, where = dict([(k,self._data[k]) }}} This appears to fix the testcase you suggest but I have not checked through the full consequences of the change yet. -- Ticket URL: <https://issues.apache.org/bloodhound/ticket/336#comment:2> Apache Bloodhound <https://issues.apache.org/bloodhound/> The Apache Bloodhound (incubating) issue tracker