X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/6526a74b42e33e807f8e3846f38b28ef1f5de534..04677c432f0c579e2ef79e80c1c14d7f1d33369a:/sercom/subcontrollers/docente/__init__.py?ds=inline diff --git a/sercom/subcontrollers/docente/__init__.py b/sercom/subcontrollers/docente/__init__.py index a167d7a..4759fa6 100644 --- a/sercom/subcontrollers/docente/__init__.py +++ b/sercom/subcontrollers/docente/__init__.py @@ -1,13 +1,14 @@ # vim: set et sw=4 sts=4 encoding=utf-8 : +import cherrypy from turbogears import controllers, expose, redirect from turbogears import validate, validators, flash, error_handler -from sercom.model import Docente from turbogears.widgets import * from turbogears import identity from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val +from sercom.model import Docente cls = Docente name = 'docente' @@ -70,9 +71,9 @@ class DocenteController(controllers.Controller, identity.SecureResource): r = validate_get(id) try: r.activo = bool(int(activo)) - except ValueError, e: - raise redirect('../list', tg_flash=_(u'Acción inválida.')) - raise redirect('../list') + except ValueError: + raise cherrypy.NotFound + raise redirect('../../list') @expose(template='kid:%s.templates.new' % __name__) def new(self, **kw): @@ -108,7 +109,10 @@ class DocenteController(controllers.Controller, identity.SecureResource): def show(self,id, **kw): """Show record in model""" r = validate_get(id) - r.obs = publish_parts(r.observaciones, writer_name='html')['html_body'] + if r.observaciones is None: + r.obs = '' + else: + r.obs = publish_parts(r.observaciones, writer_name='html')['html_body'] return dict(name=name, namepl=namepl, record=r) @expose()