This commit is contained in:
darthsandmann
2016-10-16 21:53:15 +02:00
parent 0d10f8b9dc
commit c9f3117da1
412 changed files with 137942 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
from mako import exceptions
import json
from app import database
from app import view
class Validator( object ):
def __init__( self, database, counter ):
self._database = database
self._counter = counter
def validate( self, *to_check, **form_input ):
counter = 0
fails = ""
ident = form_input.get( 'ID' )
data = self._database.read( ident )
if( not self._database.exists( ident ) ):
pass # Fehlerbehandlung
return 0
for key in to_check:
if( form_input.get( key ) == data[key] ):
counter += 1
else:
fails += key + ", "
if( counter == len( to_check ) ):
return 1
else:
return 0