Commits

Olemis Lang  committed a6fbb6d

BH Multiproduct #115 : Slightly improved uniqueness check in 'ModelBase' plus typos fixed ... (failures=3, errors=3)

Ran 27 tests in 2.446s

  • Participants
  • Parent commits 45dfb01
  • Branches t115_product_env

Comments (0)

Files changed (1)

File t115/t115_r1427886_product_config.diff

 
 diff -r 56bf5ca5136d bloodhound_dashboard/bhdashboard/model.py
 --- a/bloodhound_dashboard/bhdashboard/model.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_dashboard/bhdashboard/model.py	Mon Jan 07 01:40:49 2013 -0500
++++ b/bloodhound_dashboard/bhdashboard/model.py	Mon Jan 07 03:02:57 2013 -0500
 @@ -117,8 +117,9 @@
                  self._update_from_row(row)
                  break
      
      def delete(self):
          """Deletes the matching record from the database"""
-@@ -151,7 +152,8 @@
+@@ -144,14 +145,15 @@
+                                       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])
+                                       for k in self._meta['unique_fields']]))):
+             sdata = {'keys':','.join(["%s='%s'" % (k, self._data[k])
                                       for k in self._meta['unique_fields']])}
          if sdata:
              sdata.update(self._meta)
              data = dict([(fields[i], row[i]) for i in range(len(fields))])
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/api.py
 --- a/bloodhound_multiproduct/multiproduct/api.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/api.py	Mon Jan 07 01:40:49 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/api.py	Mon Jan 07 03:02:57 2013 -0500
 @@ -31,9 +31,9 @@
  from trac.util.translation import _, N_
  from trac.web.chrome import ITemplateProvider
      def get_version(self):
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/config.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/multiproduct/config.py	Mon Jan 07 01:40:49 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/config.py	Mon Jan 07 03:02:57 2013 -0500
 @@ -0,0 +1,291 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one
 +            self.env.log.warning("No record for product option %s", option_key)
 +        else:
 +            self._cache.pop(key, None)
-+            settings.delete()
++            setting.delete()
 +            self.env.log.info("Removing product option %s", option_key)
 +
 +    def set(self, key, value):
 +
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/model.py
 --- a/bloodhound_multiproduct/multiproduct/model.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/model.py	Mon Jan 07 01:40:49 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/model.py	Mon Jan 07 03:02:57 2013 -0500
 @@ -18,6 +18,7 @@
  
  """Models to support multi-product"""