Пример #1
0
 def list_iids(self):
     self.parent.check_auth()
     template = JINJA.get_template('list_iids.template')
     table = from_db_cursor(self.get_cursor("""select local_iid as iid, ra, decl, 
                                                      string_agg(fs.set_id, ',') as sets,
                                                      string_agg(fp.catalog || '(' || cast(fp.objects_count as character varying) || ')', ',') as catalogs                                                         
                                                 from fields f 
                                                 left outer join fields_properties fp on fp.iid = f.iid
                                                 left outer join field_sets fs on fs.iid = f.iid
                                                where user_id = '%s' 
                                               group by 1,2,3
                                               order by 2
                                                 """ % self.parent.current_user))
     data = self.parent.get_basic()
     data['iid_list'] = table.get_html_string(attributes={'border': 1,
                                                          'id': 'iid_table'})
     return template.render(data)
Пример #2
0
 def single_iid(self, iid):
     self.parent.check_auth()
     global_iid = self.parent.runner.get_global_iid(self.parent.current_user, iid)
     cur = self.get_cursor("""select catalog, objects_count, peaks_count, loading_date
                                from fields_properties
                               where iid = %s""" % global_iid)
     data = self.parent.get_basic()
     data.update({'catalogs': [], 
                  'iid': iid})
     for row in cur.fetchall():
         data['catalogs'].append({'name': row[0],
                                  'objects_count': row[1],
                                  'peaks_count': row[2],
                                  'loading_date': row[3]})
     detections = from_db_cursor(self.get_cursor("""
         select detection_id, z, z_err, lambda, bcg_distance 
           from cluster_detections
          where iid = %s""" % global_iid))
     data['detections'] = detections.get_html_string(attributes={'border': 1,
                                                          'id': 'detections'})
     template = JINJA.get_template('single_iid.template')
     return template.render(data)
Пример #3
0
 def default(self):
     template = JINJA.get_template('root.template')
     return template.render({'username': self.current_user,
                             'root': self.ROOT})
Пример #4
0
 def new_iid(self):
     self.parent.check_auth()
     template = JINJA.get_template('new_iid.template')
     return template.render(self.parent.get_basic())
Пример #5
0
 def default(self):
     template = JINJA.get_template('root.template')
     return template.render({
         'username': self.current_user,
         'root': self.ROOT
     })