Exemplo n.º 1
0
Arquivo: web.py Projeto: 3kwa/tnc
    def admin(self, **form):

        if cherrypy.request.method == "POST":
            if 'text' in form:
                try:
                    values = forms.validate_status(form)
                except forms.Invalid, e:
                    status = forms.render_status(current=current_status(),
                                                 defaults=e.value,
                                                 errors=e.unpack_errors())
                else:
                    models.save_status(values)
                    status = forms.render_status(current=current_status())
Exemplo n.º 2
0
Arquivo: web.py Projeto: 3kwa/tnc
    def admin(self, **form):

        if cherrypy.request.method == "POST":
            if 'text' in form:
                try:
                    values = forms.validate_status(form)
                except forms.Invalid, e:
                    status = forms.render_status(current=current_status(),
                                                 defaults=e.value,
                                                 errors=e.unpack_errors())
                else:
                    models.save_status(values)
                    status = forms.render_status(current=current_status())

        if cherrypy.request.method == "GET":
            status = forms.render_status(current=current_status())

        trash = models.trashed_submissions()
        projects = unpublished_projects()
        submissions = unchecked_submissions()
        public = published_projects()
        return serve_template('admin.html',
                              trash=trash,
                              submissions=submissions,
                              projects=projects,
                              public=public,
                              status=status)

    @cherrypy.expose
    def project(self, id_, action, **form):