コード例 #1
0
ファイル: plugin.py プロジェクト: nyuhuhuu/trachacks
 def watch(self, realm, resid, user, lastvisit=0, db=None):
     """Adds given resources to watchlist.
        They must not be watched already."""
     db = db or self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.executemany("""
         INSERT
         INTO watchlist (wluser, realm, resid, lastvisit)
         VALUES (%s,%s,%s,%s)
     """, [(user, realm, res, lastvisit) for res in ensure_iter(resid)])
コード例 #2
0
ファイル: plugin.py プロジェクト: gaod/trac-watchlistplugin
 def watch(self, realm, resid, user, lastvisit=0, db=None):
     """Adds given resources to watchlist.
        They must not be watched already."""
     db = db or self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.executemany("""
         INSERT
         INTO watchlist (wluser, realm, resid, lastvisit)
         VALUES (%s,%s,%s,%s)
     """, [(user, realm, res, lastvisit) for res in ensure_iter(resid)])
コード例 #3
0
ファイル: plugin.py プロジェクト: nyuhuhuu/trachacks
 def unwatch(self, realm, resid, user, db=None):
     db = db or self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.log = self.log
     self.log.debug("resid = " + unicode(resid))
     reses = list(ensure_iter(resid))
     cursor.execute("""
         DELETE
         FROM watchlist
         WHERE wluser=%s AND realm=%s AND
                 resid IN (
     """ + ",".join(("%s",) * len(reses)) + ")",
     [user,realm] + reses)
コード例 #4
0
 def unwatch(self, realm, resid, user, db=None):
     db = db or self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.log = self.log
     self.log.debug("resid = " + unicode(resid))
     reses = list(ensure_iter(resid))
     cursor.execute(
         """
         DELETE
         FROM watchlist
         WHERE wluser=%s AND realm=%s AND
                 resid IN (
     """ + ",".join(("%s", ) * len(reses)) + ")", [user, realm] + reses)