diff options
author | AlKorgun@gmail.com <AlKorgun@gmail.com@94c44753-77e5-68b8-8764-2ca2b8acb85e> | 2011-12-06 21:39:22 +0400 |
---|---|---|
committer | AlKorgun@gmail.com <AlKorgun@gmail.com@94c44753-77e5-68b8-8764-2ca2b8acb85e> | 2011-12-06 21:39:22 +0400 |
commit | 4d8dabe576562fb6fa3ed23c3780db1cb63b16e3 (patch) | |
tree | 98c6c7ca1559f05eece8a27dd9879e2f45fa9f77 | |
parent | 6a320060b2006e3052996dba10990ef0885d1f45 (diff) |
some fixes and updates
-rw-r--r-- | expansions/allweb/code.py | 18 | ||||
-rw-r--r-- | expansions/allweb/insc.py | 3 | ||||
-rw-r--r-- | expansions/cron/code.py | 16 | ||||
-rw-r--r-- | expansions/cron/insc.py | 6 | ||||
-rw-r--r-- | expansions/info/code.py | 4 | ||||
-rw-r--r-- | expansions/interpreter/code.py | 2 | ||||
-rw-r--r-- | expansions/sheriff/code.py | 16 |
7 files changed, 35 insertions, 30 deletions
diff --git a/expansions/allweb/code.py b/expansions/allweb/code.py index eca46a6..05c530d 100644 --- a/expansions/allweb/code.py +++ b/expansions/allweb/code.py @@ -198,6 +198,8 @@ def command_kino(ltype, source, body, disp): # Msend(source[0], Top250, disp) # else: # answer = str.join(chr(10), ls) + # elif data.count("(СЗоР)"): + # answer = AllwebAnsBase[-1] # else: # answer = AllwebAnsBase[1] if isNumber(body): @@ -208,17 +210,19 @@ def command_kino(ltype, source, body, disp): answer = AllwebAnsBase[0] else: data = data.decode("cp1251") - data = get_text(data, '<p class="title">', "</div>") - if data: - data = decodeHTML(data) + relt = get_text(data, "<p class=\"title\">", "</div>") + if relt: + relt = decodeHTML(relt) ls = ["\->"] - for line in data.splitlines(): + for line in relt.splitlines(): line = line.strip() if line: if line[0].islower(): - line = "%s%s" % (line[0].upper(), line[1:]) + line = "{1}{0}".format(line[1:], line[0].upper()) ls.append(line) answer = str.join(chr(10), ls) + elif data.count("(СЗоР)"): + answer = AllwebAnsBase[-1] else: answer = AllwebAnsBase[5] else: @@ -231,7 +235,7 @@ def command_kino(ltype, source, body, disp): answer = AllwebAnsBase[0] else: data = data.decode("cp1251") - comp = compile__('<a href="http://m.kinopoisk.ru/movie/(\d+?)/">(.+?)</a>') + comp = compile__("<a href=\"http://m.kinopoisk.ru/movie/(\d+?)/\">(.+?)</a>") list = comp.findall(data) if list: Number = itypes.Number() @@ -239,6 +243,8 @@ def command_kino(ltype, source, body, disp): for Numb, Name in list: ls.append("%d) %s (#%s)" % (Number.plus(), sub_ehtmls(Name), Numb)) answer = str.join(chr(10), ls) + elif data.count("(СЗоР)"): + answer = AllwebAnsBase[-1] else: answer = AllwebAnsBase[5] else: diff --git a/expansions/allweb/insc.py b/expansions/allweb/insc.py index bd71ebc..dc5b6fc 100644 --- a/expansions/allweb/insc.py +++ b/expansions/allweb/insc.py @@ -13,7 +13,8 @@ if DefLANG in ("RU", "UA"): "Твоих запросов нет в базе.", # 2 "Не вижу твоего JID'а, поэтому не могу найти твоих запросов в базе.", # 3 "\n\n** Ещё %d результатов (командуй «гугл *»).", # 4 - "Ничего не найдено..." # 5 + "Ничего не найдено...", # 5 + "Запрос блокирован Кинопоиском." # -1 )]) else: AllwebAnsBase = ( diff --git a/expansions/cron/code.py b/expansions/cron/code.py index 4b88920..a9cebcb 100644 --- a/expansions/cron/code.py +++ b/expansions/cron/code.py @@ -1,8 +1,8 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "cron" # /code.py v.x3 -# Id: 27~2a +exp_name = "cron" # /code.py v.x4 +# Id: 27~3a # Code © (2010-2011) by WitcherGeralt [WitcherGeralt@rocketmail.com] expansion_register(exp_name) @@ -91,12 +91,12 @@ def command_cron(ltype, source, body, disp): id = int(id) if CronDesc.has_key(id): if enough_access(source[1], source[2], 7): - del CronDesc[id] + del CronDesc[id]; cdesc_save() answer = AnsBase[4] else: date, ls = CronDesc.get(id) if ls[1] == get_source(source[1], source[2]): - del CronDesc[id] + del CronDesc[id]; cdesc_save() answer = AnsBase[4] else: answer = AnsBase[10] @@ -171,8 +171,12 @@ def command_cron(ltype, source, body, disp): Te = (Te - Time) if 59 < Te <= 4147200 or enough_access(source[1], source[2], 7): repeat = (Te,) - answer = CronAnsBase[6] % time.strftime("%H:%M:%S (%d.%m.%Y)", date) - answer = add_cron(**locals()) + try: + answer = CronAnsBase[6] % time.strftime("%H:%M:%S (%d.%m.%Y)", date) + except ValueError: + answer = CronAnsBase[9] + else: + answer = add_cron(**locals()) else: answer = CronAnsBase[5] else: diff --git a/expansions/cron/insc.py b/expansions/cron/insc.py index 5be3941..a8ff2c3 100644 --- a/expansions/cron/insc.py +++ b/expansions/cron/insc.py @@ -10,7 +10,8 @@ if DefLANG in ("RU", "UA"): "Тайм-аут не может быть меньше минуты и больше 48 дней.", # 5 "Выполню в %s", # 6 "Нет запланированных заданий.", # 7 - "\n[№][ID][Команда][Deadline]\n%s" # 8 + "\n[№][ID][Команда][Deadline]\n%s", # 8 + "Дата/Время введены некорректно." # 9 )]) else: CronAnsBase = ( @@ -22,5 +23,6 @@ else: "The timeout can't be less than 60 seconds and more than 48 days.", # 5 "It will be executed at %s", # 6 "There are no tasks.", # 7 - "\n[#][ID][Command][Deadline]\n%s" # 8 + "\n[#][ID][Command][Deadline]\n%s", # 8 + "Date/Time are incorrect." # 9 )
\ No newline at end of file diff --git a/expansions/info/code.py b/expansions/info/code.py index b4e84df..2980631 100644 --- a/expansions/info/code.py +++ b/expansions/info/code.py @@ -112,10 +112,10 @@ def command_visitors(ltype, source, body, disp): Answer(AnsBase[11], ltype, source, disp) Msend(source[0], InfoAnsBase[2] % (Numb._str(), list), disp) elif Var in ("list", "лист".decode("utf-8")): - text = ", ".join(sorted(Chats[source[1]].get_nicks())) + ls = sorted(Chats[source[1]].get_nicks()) if ltype == Types[1]: Answer(AnsBase[11], ltype, source, disp) - Msend(source[0], InfoAnsBase[2] % (str(len(list)), text), disp) + Msend(source[0], InfoAnsBase[2] % (str(len(ls)), ", ".join(ls)), disp) else: list = str() Numb = itypes.Number() diff --git a/expansions/interpreter/code.py b/expansions/interpreter/code.py index e470e4e..0de5b51 100644 --- a/expansions/interpreter/code.py +++ b/expansions/interpreter/code.py @@ -25,7 +25,7 @@ def command_exec(ltype, source, body, disp): body += chr(10) answer = AnsBase[4] try: - exec UnicodeType(body) in globals() + exec(UnicodeType(body), globals()) except: answer = "%s - %s" % exc_info() else: diff --git a/expansions/sheriff/code.py b/expansions/sheriff/code.py index 95f3456..9ec580d 100644 --- a/expansions/sheriff/code.py +++ b/expansions/sheriff/code.py @@ -1,16 +1,16 @@ # coding: utf-8 # BlackSmith mark.2 -exp_name = "sheriff" # /code.py v.x4 -# Id: 15~4a +exp_name = "sheriff" # /code.py v.x5 +# Id: 15~3a # Code © (2011) by WitcherGeralt [WitcherGeralt@rocketmail.com] expansion_register(exp_name) -GoodServers = ["jabber.ru", "xmpp.ru", "jabbers.ru", "xmpps.ru", "talkonaut.com", "jabber.org", "gtalk.com", "gmail.com", "jabberon.ru", "gajim.org", "jabbrik.ru", "worldskynet.net", "veganet.org", "qip.ru", "blackfishka.ru", "ya.ru"] +GoodServers = ["jabber.ru", "xmpp.ru", "jabbers.ru", "xmpps.ru", "talkonaut.com", "jabber.org", "gtalk.com", "gmail.com", "jabberon.ru", "gajim.org", "jabbrik.ru", "worldskynet.net", "qip.ru", "blackfishka.ru", "ya.ru"] if DefLANG != "RU": - GoodServers += ["jabber.com", "xmpp.com", "jabber.uk", "jabberworld.net"] + GoodServers += ["jabber.com", "xmpp.com", "jabber.uk", "jabber.co.uk", "jabberworld.net"] LawsFile = "laws.db" @@ -517,14 +517,6 @@ def Security_01si(conf): Name = chat_file(conf, LawsFile) if initialize_file(Name, str(ChatsAttrs[conf]["laws"])): ChatsAttrs[conf]["laws"] = eval(get_file(Name)) - if not ChatsAttrs[conf]["laws"].has_key("list"): - ChatsAttrs[conf]["laws"]["sparta"] = False - ChatsAttrs[conf]["laws"]["list"] = [] - cat_file(Name, str(ChatsAttrs[conf]["laws"])) - if ChatsAttrs[conf]["laws"].has_key("avipe"): - Awipe = ChatsAttrs[conf]["laws"].pop("avipe") - ChatsAttrs[conf]["laws"]["awipe"] = Awipe - cat_file(Name, str(ChatsAttrs[conf]["laws"])) def Security_04si(conf): del Federal_Jail[conf] |