Exemplo n.º 1
0
 def get(self, leg_id):
     params = self.check_login('legislators/' + leg_id)
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         params['legislator'] = getLegislatorByID(leg_id)
         #params['legislator'].twitter=['','']
         districts = getAllDistricts()
         if params['legislator'].active:
             params['bills'] = getBillsbyAuthor(leg_id)
             for d in districts:
                 if d['name'] == params['legislator'].district:
                     params['boundary_id'] = d['boundary_id']
         else:
             params['bills'] = getBillsbyAuthor(leg_id, 'all')
         self.render(legislator_info_page, **params)
Exemplo n.º 2
0
 def get(self,leg_id):
     params=self.check_login('legislators/'+leg_id)
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         params['legislator']=getLegislatorByID(leg_id)
         #params['legislator'].twitter=['','']
         districts=getAllDistricts()
         if params['legislator'].active:
             params['bills']=getBillsbyAuthor(leg_id)
             for d in districts:
                 if d['name']==params['legislator'].district:
                     params['boundary_id']=d['boundary_id']
         else:
             params['bills']=getBillsbyAuthor(leg_id,'all')
         self.render(legislator_info_page, **params)
Exemplo n.º 3
0
    def get(self):
        params = self.check_login('/bills')
        if 'loggedin_user' not in params:
            self.redirect('/signup')
        else:
            keyword = self.request.get("k")
            leg = self.request.get("l")
            if keyword:
                sort = self.request.get("s")
                s = getSortValue(sort)
                params['keyword'] = keyword
                params['bills'] = getBillsbyKeyword(keyword, s)
                self.render(bills_search_results_page, **params)
            elif leg:
                params['goodstring'] = 'no'
                legs = getAllLegislators()
                for l in legs:
                    if leg == l.name:
                        leg = l.leg_id
                        sort = self.request.get("s")
                        s = getSortValue(sort)
                        params['goodstring'] = 'yes'
                        params['author'] = leg
                        params['bills'] = getBillsbyAuthor(params['author'],
                                                           sort=s)
                        params['author_data'] = getLegislatorByID(leg)
                        break
                if params['goodstring'] == 'no':
                    params['string'] = leg
                self.render(bills_search_results_page, **params)

            else:
                page = get_contents_of_url(aws_output + 'bills/front')
                if page:
                    self.write(page)
                else:
                    params["sessions"], params["details"] = getSessionNames()
                    params['legislators'] = getAllLegislators()
                    params['search_page'] = "True"
                    self.render(bills_search_page, **params)
Exemplo n.º 4
0
    def get(self):
        params=self.check_login('/bills')
        if 'loggedin_user' not in params:
            self.redirect('/signup')
        else:
            keyword=self.request.get("k")
            leg=self.request.get("l")
            if keyword:
                sort=self.request.get("s")
                s=getSortValue(sort)
                params['keyword']=keyword
                params['bills']=getBillsbyKeyword(keyword,s)
                self.render(bills_search_results_page, **params)
            elif leg:
                params['goodstring']='no'
                legs=getAllLegislators()
                for l in legs:
                    if leg==l.name:
                        leg=l.leg_id
                        sort=self.request.get("s")
                        s=getSortValue(sort)
                        params['goodstring']='yes'
                        params['author']=leg
                        params['bills']=getBillsbyAuthor(params['author'],sort=s)
                        params['author_data']=getLegislatorByID(leg)
                        break
                if params['goodstring']=='no':
                    params['string']=leg
                self.render(bills_search_results_page, **params)

            else:
                page=get_contents_of_url(aws_output+'bills/front')
                if page:
                    self.write(page)
                else:
                    params["sessions"],params["details"]=getSessionNames()
                    params['legislators']=getAllLegislators()
                    params['search_page']="True"
                    self.render(bills_search_page, **params)