示例#1
0
 def post(self, url_id):
     eid = int(url_id)
     entity = db_access.update_entity(eid, status='assigned')
     if entity:
         self.outputEntity(entity)
     else:
         self.outputError("Cannot reset entry status.")
示例#2
0
 def post(self, url_id):
     eid = int(url_id)
     entry = getRequestEntry(self.request)
     entity = db_access.update_entity(eid, 
                                  entry['url'],
                                  entry['regex'],
                                  entry['phone'])
     if entity:
         self.outputEntity(entity)
     else:
         self.outputError("Cannot update entry.")
示例#3
0
def do_job(job_info):
    """Do job logic.
    
    :return updated job info: dict, no matter the job failed or finished or
    still assigned.
    """
    result = url_content_search(job_info["regex"], job_info["url"])
    if result == constant.FINISHED:
        if not smsgateway.SMSGateway().send(job_info["phone"], constant.TEXT):
            result = constant.FAILED
    return db_access.update_entity(job_info["id"], status=result, mtime=datetime.datetime.now())