Transaction object must always have a transaction id
authorJohn Dennis <jdennis@redhat.com>
Sat, 10 Oct 2015 15:28:10 +0000 (11:28 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Sat, 10 Oct 2015 21:23:06 +0000 (23:23 +0200)
A Transaction object must always have a transaction id (tid) because a
tid is how a transaction is referenced (e.g. when being stored or
retrieved). The existing code erroneously assumed a tid only needed to
be created if the request contained query or form parameters. This
restriction is now removed, if the transaction id cannot be found as a
request parameter a tid is unconditionally created.

Ticket: 177
Signed-off-by: John Dennis <jdennis@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/util/trans.py

index bcc3bd0..22c7641 100644 (file)
@@ -18,12 +18,12 @@ class Transaction(Log):
         self._ts = TranStore()
         self.cookie = None
 
-        # Backwards compat,
-        # if arguments are passed find or get new transaction
         if kwargs:
             self.find_tid(kwargs)
-            if not self.transaction_id:
-                self.create_tid()
+
+        # If tid isn't found create a new one
+        if not self.transaction_id:
+            self.create_tid()
 
     def find_tid(self, kwargs):
         tid = kwargs.get(TRANSID)