예제 #1
0
    def commit(self):
        ''' commit search results '''
        self.last_commit = datetime.now()

        foutname = '%(id)s_%(itemid)s_%(datetime)s' % {'id':self.id,
                                                       'itemid':self.supplier_PID,
                                                       'datetime':self.last_commit.strftime('%y_%m_%d_%H')}
        #folder = 'product_availbility/doc/commit/%s' % self.id
        
        folder = SEARCH_STORAGE
        dump_data(foutname,search_results,folder=folder)     
        self.save()
예제 #2
0
 def dump_latest(self,results):
     
     # load latest file
     try:
         total_results = self.load_latest()
     except:
         total_results = {}
     
     time_stamp = datetime.now()
     # cleanup the results
     for item in results:  # avail results is a list of dictionary
         item['last_update'] = time_stamp.strftime("%A, %d. %B %Y %I:%M%p")
         total_results.update({item['id']:item})
     
     
     folder = SEARCH_STORAGE
     foutname = '%s_latest' %(self.id)
     dump_data(foutname,total_results,folder=folder)
     
     #update timestamp
     self.last_commit = datetime.now()
     self.save()