def update(self, collection_name, instance):
        """ method finds Site Statistics record and update it DB representation """
        assert isinstance(instance, SiteStatistics)
        if instance.db_id:
            query = {'_id': ObjectId(instance.db_id)}
        else:
            query = {DOMAIN_NAME: instance.domain_name,
                     TIMEPERIOD: instance.timeperiod}
        self.ds.update(collection_name, query, instance)
        return instance.db_id
def update ( self , collection_name , instance ) : assert isinstance ( instance , SiteStatistics ) if instance . db_id : query = { '_id' : ObjectId ( instance . db_id ) } else : query = { DOMAIN_NAME : instance . domain_name , TIMEPERIOD : instance . timeperiod } self . ds . update ( collection_name , query , instance ) return instance . db_id
method finds Site Statistics record and update it DB representation