pynipap.NipapError: <type 'exceptions.UnboundLocalError'>:local variable 'q' referenced before assignment
I believe I've found a bug - I'm not entirely sure how I'm triggering it, and what I'm doing is likely wrong, but I don't think it should be returning this response

I've tracked down the erroring code to https://github.com/SpriteLink/NIPAP/blob/master/nipap/nipap/backend.py#L991

diff --git a/nipap/nipap/backend.py b/nipap/nipap/backend.py
index b6d023a1..4f08ace4 100644
--- a/nipap/nipap/backend.py
+++ b/nipap/nipap/backend.py
@@ -987,16 +987,19 @@ class Nipap:
                 }
             )
 
-        # We can have zero modified rows. Deal with it.
-        if len(qps) > 0:
-            q = qps[0]
-
-            for qp in qps[1:]:
-                q = {
-                    'operator': 'or',
-                    'val1': q,
-                    'val2': qp
-                }
+        # if we didn't update anything return empty list
+        if len(qps) == 0:
+            return []
+
+        # fetch list of objects based on IDs
+        q = qps[0]
+
+        for qp in qps[1:]:
+            q = {
+                'operator': 'or',
+                'val1': q,
+                'val2': qp
+            }
 
         updated = function(auth, q, { 'max_result': 10000 })['result']
 
['nipap/nipap/backend.py']