Exemple #1
0
 def get(self):
     params = self.check_login('districts')
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         dists = getAllDistricts()
         house_hpvi = getHPVIbyChamber('lower')
         senate_hpvi = getHPVIbyChamber('upper')
         for d in dists:
             if d['chamber'] == 'upper':
                 hpvi = senate_hpvi.get(d['name'])
             elif d['chamber'] == 'lower':
                 hpvi = house_hpvi.get(d['name'])
             addDistrictToParse(d['boundary_id'], hpvi)
Exemple #2
0
 def get(self):
     params=self.check_login('districts')
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         dists=getAllDistricts()
         house_hpvi=getHPVIbyChamber('lower')
         senate_hpvi=getHPVIbyChamber('upper')
         for d in dists:
             if d['chamber']=='upper':
                 hpvi=senate_hpvi.get(d['name'])
             elif d['chamber']=='lower':
                 hpvi=house_hpvi.get(d['name'])
             addDistrictToParse(d['boundary_id'],hpvi)
Exemple #3
0
 def get(self):
     params = self.check_login('aws/districts')
     k = getKeyFromAWS('output/districts/front')
     if k == None:
         self.write('Page not found, uploading...<br>')
         params['districts'] = getAllDistricts()
         params['sen_hpvi'] = getHPVIbyChamber('upper', True)
         params['house_hpvi'] = getHPVIbyChamber('lower', True)
         params['senate'] = [39, 28]
         params['house'] = [73, 61]
         k = Key(b)
         k.key = 'output/districts/front'
         k.set_contents_from_string(render_str(districts_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Exemple #4
0
 def get(self):
     params=self.check_login('aws/districts')
     k=getKeyFromAWS('output/districts/front')
     if k==None:
         self.write('Page not found, uploading...<br>')
         params['districts']=getAllDistricts()
         params['sen_hpvi']=getHPVIbyChamber('upper',True)
         params['house_hpvi']=getHPVIbyChamber('lower',True)
         params['senate']=[39,28]
         params['house']=[73,61]
         k = Key(b)
         k.key = 'output/districts/front'
         k.set_contents_from_string(render_str(districts_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Exemple #5
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)
Exemple #6
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)