From: Leandro Lucarella Date: Wed, 14 Mar 2007 21:18:27 +0000 (+0000) Subject: Usar list comprehension en vez de filter(). X-Git-Tag: 0_9_0~121 X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/commitdiff_plain/28fe1b8fba3e8389219c15c399437d42669bf453?hp=3b201d8abd796a2d6c910b4b7b72c5e341f9d456 Usar list comprehension en vez de filter(). --- diff --git a/sercom/subcontrollers/enunciado/__init__.py b/sercom/subcontrollers/enunciado/__init__.py index a81c9e3..9ef523f 100644 --- a/sercom/subcontrollers/enunciado/__init__.py +++ b/sercom/subcontrollers/enunciado/__init__.py @@ -178,8 +178,8 @@ class EnunciadoController(controllers.Controller, identity.SecureResource): def edit(self, id, **kw): """Edit record in model""" r = validate_get(id) - r.tareas_fuente = [{"id":t.id, "label":t.shortrepr()} for t in filter(lambda x: isinstance(x, TareaFuente), r.tareas)] - r.tareas_prueba = [{"id":t.id, "label":t.shortrepr()} for t in filter(lambda x: isinstance(x, TareaPrueba), r.tareas)] + r.tareas_fuente = [{"id":t.id, "label":t.shortrepr()} for t in r.tareas if isinstance(t, TareaFuente)] + r.tareas_prueba = [{"id":t.id, "label":t.shortrepr()} for t in r.tareas if isinstance(x, TareaPrueba)] return dict(name=name, namepl=namepl, record=r, form=form) @validate(form=form)