merge from Trunk
authorTony Mack <tmack@cs.princeton.edu>
Mon, 22 Oct 2007 18:50:51 +0000 (18:50 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Mon, 22 Oct 2007 18:50:51 +0000 (18:50 +0000)
PLC/Nodes.py

index 7b43641..1475ca2 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Nodes.py,v 1.36 2007/09/12 17:52:27 tmack Exp $
+# $Id: Nodes.py 800 2007-08-30 03:49:35Z thierry $
 #
 
 from types import StringTypes
@@ -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.