Beispiel #1
0
 def update(self, request, matricula):
     aluno = buscar_aluno(matricula)
     impressao_digital = request.data.get('digital', None)
     if aluno is not None and impressao_digital is not None:
         basic_authentication = HttpBasicAuthentication()
         if not basic_authentication.is_authenticated(request):
             return basic_authentication.challenge()
         aluno.set_impressao_digital(psycopg2.Binary(str(impressao_digital)))
Beispiel #2
0
 def update(self, request, matricula):
     aluno = buscar_aluno(matricula)
     basic_authentication = HttpBasicAuthentication()
     if not basic_authentication.is_authenticated(request):
         return basic_authentication.challenge()
     if aluno != None:
         if aluno_nao_comeu(aluno):
             try:
                 RefeicaoMensalDoAluno.deduzir_refeicao_do_aluno(aluno, mes_corrente(), ANO_LETIVO)
                 aluno.consumir_refeicao()
             except RefeicaoEsgotada:
                 return HttpResponseForbidden()
         else:
             return HttpResponseForbidden()
     else:
         return HttpResponseForbidden()
Beispiel #3
0
 def read(self, request):
     basic_authentication = HttpBasicAuthentication()
     if not basic_authentication.is_authenticated(request):
         return basic_authentication.challenge()