# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: Nodes.py,v 1.33 2007/06/08 17:59:53 tmack Exp $
+# $Id: Nodes.py,v 1.34 2007/07/12 17:55:02 tmack Exp $
#
from types import StringTypes
assert self.table_name
self.api.db.do("UPDATE %s SET last_contact = CURRENT_TIMESTAMP " % (self.table_name) + \
- " where node_id = %d" % ( self['node_id']) )
+ " 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):
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: Persons.py,v 1.36 2007/03/29 20:14:46 tmack Exp $
+# $Id: Persons.py,v 1.37 2007/06/14 16:26:01 tmack Exp $
#
from types import StringTypes
self['site_ids'].remove(site_id)
self['site_ids'].insert(0, site_id)
+ def update_last_updated(self, commit = True):
+ """
+ Update last_updated field with current time
+ """
+
+ assert 'person_id' in self
+ assert self.table_name
+
+ self.api.db.do("UPDATE %s SET last_updated = CURRENT_TIMESTAMP " % (self.table_name) + \
+ " where person_id = %d" % (self['person_id']) )
+ self.sync(commit)
+
def delete(self, commit = True):
"""
Delete existing user.
add_address = Row.add_object(Address, 'site_address')
remove_address = Row.remove_object(Address, 'site_address')
+ def update_last_updated(self, commit = True):
+ """
+ Update last_updated field with current time
+ """
+
+ assert 'site_id' in self
+ assert self.table_name
+
+ self.api.db.do("UPDATE %s SET last_updated = CURRENT_TIMESTAMP " % (self.table_name) + \
+ " where site_id = %d" % (self['site_id']) )
+ self.sync(commit)
+
def delete(self, commit = True):
"""
Delete existing site.