def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result self.itemid = self.request.get('itemid') getter = """SELECT title, description, branch, substance_type, application_areas, usecases, evaporation_lane_150, evaporation_lane_160, evaporation_lane_170, evaporation_lane_180, ueg, response, skin_category, checked_emissions, date_checked, flashpoint, values_range, comments, image_url, productclass FROM %s WHERE %s_id = %s;""" % ( self.context.tablename, self.context.tablename, self.itemid) relationalgetter = "SELECT application_areas.application_area_name FROM application_areas, areapairs WHERE areapairs.mixture_id = %s and areapairs.area_id = application_areas.application_area_id ;" % self.itemid relationalgetter2 = "SELECT usecases.usecase_name FROM usecases, usecasepairs WHERE usecasepairs.mixture_id = %s and usecasepairs.usecase_id = usecases.usecase_id ;" % self.itemid self.result = self.db.execute(getter) self.relational = self.db.execute(relationalgetter) self.relational2 = self.db.execute(relationalgetter2) self.db.close() return self.index()
def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result self.itemid = self.request.get('itemid') return self.index()
def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) self.host = self.context.aq_parent.host self.dbname = self.context.aq_parent.database self.username = self.context.aq_parent.username self.password = self.context.aq_parent.password if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result return self.index()
def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) self.itemid = self.request.get('item') self.host = self.context.aq_parent.host self.dbname = self.context.aq_parent.database self.username = self.context.aq_parent.username self.password = self.context.aq_parent.password self.article = self.get_article() self.machines = [] self.secsheet = [] #import pdb; pdb.set_trace() self.definitions = self.get_definitions() print(self.definitions) self.more_definitions = self.get_more_definitions() if self.context.tablename == 'substance_mixture': #self.machines = self.get_machines() #self.secsheet = self.get_recipes() template = ViewPageTemplateFile('single_view.pt') self.image_url = self.get_image_url() self.template = BoundPageTemplate(template, self) return self.template() if self.context.tablename == 'substance': #self.machines = self.get_machines() #self.secsheet = self.get_recipes() template = ViewPageTemplateFile('single_view.pt') self.template = BoundPageTemplate(template, self) return self.template() elif self.context.tablename == 'spray_powder': template = ViewPageTemplateFile('single_view.pt') self.image_url = self.get_image_url() self.template = BoundPageTemplate(template, self) return self.template() elif self.context.tablename == 'manufacturer': template = ViewPageTemplateFile('single_view.pt') self.template = BoundPageTemplate(template, self) return self.template() return self.index()
def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result self.itemid = self.request.get('itemid') getter = """SELECT title, description, homepage FROM %s WHERE %s_id = %s;""" % ( self.context.tablename, self.context.tablename, self.itemid) self.result = self.db.execute(getter) self.db.close() return self.index()
def __call__(self): dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result self.itemid = self.request.get('itemid') getter = """SELECT title, description, product_class, starting_material, median_value, volume_share, checked_emissions FROM %s WHERE %s_id = %s;""" % ( self.context.tablename, self.context.tablename, self.itemid) self.result = self.db.execute(getter) self.db.close() return self.index()
def __call__(self): self.columnids = self.getindexfortablename() dbdata = self.context.aq_parent self.db = DBConnect(host=dbdata.host, db=dbdata.database, user=dbdata.username, password=dbdata.password) self.host = self.context.aq_parent.host self.dbname = self.context.aq_parent.database self.username = self.context.aq_parent.username self.password = self.context.aq_parent.password self.preselects = self.get_preselects() if self.submitted: button = self.hasButtonSubmitted() if button: result = self.submit(button) if result: return result else: button = "Alle anzeigen" result = self.submit(button) if result: return result return self.index()
def __call__(self): self.db = DBConnect(host=self.context.host, db=self.context.database, user=self.context.username, password=self.context.password) mixtures = [] select = "SELECT substance_mixture_id, title FROM substance_mixture;" gemische = self.db.execute(select) for gemisch in gemische: mixture_entry = {} selectoldid = "SELECT link FROM oldlinks WHERE mixture_id = %s" % gemisch[ 0] oldid = self.db.execute(selectoldid) if oldid: mixture_entry['@id'] = oldid[0][0] else: mixture_entry['@id'] = "bgetem.substance_mixture." + str( gemisch[0] ) # über die Punkt-Notation könnten mehrere potenzielle Quellen angezapft werden mixture_entry['title'] = gemisch[1] mixtures.append(mixture_entry) return jsonlib.write(mixtures)
def __call__(self): self.db = DBConnect(host=self.context.host, db=self.context.database, user=self.context.username, password=self.context.password) gemischid = self.request.get('gemischid') #gemischid = "https://emissionsarme-produkte.bgetem.de/datenbank-chemie-dp/wasch-und-reinigungsmittel-fuer-den-etikettendruck/biolon-xi-fluessig" if gemischid.startswith('https://'): select = "SELECT mixture_id FROM oldlinks WHERE link = '%s'" % gemischid mixture_id = self.db.execute(select) else: mixture_id = gemischid.split('.')[-1] mixture_id = mixture_id[0][0] data1select = "SELECT * FROM substance_mixture WHERE substance_mixture_id = %s" % mixture_id data1 = self.db.execute(data1select) data2select = "SELECT * FROM manufacturer WHERE manufacturer_id = %s" % data1[0][25] data2 = self.db.execute(data2select) data3select = "SELECT * FROM recipes WHERE mixture_id = %s" % mixture_id data3 = self.db.execute(data3select) gefahrstoffdata = {} hersteller = {} hersteller['title'] = data2[0][1] hersteller['@id'] = "bgetem.manufacturer."+str(data2[0][0]) hersteller['description'] = data2[0][2] hersteller['homepage'] = data2[0][4] inhaltsstoffe = list() for inhalt in data3: inhaltsstoff = {} select = "SELECT * FROM substance WHERE substance_id = %s" % inhalt[1] reinstoff = self.db.execute(select) inhaltsstoff['cas'] = reinstoff[0][4] inhaltsstoff['gefahrstoff'] = reinstoff[0][1] inhaltsstoff['anteil_min'] = inhalt[3] inhaltsstoff['anteil_max'] = inhalt[4] inhaltsstoff['anteil'] = f">= {inhalt[3]}% - <= {inhalt[4]}%" inhaltsstoffe.append(inhaltsstoff) productclassselect = "SELECT class_name FROM productclasses WHERE class_id = %s" % data1[0][27] try: productclass = self.db.execute(productclassselect) productclass = productclass[0][0] except: productclass = None produktkategorien = { "label": "Reinigungsmittel im Etikettendruck", "offset": "Offsetdruck allgemein", "heatset": "Heatsetwaschmittel", "uv": "Reinigungsmittel im UV-Druck", "special": "Sonderreiniger", "dental": "Dentaltechnik", "textil": "Textil und Mode" } produktkategorie = list() produktkategorie.append(produktkategorien[data1[0][5]]) gefahrstoffdata['hersteller'] = hersteller gefahrstoffdata['hskategorie'] = data1[0][16] gefahrstoffdata['bemerkungen'] = data1[0][23] gefahrstoffdata['chemikalienliste'] = inhaltsstoffe gefahrstoffdata['UID'] = data1[0][3] gefahrstoffdata['title'] = data1[0][1] gefahrstoffdata['review_state'] = data1[0][26] gefahrstoffdata['emissionsgeprueft'] = data1[0][17] gefahrstoffdata['produktkategorie'] = produktkategorie gefahrstoffdata['description'] = data1[0][2] gefahrstoffdata['wertebereich'] = data1[0][20] gefahrstoffdata['flammpunkt'] = data1[0][19] gefahrstoffdata['@id'] = gemischid gefahrstoffdata['produktklasse'] = productclass return jsonlib.write(gefahrstoffdata)