- fixed bug in logging of event_objects
authorTony Mack <tmack@cs.princeton.edu>
Thu, 19 Oct 2006 21:38:08 +0000 (21:38 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Thu, 19 Oct 2006 21:38:08 +0000 (21:38 +0000)
PLC/Method.py

index 9b4a440..4010f98 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Method.py,v 1.9 2006/10/19 17:02:42 tmack Exp $
+# $Id: Method.py,v 1.10 2006/10/19 19:32:48 tmack Exp $
 #
 
 import xmlrpclib
@@ -154,11 +154,11 @@ class Method:
        self.api.db.do(sql_event, locals())     
 
        # log objects affected
+       event_id =  self.api.db.last_insert_id('events', 'event_id')
        for object_id in object_ids:
-               event_id =  self.api.db.last_insert_id('events', 'event_id')
                sql_objects = "INSERT INTO event_object (event_id, object_id) VALUES" \
-                        " (%(event_id)d, %(object_id)d) "  % (locals()) 
-               self.api.db.do(sql_objects)
+                        " (%(event_id)d, %(object_id)d) " 
+               self.api.db.do(sql_objects, locals())
                        
         self.api.db.commit()