Beispiel #1
0
    def POST(self):
        email = web.input(email=None).email
        pidlist = model.get_pid_by_email(email)
        pids = {}
        for itr in pidlist:
            pids[itr.pid] = True
        sublist = model.get_pattern()
        subs = []
        for pat in sublist:
            if pids.get(pat.pid):
                subs.append({"name": pat.name,
                             "pattern": pat.pattern,
                             "pid": pat.pid,
                             "cid": pat.cid,
                             "checked": " checked "})
            else:
                subs.append({"name": pat.name,
                             "pattern": pat.pattern,
                             "pid": pat.pid,
                             "cid": pat.cid,
                             "checked": ""})

        category = model.get_category()

        return snippet.sublist(category, subs)
Beispiel #2
0
 def patlist(self):
     patterns = [{"name": pat.name,
                  "pattern": pat.pattern,
                  "pid": pat.pid,
                  "cid": pat.cid}
                 for pat in model.get_pattern()]
     return snippet.patlist(model.get_category(), patterns)