|
@@ -61,6 +61,12 @@ class Property:
|
|
|
class Search:
|
|
class Search:
|
|
|
"""Universal Search Criteria"""
|
|
"""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, \
|
|
# 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_acres=5, upper_acres=15, type=['farm','land','home'], lower_sqft='', upper_sqft='', \
|
|
|
# lower_bedrooms='', upper_bedrooms=''):
|
|
# lower_bedrooms='', upper_bedrooms=''):
|
|
@@ -86,19 +92,27 @@ class Search:
|
|
|
|
|
|
|
|
self.types=['land', 'farm', 'home', 'house']
|
|
self.types=['land', 'farm', 'home', 'house']
|
|
|
self.county = county
|
|
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.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:
|
|
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))
|
|
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 ##
|
|
## FOR TESTING, PRINT ALL ATTRIBUTES OF SEARCH ##
|
|
|
# print(vars(self))
|
|
# print(vars(self))
|
|
|
|
|
|
|
@@ -131,6 +145,7 @@ class MLSDATA:
|
|
|
params = [('cnty', county), \
|
|
params = [('cnty', county), \
|
|
|
('lpl', search.lower_price), ('lph', search.upper_price), \
|
|
('lpl', search.lower_price), ('lph', search.upper_price), \
|
|
|
('acresL', search.lower_acres), ('acresH', search.upper_acres), \
|
|
('acresL', search.lower_acres), ('acresH', search.upper_acres), \
|
|
|
|
|
+ ('sqftl', search.lower_sqft), ('sqfth', search.upper_sqft), \
|
|
|
('orderBy', 'b'), \
|
|
('orderBy', 'b'), \
|
|
|
('scat', '1'), \
|
|
('scat', '1'), \
|
|
|
('sdsp', 'g')]
|
|
('sdsp', 'g')]
|