WEB/Praktikum2/ppm2/app/choice.py

32 lines
978 B
Python
Raw Normal View History

2016-12-12 22:20:21 +01:00
# 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)