Exemplo n.º 1
0
    def GET(self, state, format=None):
        try:
            state = schema.State.where(code=state.upper())[0]
        except IndexError:
            raise web.notfound

        out = apipublish.publish([state], format)
        if out: return out

        return render.state(state)
Exemplo n.º 2
0
    def GET(self, state, format=None):
        try:
            state = schema.State.where(code=state.upper())[0]
            state.senators = db.select('curr_politician', where='district_id = $state.code', vars=locals())
        except IndexError:
            raise web.notfound()

        out = apipublish.publish([state], format)
        if out: return out

        return render.state(state)
Exemplo n.º 3
0
    def GET(self, state, format=None):
        try:
            state = schema.State.where(code=state.upper())[0]
            state.senators = db.select('curr_politician',
                                       where='district_id = $state.code',
                                       vars=locals())
        except IndexError:
            raise web.notfound()

        out = apipublish.publish([state], format)
        if out: return out

        return render.state(state)
Exemplo n.º 4
0
 def GET(self, state, format=None):
     state = state.upper()
     try:
         state = db.select('state', where='code=$state', vars=locals())[0]
     except IndexError:
         raise web.notfound
     
     out = apipublish.publish({
       'uri': 'http://watchdog.net/us/' + state.code.lower(),
       'type': 'State',
       'wikipedia': apipublish.URI,
       'code fipscode name status': apipublish.identity,
     }, [state], format)
     if out is not False:
         return out
     
     districts = db.select('district',
                           where='state=$state.code',
                           order='district asc',
                           vars=locals())
     senators = db.select('politician',where='district=$state.code',vars=locals())
     
     return render.state(state, districts.list(),senators.list())