we lost 'update_last_updated' method somehow. Added it back in
authorTony Mack <tmack@cs.princeton.edu>
Mon, 22 Oct 2007 18:19:35 +0000 (18:19 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Mon, 22 Oct 2007 18:19:35 +0000 (18:19 +0000)
PLC/Nodes.py

index 73ce2a0..1475ca2 100644 (file)
@@ -111,6 +111,19 @@ class Node(Row):
                       " where node_id = %d" % ( self['node_id']) )
        self.sync(commit)
 
+
+    def update_last_updated(self, commit = True):
+        """
+        Update last_updated field with current time
+        """
+
+        assert 'node_id' in self
+        assert self.table_name
+
+        self.api.db.do("UPDATE %s SET last_updated = CURRENT_TIMESTAMP " % (self.table_name) + \
+                       " where node_id = %d" % (self['node_id']) )
+        self.sync(commit)
+
     def delete(self, commit = True):
         """
         Delete existing node.