def note(cls, con, sbjct, state, objct=None, ts=None, text="", html="", log=None): rv = cls.touch(con, sbjct, state, objct, ts, log=log) op = Insertion(cls.tables["note"], data={ "touch": rv, "text": text, "html": html, }) if log is not None: log.debug(op.sql) cur = op.run(con) rv = cur.lastrowid cur.close() return rv
def touch(cls, con, sbjct, state, objct=None, ts=None, text="", html="", log=None): refs = list(cls.reference(con, [sbjct, state, objct])) op = Insertion(cls.tables["touch"], data={ "ts": ts or datetime.datetime.utcnow(), "sbjct": refs[0]["id"], "state": refs[1]["id"], "objct": refs[2] and refs[2]["id"] }) if log is not None: log.debug(op.sql) cur = op.run(con) rv = cur.lastrowid cur.close() return rv