Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/4.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiSabler <dissy@ya.ru>2014-10-20 21:02:41 +0400
committerdiSabler <dissy@ya.ru>2014-10-20 21:02:41 +0400
commit7d89c8e7a9a50e2b4d8ca5e1a40a1e1f339b9533 (patch)
tree4682627d70046d2e20c8dbe5db4fe041c8939275
parent30c79d221c64a4763c99b09b20d5f83ebccd0758 (diff)
fix: limit for gis output
-rw-r--r--plugins/gis.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/gis.py b/plugins/gis.py
index f004a17..e21e4be 100644
--- a/plugins/gis.py
+++ b/plugins/gis.py
@@ -21,6 +21,8 @@
# #
# --------------------------------------------------------------------------- #
+gis_limit = 20
+
def gweather_raw(type, jid, nick, text, fully):
def get_date(body):
tmp = get_tag_item(body,'FORECAST','day')+'.'+get_tag_item(body,'FORECAST','month')
@@ -48,10 +50,10 @@ def gweather_raw(type, jid, nick, text, fully):
if len(text.strip()):
text = text.lower()
- wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s',(text,text))
+ wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s limit %s',(text,text,gis_limit))
if not wzc:
ttext = '%%%s%%' % text
- wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s',(ttext,ttext))
+ wzc = cur_execute_fetchall('select * from gis where code ilike %s or lcity ilike %s limit %s',(ttext,ttext,gis_limit))
if not wzc and text.isdigit() and 4 <= len(text) <= 5: wzc = [(text,'','')]
if wzc:
if len(wzc) == 1: