def showSubCategory(cat, group): if checkGroup(cat, group): print "%s - %s"%(cat.getName(), UHCategoryDisplay.getURL(cat)) if cat.hasSubcategories(): for subcat in cat.getSubCategoryList(): showSubCategory(subcat,group) else: for conference in cat.getConferenceList(): if checkGroup(conference, group): print "%s - %s"%(conference.getName(), UHConferenceDisplay.getURL(conference))
def _process(self): matches = IndexesHolder().getIndex('categoryName').search(request.args['term']) results = [] for category_id in matches[:7]: try: categ = CategoryManager().getById(category_id) except KeyError: continue results.append({ 'title': to_unicode(categ.getTitle()), 'path': map(to_unicode, categ.getCategoryPathTitles()[1:-1]), 'url': unicode(UHCategoryDisplay.getURL(categ)) }) return jsonify(success=True, results=results, count=len(matches))