Преглед на файлове

applied hotfix1. Added checktype to Search class.

Miek Stagl преди 5 години
родител
ревизия
955e3da84f
променени са 2 файла, в които са добавени 33 реда и са изтрити 9 реда
  1. 9 0
      CHANGELOG
  2. 24 9
      index.py

+ 9 - 0
CHANGELOG

@@ -11,6 +11,15 @@ Search critiera can only be modified in the index.py code by adding criteria to
 index.py broke on multiple instances of the word 'address' on page 2 of the georgiamls listings.  Added fix to
 set the address attribute to only the first instance of the word.
 
+[0.1.1] Update .1 WIP
+
+Added ConfigParser to read landsearch.conf file and gather search criteria from this file.
+FUTURE - add .conf section for results.py to aid in results report generation.
+
+applied hotfix 1
+
+Added checktype to Search class.  This ensures that the word None in landsearch.conf translates to "''" in the qurystring
+
 FUTURE GOALS
 - add .conf file
   - Search criteria

+ 24 - 9
index.py

@@ -61,6 +61,12 @@ class Property:
 class Search:
   """Universal Search Criteria"""
 
+  def checktype(self, attribute):
+    if not attribute == 'None':
+      return attribute
+    else:
+      return ''
+
 #  def __init__(self, county: list, lower_price=0, upper_price=500000, \
 #    lower_acres=5, upper_acres=15, type=['farm','land','home'], lower_sqft='', upper_sqft='', \
 #    lower_bedrooms='', upper_bedrooms=''):
@@ -86,19 +92,27 @@ class Search:
 
     self.types=['land', 'farm', 'home', 'house']
     self.county = county
-    self.lower_price = search_params.get('lower_price', 0)
-    self.upper_price = search_params.get('upper_price', 525000)
-    self.lower_acres = search_params.get('lower_acres', 5)
-    self.upper_acres = search_params.get('upper_acres', 15)
+    self.lower_price = self.checktype(search_params.get('lower_price', 0))
+    self.upper_price = self.checktype(search_params.get('upper_price', 525000))
+    self.lower_acres = self.checktype(search_params.get('lower_acres', 5))
+    self.upper_acres = self.checktype(search_params.get('upper_acres', 15))
     self.type = type			##accept list!
-    self.lower_sqft = search_params.get('lower_sqft', '')
-    self.upper_sqft = search_params.get('upper_sqft', '')
-    self.lower_bedrooms = search_params.get('lower_bedrooms', '')
-    self.upper_bedrooms = search_params.get('upper_bedrooms', '')
+    self.lower_sqft = self.checktype(search_params.get('lower_sqft', ''))
+    self.upper_sqft = self.checktype(search_params.get('upper_sqft', ''))
+    self.lower_bedrooms = self.checktype(search_params.get('lower_bedrooms', ''))
+    self.upper_bedrooms = self.checktype(search_params.get('upper_bedrooms', ''))
+#    self.lower_price = search_params.get('lower_price', 0)
+#    self.upper_price = search_params.get('upper_price', 525000)
+#    self.lower_acres = search_params.get('lower_acres', 5)
+#    self.upper_acres = search_params.get('upper_acres', 15)
+#    self.lower_sqft = search_params.get('lower_sqft', '')
+#    self.upper_sqft = search_params.get('upper_sqft', '')
+#    self.lower_bedrooms = search_params.get('lower_bedrooms', '')
+#    self.upper_bedrooms = search_params.get('upper_bedrooms', '')
 
     for property_type in self.type:
       assert property_type in self.types, ("Unknown type '" + property_type + "'. Property Type must be of type: " + str(self.types))
-
+    
 ## FOR TESTING, PRINT ALL ATTRIBUTES OF SEARCH ##
 #    print(vars(self))
 
@@ -131,6 +145,7 @@ class MLSDATA:
       params = [('cnty', county), \
         ('lpl', search.lower_price), ('lph', search.upper_price), \
         ('acresL', search.lower_acres), ('acresH', search.upper_acres), \
+        ('sqftl', search.lower_sqft), ('sqfth', search.upper_sqft), \
         ('orderBy', 'b'), \
         ('scat', '1'), \
         ('sdsp', 'g')]