def searchCompany(): rawSearchterm = (request.args.get('name', '')) html = HTMLHEAD unquotedTerm = urllib.unquote(rawSearchterm).upper() liketerm = Company.sqlrepr('%%%s%%' % unquotedTerm) sqlquery = "company.name LIKE %s" % liketerm html += '<h2>Company Search results</h2><h3>searching for %s</h3><ul>' % sqlquery people = Company.select(sqlquery) for thisone in people: if not thisone.hidden: html += "<li><a href='%s/company/id/%s'>%s</a></li>" %(BASEURL, thisone.recordid, thisone.name) html += '</ul>' html += HTMLTAIL return html
def get(self, rawSearchterm = u''): if rawSearchterm is u'': arguments = parse_qs(self.request.query) rawSearchterm = arguments.get('name')[0] html = HTMLHEAD unquotedTerm = urllib.unquote(rawSearchterm).upper() liketerm = Company.sqlrepr('%%%s%%' % unquotedTerm) sqlquery = "company.name LIKE %s" % liketerm html += '<h2>Company Search results</h2><h3>searching for %s</h3><ul>' % sqlquery people = Company.select(sqlquery) for thisone in people: if not thisone.hidden: html += "<li><a href='%s/company/id/%s'>%s</a></li>" %(BASEURL, thisone.recordid, thisone.name) html += '</ul>' html += HTMLTAIL self.write(html)
def get(self, rawSearchterm=u''): if rawSearchterm is u'': arguments = parse_qs(self.request.query) rawSearchterm = arguments.get('name')[0] html = HTMLHEAD unquotedTerm = urllib.unquote(rawSearchterm).upper() liketerm = Company.sqlrepr('%%%s%%' % unquotedTerm) sqlquery = "company.name LIKE %s" % liketerm html += '<h2>Company Search results</h2><h3>searching for %s</h3><ul>' % sqlquery people = Company.select(sqlquery) for thisone in people: if not thisone.hidden: html += "<li><a href='%s/company/id/%s'>%s</a></li>" % ( BASEURL, thisone.recordid, thisone.name) html += '</ul>' html += HTMLTAIL self.write(html)