def updatetask(tid): lid = model.get_lid_from_tid(tid) lname = model.getlname(lid) model.update_task(tid) #todo.complete = not todo.complete myurl = '/tasks?list=' + lname #print(myurl) return redirect(myurl)
def get(self): owner = self.request.get('owner') task_title = self.request.get('task_title') requestee = self.request.get('requestee') status = self.request.get('status') rating = self.request.get('rating') model.update_task(owner, task_title, requestee, status) if rating: model.update_rating(owner, rating)
def POST(self, task): data = web.webapi.data() editTags = [int(i.split('=')[1]) for i in data.split('&') if i.split('=')[0] == 'Tags'] EditTaskForm = self.EditTaskForm() if EditTaskForm.validates() and not EditTaskForm.d.Cancel: model.update_task(task, EditTaskForm, editTags) raise web.seeother(path + '/')
def update(): if request.method == 'POST': id_of_task = request.form.get('id') person = request.form['name'] task = request.form['task'] day = request.form['day'] model.update_task(id_of_task, person, task, day) flash("Your Task is updated :)") return redirect(url_for('home'))
def update_task(tid): if request.method == 'POST': task = request.form['task'] deadline = request.form['deadline'] completion = request.form['completion'] status = request.form['status'] g.user = session['username'] #userID = model.getUserId(g.user) model.update_task(tid, task, deadline, completion, status) return redirect(url_for('home')) else: #tasktext = 'this is the text' print(model.get_tasktext(tid)) return render_template('modifytask.html', text=model.get_tasktext(tid))
def run(self): while True: doc = model.get_task_to_process() if doc is None: time.sleep(1) else: try: #log selected document web.debug(doc) #ensure that tmp direcory exist if not os.path.exists('/tmp/converterdir'): os.makedirs('/tmp/converterdir') #check if document need to been converted interim_path = '/tmp/converterdir/test2.pdf' if re.search(r"\.pdf$", doc.srcname, re.IGNORECASE | re.MULTILINE) is None: converter = DocumentConverter() converter.convert(doc.srcname, interim_path) #wait for converter closes time.sleep(1) else: #call pdftk to atach original pdf to new pdf without signature #subprocess.call("/opt/zimbra/bin/pdftk "+ doc.srcname +" cat '"+doc.srcname +"' output "+interim_path, shell=True, stdout=self.flog) interim_path = doc.srcname web.debug(interim_path) #call pdftk to atach original subprocess.call("/opt/zimbra/bin/pdftk " + interim_path + " attach_files '" + doc.srcname + "' output /tmp/converterdir/test3.pdf", shell=True, stdout=self.flog) #sign document with Private Key from key.properties d = datetime.today() unic_file_name = d.strftime('%m_%d_%H_%M_%S') subprocess.call( "java -jar /opt/zimbra/bin/signapp/signApp.jar /tmp/converterdir/test3.pdf /tmp/converterdir/" + unic_file_name + ".pdf /opt/zimbra/bin/signapp/key.properties", shell=True, stdout=self.flog) #mark document as ready model.update_task( doc.idtask, 10, '/tmp/converterdir/' + unic_file_name + '.pdf') except DocumentConversionException, exception: model.update_task(doc.idtask, -1) web.debug(datetime.today().strftime('%y-%m-%d %H:%M:%S') + "ERROR! " + str(exception)) except ErrorCodeIOException, exception: model.update_task(doc.idtask, -1) web.debug(datetime.today().strftime('%y-%m-%d %H:%M:%S') + "ERROR! ErrorCodeIOException %d" % exception.ErrCode) except Exception, exception: model.update_task(doc.idtask, -1) web.debug(datetime.today().strftime('%y-%m-%d %H:%M:%S') + " unexpected error! - " + str(exception))