Browse Source

min weight

David 10 years atrás
parent
commit
47cff122d7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      db.py

+ 3 - 2
db.py

@@ -62,9 +62,10 @@ class db():
             #    {"url": {"$regex":".*%s.*"%filter["site"], "$options": 'i' }}
             #    ]
 
-        if "minweight" in filter and filter["minweight"] != "":
-            db_filter["weight"]={"$gt":int(filter["minweight"])}
+        if "minweight" not in filter or not isinstance(filter["minweight"],int):
+            filter["minweight"]=1
 
+        db_filter["weight"]={"$gt":int(filter["minweight"])}
         if "keyword" in filter and len(filter["keyword"]) >0:
             db_filter["kw"]={"$all": filter["keyword"]}