コード例 #1
0
ファイル: bytemailgui.py プロジェクト: ByteMail/ByteMail
def addressbook_():
    if request.method == "POST":
        name = request.form['name']
        address = request.form['addr']
        addressbook.add_entry(name, address)
        delete = request.form.getlist("delete")
        if delete:
            for x in delete:
                address_delete(x)
        return redirect("/addressbook/")
    try:
        addr_ = []
        addresses = addressbook.addresses().replace("\t", '').split("\n")
        for x in addresses:
            try:
                if x != '':
                    x = x.split()
                    name = x[0]
                    addre = x[1]
                    addr_.append({"name":name, "addr":addre})
            except IndexError:
                continue
        addresses = addr_
        return render_template("addressbook.html", addresses=addresses, num=str(len(check())), addr=addr)
    except Exception, error:
        return render_template("addressbook.html", num=str(len(check())), addr=addr)
コード例 #2
0
ファイル: bytemail.py プロジェクト: ByteMail/ByteMail
 def do_addresses(self, line):
     self.lastcmd = ""
     print addressbook.addresses()