[pybot-commits] CVS: pybot/pybot/modules infopack.py,1.10,1.11
Brought to you by:
niemeyer
From: Gustavo N. <nie...@us...> - 2003-08-27 17:24:03
|
Update of /cvsroot/pybot/pybot/pybot/modules In directory sc8-pr-cvs1:/tmp/cvs-serv26166/pybot/modules Modified Files: infopack.py Log Message: Protected infopack search with permissions as well. Index: infopack.py =================================================================== RCS file: /cvsroot/pybot/pybot/pybot/modules/infopack.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** infopack.py 27 Aug 2003 17:08:14 -0000 1.10 --- infopack.py 27 Aug 2003 17:23:56 -0000 1.11 *************** *** 420,451 **** [".", "!"]) return 0 ! try: ! pattern = re.compile(regexp, re.I) ! except re.error: ! msg.answer("%:", "Invalid pattern", [".", "!"]) ! return 0 ! results = pack.search(pattern) ! reslen = len(results) ! if not results: ! msg.answer("%:", ["Pattern not found", ! "Couldn't find anything with that pattern", ! "Nothing found"], [".", "!"]) ! elif reslen > MAXSEARCHRESULTS: ! msg.answer("%:", ["Found too many entries", ! "There are many entries like this", ! "There are many matches"], ! ", here are the first %d:"%MAXSEARCHRESULTS) ! elif reslen > 1: ! msg.answer("%:", ["Found %d entries:" % reslen, ! "Found %d matches:" % reslen]) else: ! msg.answer("%:", ["Found one entry:", ! "Found one match:"]) ! n = 0 ! for result in results: ! msg.answer("-", result) ! n += 1 ! if n == MAXSEARCHRESULTS: ! break return 0 --- 420,457 ---- [".", "!"]) return 0 ! if mm.hasperm(msg, "infopack", name): ! try: ! pattern = re.compile(regexp, re.I) ! except re.error: ! msg.answer("%:", "Invalid pattern", [".", "!"]) ! return 0 ! results = pack.search(pattern) ! reslen = len(results) ! if not results: ! msg.answer("%:", ["Pattern not found", ! "Couldn't find anything with that pattern", ! "Nothing found"], [".", "!"]) ! elif reslen > MAXSEARCHRESULTS: ! msg.answer("%:", ["Found too many entries", ! "There are many entries like this", ! "There are many matches"], ! ", here are the first %d:"%MAXSEARCHRESULTS) ! elif reslen > 1: ! msg.answer("%:", ["Found %d entries:" % reslen, ! "Found %d matches:" % reslen]) ! else: ! msg.answer("%:", ["Found one entry:", ! "Found one match:"]) ! n = 0 ! for result in results: ! msg.answer("-", result) ! n += 1 ! if n == MAXSEARCHRESULTS: ! break else: ! msg.answer("%:", ["You're not allowed to search on " ! "this infopack", ! "You can't search on this infopack"], ! [".", "!"]) return 0 |