From 8314a05a1ac595397d42de55f45ba17b9745b3c5 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Wed, 30 Jun 2010 18:10:59 +0100 Subject: [PATCH] Fix uninitialized variable (mult) problem --- src/calibre/library/caches.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index d68c81931f..6716c1c491 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -343,9 +343,11 @@ class ResultCache(SearchQueryParser): if len(query) > 1: mult = query[-1:].lower() - if mult in ['k', 'm', 'g']: + mult = {'k':1024.,'m': 1024.**2, 'g': 1024.**3}.get(mult, 1.0) + if mult != 1.0: query = query[:-1] - mult = {'k':1024., 'm': 1024.*1024, 'g': 1024.*1024*1024}[mult] + else: + mult = 1.0 try: q = cast(query) * mult except: