def get_filter_terms(self): """Unpacks the filter terms from a request.""" terms = {} request = self.request filterable = lambda k: k.startswith('cat') and request[k] != '' category_keys = (k for k in request.keys() if filterable(k)) for key in category_keys: text = request[key].decode('utf-8') terms[key] = remove_count(text) return terms
def filter_url(self, category, value): base = self.context.absolute_url() base += '?filter=true&%s=%s' % (category, utils.remove_count(value)) return base
def remove_count(self, text): return utils.remove_count(text)