PPM2: select
This commit is contained in:
31
Praktikum2/ppm2/app/choice.py
Normal file
31
Praktikum2/ppm2/app/choice.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import cherrypy
|
||||
from app import database
|
||||
|
||||
#-------------------------------------------------------
|
||||
class Choice(object):
|
||||
#-------------------------------------------------------
|
||||
|
||||
exposed = True # gilt für alle Methoden
|
||||
|
||||
#-------------------------------------------------------
|
||||
def __init__(self):
|
||||
#-------------------------------------------------------
|
||||
self.db = database.Database()
|
||||
|
||||
#-------------------------------------------------------
|
||||
def GET(self):
|
||||
#-------------------------------------------------------
|
||||
self.db.ReadAll()
|
||||
data = {}
|
||||
data['content'] = {}
|
||||
offerings = self.db.data['Angebote']
|
||||
for key, value in offerings.items():
|
||||
for key2, value2 in value.items():
|
||||
if(key2 == 'Status'):
|
||||
if(value2 == 'Angebot'):
|
||||
data['content'][key] = value
|
||||
print(data)
|
||||
return json.dumps(data)
|
Reference in New Issue
Block a user