drime

French rhyme dictionary with web and CLI interface
git clone https://a3nm.net/git/drime/
Log | Files | Refs | README

commit 8c82ee9e591bb8dcbda275a32e964d197e66c2d8
parent 10f39e742c9e591b16af00279a300e272f1f4da2
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 27 Dec 2011 01:06:43 +0100

fixes

Diffstat:
query.py | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/query.py b/query.py @@ -45,18 +45,21 @@ def query(q, nsyl='', gender=True, page=0): maxsyll = None else: syll = nsyl.split('-') - if syll[-1][-1] == '+': + if len(syll[-1]) > 0 and syll[-1][-1] == '+': syll[-1] = syll[-1][:-1] elide = True else: elide = False if len(syll) > 2: raise BadValues - minsyll = int(syll[0]) - if len(syll) == 1: - maxsyll = int(syll[0]) - else: - maxsyll = int(syll[1]) + try: + minsyll = int(syll[0]) + if len(syll) == 1: + maxsyll = int(syll[0]) + else: + maxsyll = int(syll[1]) + except ValueError: + raise BadValues return do_query(word, phon, minsyll, maxsyll, elide, gender, page*PAGESIZE, PAGESIZE)