X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/59972c6fd03ea093bd26eca762a7f4fa5a1320dd..5b8a71a4d21a5ee35694718804dda7820f13f768:/sercom/subcontrollers/docente/__init__.py diff --git a/sercom/subcontrollers/docente/__init__.py b/sercom/subcontrollers/docente/__init__.py index c93184d..d7d58bc 100644 --- a/sercom/subcontrollers/docente/__init__.py +++ b/sercom/subcontrollers/docente/__init__.py @@ -2,12 +2,12 @@ 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' @@ -56,7 +56,7 @@ class DocenteController(controllers.Controller, identity.SecureResource): def index(self): raise redirect('list') - @expose(template='kid:sercom.subcontrollers.%s.templates.list' % name) + @expose(template='kid:%s.templates.list' % __name__) @paginate('records') def list(self, **kw): """List records in model""" @@ -74,7 +74,7 @@ class DocenteController(controllers.Controller, identity.SecureResource): raise redirect('../list', tg_flash=_(u'Acción inválida.')) raise redirect('../list') - @expose(template='kid:sercom.subcontrollers.%s.templates.new' % name) + @expose(template='kid:%s.templates.new' % __name__) def new(self, **kw): """Create new records in model""" f = kw.get('tg_flash', None) @@ -88,7 +88,7 @@ class DocenteController(controllers.Controller, identity.SecureResource): validate_new(kw) raise redirect('list', tg_flash=_(u'Se creó un nuevo %s.') % name) - @expose(template='kid:sercom.subcontrollers.%s.templates.edit' % name) + @expose(template='kid:%s.templates.edit' % __name__) def edit(self, id, **kw): """Edit record in model""" r = validate_get(id) @@ -104,11 +104,14 @@ class DocenteController(controllers.Controller, identity.SecureResource): raise redirect('../list', tg_flash=_(u'El %s fue actualizado.') % name) - @expose(template='kid:sercom.subcontrollers.%s.templates.show' % name) + @expose(template='kid:%s.templates.show' % __name__) 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()