- # timestamps
- def validate_date_created (self, timestamp):
- return self.validate_timestamp (timestamp)
- def validate_last_updated (self, timestamp):
- return self.validate_timestamp (timestamp)
-
+ validate_date_created = Row.validate_timestamp
+ validate_last_updated = Row.validate_timestamp
+ validate_last_contact = Row.validate_timestamp
+
+ def update_last_contact(self, commit = True):
+ """
+ Update last_contact field with current time
+ """
+
+ assert 'node_id' in self
+ 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']) )
+ self.sync(commit)
+