From 6ce4d4e8ad92583bb1187385f30f52ade8beee9e Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 28 Feb 2007 16:13:12 +0000 Subject: [PATCH 1/1] actualizo el grupo.update --- sercom/subcontrollers/grupo/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sercom/subcontrollers/grupo/__init__.py b/sercom/subcontrollers/grupo/__init__.py index 3f092a2..28abe65 100644 --- a/sercom/subcontrollers/grupo/__init__.py +++ b/sercom/subcontrollers/grupo/__init__.py @@ -220,20 +220,16 @@ class GrupoController(controllers.Controller, identity.SecureResource): """Save or create record to model""" responsable = kw['responsable'] curso = kw['cursoID'] - alumno = None + resp = kw['responsable'] try: # Busco el alumno inscripto - alumno = AlumnoInscripto.select(AND(Curso.q.id==curso, Alumno.q.usuario==responsable)) - if alumno.count() > 0: - alumno = alumno[0] - else: - raise Exception - except Exception, (inst): - flash(_(u'El responsable %s no existe') % responsable) - raise redirect('../list') - + resp = AlumnoInscripto.selectBy(cursoID=kw['cursoID'], + alumno=Alumno.byPadron(kw['responsable'])).getOne() + except SQLObjectNotFound: + flash(_(u'El responsable %s no existe') % resp) + raise redirect('list') + kw['responsable'] = resp r = validate_set(id, kw) - r.responsable = alumno flash(_(u'El %s fue actualizado.') % name) raise redirect('../list') -- 2.43.0