Esempio n. 1
0
 def get(self):
     params = self.check_login('/aws/bills')
     k = getKeyFromAWS('output/bills/front')
     if k == None:
         params["sessions"], params["details"] = getSessionNames()
         params['legislators'] = getAllLegislators()
         params['search_page'] = "True"
         k = getAWSKey('output/bills/front')
         k.set_contents_from_string(render_str(bills_search_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Esempio n. 2
0
 def get(self):
     params=self.check_login('/aws/bills')
     k=getKeyFromAWS('output/bills/front')
     if k==None:
         params["sessions"],params["details"]=getSessionNames()
         params['legislators']=getAllLegislators()
         params['search_page']="True"
         k = getAWSKey('output/bills/front')
         k.set_contents_from_string(render_str(bills_search_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Esempio 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)
Esempio 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)