Code

match empty multilinks implemented for metakit
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 26 Mar 2003 06:36:11 +0000 (06:36 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 26 Mar 2003 06:36:11 +0000 (06:36 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1633 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/back_metakit.py

index 13a6573f32345f32c5de122e124330a948d388fc..1837c69717474a2d6798c47d5cb0d9cb33e75a4b 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: back_metakit.py,v 1.43 2003-03-17 22:03:04 kedder Exp $
+# $Id: back_metakit.py,v 1.44 2003-03-26 06:36:11 richard Exp $
 '''
    Metakit backend for Roundup, originally by Gordon McMillan.
 
@@ -908,7 +908,9 @@ class Class:
             if prop is None:
                 prop = self.privateprops[propname]
             if isinstance(prop, hyperdb.Multilink):
-                if type(value) is not _LISTTYPE:
+                if value in ('-1', ['-1']):
+                    value = []
+                elif type(value) is not _LISTTYPE:
                     value = [value]
                 # transform keys to ids
                 u = []
@@ -987,6 +989,8 @@ class Class:
             def ff(row, ml=mlcriteria):
                 for propname, values in ml.items():
                     sv = getattr(row, propname)
+                    if not values and sv:
+                        return 0
                     for id in values:
                         if sv.find(fid=id) == -1:
                             return 0