Пример #1
0
def searchPerson():
    rawSearchterm = (request.args.get('name', ''))
    html = HTMLHEAD
    unquotedTerm = urllib.unquote(rawSearchterm).upper()
    liketerm = Person.sqlrepr('%%%s%%' % unquotedTerm)
    sqlquery = "person.name LIKE %s" % liketerm
    html += '<h2>Search results</h2><h3>searching for %s</h3><ul>' % sqlquery
    people = Person.select(sqlquery)
    for thisone in people:
        if not thisone.hidden:
            html += "<li><a href='%s/person/%s'>%s</a></li>" %(BASEURL, escape_name(thisone.name), thisone.name)
    html += '</ul>'
    html += HTMLTAIL
    return html
Пример #2
0
 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 = Person.sqlrepr('%%%s%%' % unquotedTerm)
     sqlquery = "person.name LIKE %s" % liketerm
     html += '<h2>Search results</h2><h3>searching for %s</h3><ul>' % sqlquery
     people = Person.select(sqlquery)
     for thisone in people:
         if not thisone.hidden:
             html += "<li><a href='%s/person/%s'>%s</a></li>" %(BASEURL, escape_name(thisone.name), thisone.name)
     html += '</ul>'
     html += HTMLTAIL
     self.write(html)
Пример #3
0
def personPage(rawname):
    html = ''
    name = urllib.unquote(rawname).upper()
    try:
        record = Person.byName(name)
    except SQLObjectNotFound:
        html += 'could not find %s' % name
        self.write(html)
        return
    if record.hidden:
        self.quitWithMsg("Details of this person are not currently available")
        return
    subscriberships = record.subscriberships
    directorships = record.directorships
    agencies = record.agencys
    html += '<h1>%s</h1>' % name
    html += '<h2>Director</h2><ul>' 
    for company in directorships:
        if not company.hidden:
            html += '<li><a href="%s/company/id/%s">%s</a></li>' % (BASEURL, company.recordid, company.name)
    html += '</ul>'
    html += '<h2>Subscriber</h2><ul>' 
    for company in subscriberships:
        if not company.hidden:
            html += '<li><a href="%s/company/id/%s">%s</a></li>' % (BASEURL, company.recordid, company.name)
    html += '</ul>'
    html += '<h2>Agent</h2><ul>' 
    for company in agencies:
        if not company.hidden:
            html += '<li><a href="%s/company/id/%s">%s</a></li>' % (BASEURL, company.recordid, company.name)
    html += '</ul>'
    return html
Пример #4
0
 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 = Person.sqlrepr('%%%s%%' % unquotedTerm)
     sqlquery = "person.name LIKE %s" % liketerm
     html += '<h2>Search results</h2><h3>searching for %s</h3><ul>' % sqlquery
     people = Person.select(sqlquery)
     for thisone in people:
         if not thisone.hidden:
             html += "<li><a href='%s/person/%s'>%s</a></li>" % (
                 BASEURL, escape_name(thisone.name), thisone.name)
     html += '</ul>'
     html += HTMLTAIL
     self.write(html)