Exemplo n.º 1
0
 def get(self):
     Gadget = self.request.get('Gadget')
     logging.debug("Gadget: %s" % Gadget)
     memtoken = "VendorPage"
     message = memcache.get(memtoken)
     if message is None:
         message = ''
         query = VendorInfo.gql("WHERE public=1 ORDER BY agerating ASC, parcel ASC, lastupdate ASC")
         if query.count()==0:
             message = '<b>Currently no vendors are listed!</b>'
         else:
             message = '<table class="sortable" border=\"1\">'
             message += '<tr><th>Row</th><th>Parcel</th><th>AgeRating</th><th>SLURL</th></tr><br />\n'
             content = []
             locList = []
             for record in query:
                 locStamp = '%s|%s' % (record.parcel, record.sim)
                 if locStamp not in locList:
                     locList += [locStamp]
                     content += ['<td>%s</td><td>%s</td><td><a target="_blank" href="%s">%s</a></td>\n' % (record.parcel, record.agerating, record.slurl, record.slurl)]
             for i in range(0,len(content)):
                 message += '<tr><td>%d</td>%s' % (i+1, content[i])
             message += "</table>"
         memcache.set(memtoken, message)
     if Gadget=="1":
         logging.debug("Output to Gadget")
         self.response.out.write((head_gadget % 'OpenCollar Vendor Locations') + message + end)
     else:
         logging.debug("Output to page")
         self.response.out.write((head % 'OpenCollar Vendor Locations') + message + end)
Exemplo n.º 2
0
 def get(self):
     t=int(time.time()) - VendorRemoveTimeout;
     logging.info('CRON CleanVendors: Removing vendors older than %d' % t)
     query = VendorInfo.gql("WHERE lastupdate < :1",  t)
     for record in query:
         logging.info('CRON: Vendor info for %s at %s outdated, removing it' % (record.vkey, record.slurl))
         record.delete()
     memcache.delete(VendorPageToken)
     logging.info('CRON CleanVendors: Finished')
Exemplo n.º 3
0
 def get(self):
     t = int(time.time()) - VendorRemoveTimeout
     logging.info('CRON CleanVendors: Removing vendors older than %d' % t)
     query = VendorInfo.gql("WHERE lastupdate < :1", t)
     for record in query:
         logging.info(
             'CRON: Vendor info for %s at %s outdated, removing it' %
             (record.vkey, record.slurl))
         record.delete()
     memcache.delete(VendorPageToken)
     logging.info('CRON CleanVendors: Finished')