diff roundup/backends/back_anydbm.py @ 6412:a0c0ee3ed8b1

Tests for Link expressions .. and fixes for anydbm backend, this now passes all the new tests.
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 17 May 2021 17:35:50 +0200
parents 8bc5faeb7677
children f08907bfd5a1
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Thu May 13 10:28:45 2021 +0200
+++ b/roundup/backends/back_anydbm.py	Mon May 17 17:35:50 2021 +0200
@@ -1701,13 +1701,7 @@
                 if isinstance(propclass, hyperdb.Link):
                     if type(v) is not type([]):
                         v = [v]
-                    u = []
-                    for entry in v:
-                        # the value -1 is a special "not set" sentinel
-                        if entry == '-1':
-                            entry = None
-                        u.append(entry)
-                    l.append((LINK, k, u))
+                    l.append((LINK, k, v))
                 elif isinstance(propclass, hyperdb.Multilink):
                     # If it's a reverse multilink, we've already
                     # computed the ids of our own class.
@@ -1814,7 +1808,9 @@
                     if t == LINK:
                         # link - if this node's property doesn't appear in the
                         # filterspec's nodeid list, skip it
-                        match = nv in v
+                        expr = Expression(v, is_link=True)
+                        if expr.evaluate(nv):
+                            match = 1
                     elif t == MULTILINK:
                         # multilink - if any of the nodeids required by the
                         # filterspec aren't in this node's property, then skip

Roundup Issue Tracker: http://roundup-tracker.org/