Commit ce03424b400dd11ff124134d1fb6278e52a20837

Authored by Macieski
1 parent 9998a1e2
Exists in master

add SoftwareList filtering

Showing 1 changed file with 11 additions and 5 deletions   Show diff stats
wscserver/view/restfulview.py
@@ -68,15 +68,21 @@ class CustomRESTfulView(RESTfulView): @@ -68,15 +68,21 @@ class CustomRESTfulView(RESTfulView):
68 property_ = collection_element.nm_property_name 68 property_ = collection_element.nm_property_name
69 property_value = collection_element.te_class_property_value 69 property_value = collection_element.te_class_property_value
70 70
71 - if class_ not in self.computer_filter:  
72 - # Filter classes 71 + if class_ == 'SoftwareList':
  72 + if computer.get(class_) is None:
  73 + computer[class_] = [ ]
  74 + elif property_value.lower().find('office') > -1:
  75 + computer[class_].append(property_value)
  76 + elif property_value.lower().find('microsoft') > -1:
  77 + computer[class_].append(property_value)
73 continue 78 continue
74 79
75 - if property_ not in self.computer_filter[class_]:  
76 - # Filter properties 80 + elif class_ not in self.computer_filter \
  81 + or property_ not in self.computer_filter[class_]:
  82 + # Filter classes and properties
77 continue 83 continue
78 84
79 - if computer.get(class_) is None: 85 + elif computer.get(class_) is None:
80 computer[class_] = { } 86 computer[class_] = { }
81 else: 87 else:
82 prefixed_property = class_ + '_' + property_ 88 prefixed_property = class_ + '_' + property_