this is for when the db accidentally has duplicates, as we found after
a big RefreshPeer hiccup
cleaning up manually through SQL in similar cases is discouraged
# Mark as deleted
self['deleted'] = True
- self.sync(commit)
+ # don't validate, so duplicates can be consistently removed
+ self.sync(commit, validate=False)
class Persons(Table):
"""
y = self.db_fields(y)
return dict.__eq__(x, y)
- def sync(self, commit = True, insert = None):
+ # validate becomes optional on sept. 2010
+ # we find it useful to use DeletePerson on duplicated entries
+ def sync(self, commit = True, insert = None, validate=True):
"""
Flush changes back to the database.
"""
# Validate all specified fields
- self.validate()
+ if validate: self.validate()
# Filter out fields that cannot be set or updated directly
db_fields = self.db_fields()