[pybot-commits] CVS: pybot/pybot/modules remoteinfo.py,1.8,1.9
Brought to you by:
niemeyer
From: Gustavo N. <nie...@us...> - 2003-08-27 17:52:40
|
Update of /cvsroot/pybot/pybot/pybot/modules In directory sc8-pr-cvs1:/tmp/cvs-serv30148/pybot/modules Modified Files: remoteinfo.py Log Message: Removed remaining code handling old "allow" system in remoteinfo. Index: remoteinfo.py =================================================================== RCS file: /cvsroot/pybot/pybot/pybot/modules/remoteinfo.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** remoteinfo.py 27 Aug 2003 17:08:14 -0000 1.8 --- remoteinfo.py 27 Aug 2003 17:52:30 -0000 1.9 *************** *** 85,90 **** class RemoteInfo: def __init__(self): ! db.table("remoteinfo", "id integer primary key, url, regex, interval", ! constraints="unique (url)") self.info = options.get("RemoteInfo.info", {}) self.info_lock = options.get("RemoteInfo.info_lock", {}) --- 85,89 ---- class RemoteInfo: def __init__(self): ! db.table("remoteinfo", "url unique, regex, interval") self.info = options.get("RemoteInfo.info", {}) self.info_lock = options.get("RemoteInfo.info_lock", {}) *************** *** 202,226 **** self.unlock_url(url) - def get_allowed_urls(self, servername, target): - cursor = db.cursor() - cursor.execute("select remoteinfo.url,remoteinfoallow.* " - "from remoteinfoallow left join remoteinfo " - "on remoteinfo.id=remoteinfoallow.infoid") - # [0] url, [1] infoid, [2] servername, [3] target - allowed = {} - for row in cursor.fetchall(): - if (not row[2] or row[2] == servername) and \ - (not row[3] or row[3] == target): - allowed[row[0]] = 1 - return allowed.keys() - def message_remoteinfo(self, msg): ret = None - #allowed = self.get_allowed_urls(msg.server.servername, - # msg.answertarget) allowed = mm.permparams(msg, "remoteinfo") for url, info in self.info.items(): - #if not mm.hasperm(msg, "remoteinfo", url): - # continue if url not in allowed: continue --- 201,208 ---- *************** *** 366,371 **** m = self.re3.match(msg.line) if m: ! if mm.hasperm(msg, "remoteinfo") or \ ! mm.hasperm(msg, "reloadremoteinfo"): cursor = db.cursor() cursor.execute("select * from remoteinfo") --- 348,352 ---- m = self.re3.match(msg.line) if m: ! if mm.hasperm(msg, "remoteinfoadmin"): cursor = db.cursor() cursor.execute("select * from remoteinfo") *************** *** 385,416 **** if interval > 1: unit += "s" - cursor.execute("select * from remoteinfoallow where " - "infoid=%s", (row.id,)) - if cursor.rowcount: - allowed = "(for " - first = 1 - for _row in cursor.fetchall(): - if not first: - allowed += ", " - if _row.servername and _row.target: - allowed += "%s at %s" % (_row.target, - _row.servername) - elif _row.servername: - allowed += "server %s" % _row.servername - elif _row.target: - allowed += _row.target - else: - allowed = "(for everybody)" - break - first = 0 - else: - allowed += ")" - else: - allowed = "(for nobody)" regex = row.regex if regex and regex[0] == "\\": regex = "\\"+regex msg.answer("-", row.url, "each", str(interval), unit, ! "with regex", regex, allowed) else: msg.answer("%:", "No remote info urls are currently " --- 366,374 ---- if interval > 1: unit += "s" regex = row.regex if regex and regex[0] == "\\": regex = "\\"+regex msg.answer("-", row.url, "each", str(interval), unit, ! "with regex", regex) else: msg.answer("%:", "No remote info urls are currently " |