def trash(): dao = MailDao() mails = dao.selectTrash(session['userid']) mails.reverse() mail = dao.selectById(request.form.get('ident', None)) length = dao.numInbox(session['userid']) if ('log' in request.form): session['userid'] = None return redirect(url_for('login')) elif ('delete' in request.form): deleteMailTrash(request.form['delete']) return redirect(url_for('trash')) elif ('reply' in request.form): session['reply'] = request.form['reply'] return redirect(url_for('new')) return render_template('trash.html', **locals())
def outbox(): ident = request.form.get('ident', None) if (session['mail'] is not None): ident = session['mail'] session['mail'] = None dao = MailDao() mails = dao.selectOutbox(session['userid']) mails.reverse() mail = dao.selectById(ident) length = dao.numInbox(session['userid']) if ('log' in request.form): session['userid'] = None return redirect(url_for('login')) elif ('delete' in request.form): deleteMailOut(request.form['delete']) return redirect(url_for('outbox')) return render_template('outbox.html', **locals())
def deleteMailTrash(ident): dao = MailDao() mail = dao.selectById(ident) mail.deletedInbox = 2 dao.update(mail)
def deleteMailOut(ident): dao = MailDao() mail = dao.selectById(ident) mail.deletedOutbox = 1 dao.update(mail)
def deleteMailIn(ident): dao = MailDao() mail = dao.selectById(ident) mail.deletedInbox = 1 dao.update(mail)