Edit a note, given its abbreviated hash, which must be unique
        across both visible and trashed notes. (It is permitted to edit
        notes in the trash.)

def edit(self, hash=""):
        '''
        Edit a note, given its abbreviated hash, which must be unique
        across both visible and trashed notes. (It is permitted to edit
        notes in the trash.)
        '''
        if not len(hash):
            exit(0)
        self.fyi("nota.edit() has hash: %s" % hash)
        ## do not use find_by_hash() because can be in hash or not.
        rows = self.cur.execute("SELECT noteId, hash FROM note;").fetchall()
        hash_len = len(hash)
        noteIds = []
        for r in rows:
            if r[1][0:hash_len] == hash:
                noteIds.append((r[0],))
        if not len(noteIds):
            self.error("no active notes match abbreviated hash '%s'" % hash)
        if 1 != len(noteIds):
            self.error("cannot edit %d notes at once; try adding more letters to the hash code" % len(noteIds))
        old = self.find_by_hash(hash)
        if 1 != len(old):
            self.error("cannot edit %d notes at once; try adding more letters to the hash code" % len(old))
        old = old[0]
        keywords = []
        keywords.extend(self.get_keywords(old['noteId']))
        ee = self.editor_entry(title=old['title'], keywords=keywords, content=old['content'],
                attachments='', book=old['book'], due=old['due'])
        noteId = int(old["noteId"])
        try:
            self.cur.execute("UPDATE note SET title = (?) WHERE noteId = ?;", (ee["title"], noteId))
        except:
            self.error("cannot do: UPDATE note SET title = (%s) WHERE noteId = %s;" % (ee["title"], noteId))
        try:
            self.cur.execute("UPDATE note SET content = (?) WHERE noteId = ?;", (ee["content"], noteId))
        except:
            self.error("cannot do: UPDATE note SET content = (%s) WHERE noteId = %s;" % (ee["content"], noteId))
        try:
            self.cur.execute("UPDATE note SET book = (?) WHERE noteId = ?;", (ee["book"], noteId))
        except:
            self.error("cannot do: UPDATE note SET book = (%s) WHERE noteId = %s;" % (ee["book"], noteId))
        self.keyword_hookup(noteId, ee["keywords"])
        if ee["due"] and ee["due"] != "None":
            try:
                due = self.interpret_time(ee["due"])[0]
                self.cur.execute("UPDATE note SET due=(?) WHERE noteId=?;", (due, noteId))
            except:
                self.error("cannot update the 'due' date")
        self.con.commit()
        return noteId