Exemple #1
0
 def get(self):
     params = self.check_login('aws/get_senate_districts')
     c = connectToAWS()
     if c:
         self.write('Connected<br><br>')
         b = c.get_bucket('mnleginfo')
         r = range(67)
         #self.write(r)
         for n in r:
             district_id = 'sldu/mn-' + str(n + 1).zfill(2)
             self.write(district_id)
             k = b.get_key('output/districts/' + district_id)
             if k:
                 self.write(' Page found<br>')
             else:
                 self.write(' Page not found, trying to upload...')
                 data = getDistrictById(district_id)
                 params['data'] = data
                 params['district_map'] = 'True'
                 k = Key(b)
                 k.key = 'output/districts/' + district_id
                 k.set_contents_from_string(
                     render_str(district_page, **params))
                 k.set_acl('public-read')
                 self.write('uploaded<br>')
Exemple #2
0
 def get(self, district_id):
     params = self.check_login('aws/districts/' + district_id)
     k = getKeyFromAWS('output/districts/' + district_id)
     if k == None:
         self.write('Page not found, uploading...<br>')
         data = getDistrictById(district_id)
         params['data'] = data
         params['district_map'] = 'True'
         k = Key(b)
         k.key = 'output/districts/' + district_id
         k.set_contents_from_string(render_str(district_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Exemple #3
0
 def get(self, district_id):
     params = self.check_login('districts/' + district_id)
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         # page=get_contents_of_url(aws_output+'districts/'+district_id)
         # if page:
         #     self.write(page)
         # else:
         data = getDistrictById(district_id)
         params['data'] = data
         params['district_map'] = 'True'
         self.render(district_page, **params)
Exemple #4
0
 def get(self,district_id):
     params=self.check_login('aws/districts/'+district_id)
     k=getKeyFromAWS('output/districts/'+district_id)
     if k==None:
         self.write('Page not found, uploading...<br>')
         data=getDistrictById(district_id)
         params['data']=data
         params['district_map']='True'
         k = Key(b)
         k.key = 'output/districts/'+district_id
         k.set_contents_from_string(render_str(district_page, **params))
         k.set_acl('public-read')
     self.write(k.get_contents_as_string())
Exemple #5
0
 def get(self,district_id):
     params=self.check_login('districts/'+district_id)
     if 'loggedin_user' not in params:
         self.redirect('/signup')
     else:
         # page=get_contents_of_url(aws_output+'districts/'+district_id)
         # if page:
         #     self.write(page)
         # else:
         data=getDistrictById(district_id)
         params['data']=data
         params['district_map']='True'
         self.render(district_page, **params)
Exemple #6
0
 def get(self,l):
     params=self.check_login('aws/get_house_districts/'+l)
     c=connectToAWS()
     if c:
         self.write('Connected<br><br>')
         b=c.get_bucket('mnleginfo')
         r=range(67)
         for n in r:
             district_id='sldl/mn-'+str(n+1).zfill(2)+l
             self.write(district_id)
             k=b.get_key('output/districts/'+district_id)
             if k:
                 self.write(' Page found<br>')
             else:
                 self.write(' Page not found, trying to upload...')
                 data=getDistrictById(district_id)
                 params['data']=data
                 params['district_map']='True'
                 k = Key(b)
                 k.key = 'output/districts/'+district_id
                 k.set_contents_from_string(render_str(district_page, **params))
                 k.set_acl('public-read')
                 self.write('uploaded<br>')