def insert(userid, otherid): if ignoreuser.check(otherid, userid): raise WeasylError("IgnoredYou") elif ignoreuser.check(userid, otherid): raise WeasylError("YouIgnored") d.engine.execute( 'INSERT INTO watchuser (userid, otherid, settings) VALUES (%(user)s, %(other)s, %(settings)s) ' 'ON CONFLICT DO NOTHING', user=userid, other=otherid, settings=WatchSettings.from_code(d.get_config(userid)).to_code()) from weasyl import welcome welcome.followuser_remove(userid, otherid) welcome.followuser_insert(userid, otherid)
def remove(userid, otherid): d.execute("DELETE FROM watchuser WHERE (userid, otherid) = (%i, %i)", [userid, otherid]) from weasyl import welcome welcome.followuser_remove(userid, otherid)