From: Leandro Lucarella Date: Sat, 17 Feb 2007 19:20:19 +0000 (+0000) Subject: Usar folding. X-Git-Tag: pre-merge~135 X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/commitdiff_plain/8e6df21683f1d7169f6822fe9f0f0c62fe520679?ds=inline Usar folding. --- diff --git a/sercom/subcontrollers/caso_de_prueba/__init__.py b/sercom/subcontrollers/caso_de_prueba/__init__.py index 191800b..2fd5981 100644 --- a/sercom/subcontrollers/caso_de_prueba/__init__.py +++ b/sercom/subcontrollers/caso_de_prueba/__init__.py @@ -1,5 +1,6 @@ # vim: set et sw=4 sts=4 encoding=utf-8 : +#{{{ Imports from turbogears import controllers, expose, redirect from turbogears import validate, validators, flash, error_handler from turbogears.widgets import * @@ -8,7 +9,9 @@ from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val from sercom.model import CasoDePrueba, Enunciado +#}}} +#{{{ Configuración cls = CasoDePrueba name = 'caso de prueba' namepl = 'casos de prueba' @@ -16,7 +19,9 @@ namepl = 'casos de prueba' fkcls = Enunciado fkname = 'enunciado' fknamepl = fkname + 's' +#}}} +#{{{ Validación def validate_fk(data): fk = data.get(fkname + 'ID', None) if fk == 0: fk = None @@ -41,7 +46,9 @@ def validate_set(id, data): def validate_new(data): validate_fk(data) return val.validate_new(cls, name, data) +#}}} +#{{{ Formulario def get_options(): return [(0, _(u'<>'))] + [(fk.id, fk.shortrepr()) for fk in fkcls.select()] @@ -60,7 +67,9 @@ form = TableForm(fields=[ validator=validators.Number(not_empty=False, strip=True)), ]) form.javascript.append(JSSource("MochiKit.DOM.focusOnLoad('form_nombre');")) +#}}} +#{{{ Controlador class CasoDePruebaController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('admin') @@ -131,4 +140,5 @@ class CasoDePruebaController(controllers.Controller, identity.SecureResource): r.destroySelf() flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list') +#}}} diff --git a/sercom/subcontrollers/docente/__init__.py b/sercom/subcontrollers/docente/__init__.py index df4a2b7..1a133b2 100644 --- a/sercom/subcontrollers/docente/__init__.py +++ b/sercom/subcontrollers/docente/__init__.py @@ -1,5 +1,6 @@ # vim: set et sw=4 sts=4 encoding=utf-8 : +#{{{ Imports import cherrypy from turbogears import controllers, expose, redirect from turbogears import validate, validators, flash, error_handler @@ -9,15 +10,21 @@ from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val from sercom.model import Docente +#}}} +#{{{ Configuración cls = Docente name = 'docente' namepl = name + 's' +#}}} +#{{{ Validación def validate_get(id): return val.validate_get(cls, name, id) def validate_set(id, data): return val.validate_set(cls, name, id, data) def validate_new(data): return val.validate_new(cls, name, data) +#}}} +#{{{ Formulario form = TableForm(fields=[ TextField(name='usuario', label=_(u'Usuario'), help_text=_(u'Requerido y único.'), @@ -44,7 +51,9 @@ form = TableForm(fields=[ validator=validators.Bool(if_empty=1)), ]) form.javascript.append(JSSource("MochiKit.DOM.focusOnLoad('form_usuario');")) +#}}} +#{{{ Controlador class DocenteController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('admin') @@ -121,4 +130,5 @@ class DocenteController(controllers.Controller, identity.SecureResource): r.destroySelf() flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list') +#}}} diff --git a/sercom/subcontrollers/enunciado/__init__.py b/sercom/subcontrollers/enunciado/__init__.py index 9527e83..818fda3 100644 --- a/sercom/subcontrollers/enunciado/__init__.py +++ b/sercom/subcontrollers/enunciado/__init__.py @@ -1,5 +1,6 @@ # vim: set et sw=4 sts=4 encoding=utf-8 : +#{{{ Imports from turbogears import controllers, expose, redirect from turbogears import validate, validators, flash, error_handler from turbogears.widgets import * @@ -8,7 +9,9 @@ from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val from sercom.model import Enunciado, Docente +#}}} +#{{{ Configuración cls = Enunciado name = 'enunciado' namepl = name + 's' @@ -16,7 +19,9 @@ namepl = name + 's' fkcls = Docente fkname = 'autor' fknamepl = fkname + 'es' +#}}} +#{{{ Validación def validate_fk(data): fk = data.get(fkname + 'ID', None) if fk == 0: fk = None @@ -41,7 +46,9 @@ def validate_set(id, data): def validate_new(data): validate_fk(data) return val.validate_new(cls, name, data) +#}}} +#{{{ Formulario def get_options(): return [(0, _(u'--'))] + [(fk.id, fk.shortrepr()) for fk in fkcls.select()] @@ -55,7 +62,9 @@ form = TableForm(fields=[ validator=validators.UnicodeString(not_empty=False, max=255, strip=True)), ]) form.javascript.append(JSSource("MochiKit.DOM.focusOnLoad('form_nombre');")) +#}}} +#{{{ Controlador class EnunciadoController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('admin') @@ -126,4 +135,5 @@ class EnunciadoController(controllers.Controller, identity.SecureResource): r.destroySelf() flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list') +#}}}