Exemple #1
0
 def view(self, environment):
     repo = YumRepositories.first(environment=environment)
     if not repo:
         cherrypy.session['flash'] = '404 Repository Not Found'
         raise cherrypy.HTTPRedirect('/repos/index')
     env = dict(
         repo=repo,
         env=Environments.first(id=repo.environment)
     )
     return self.render("/repos/view.html", crumbs=self.crumbs, **env)
Exemple #2
0
    def delete(self, id):
        environment = Environments.first(id=id)
        msg = "The jail could not be deleted."
        if environment:
            if Environments.delete(jail):
                msg = "Jail Type deleted."

        cherrypy.session['flash'] = msg

        raise cherrypy.HTTPRedirect('/environments')
Exemple #3
0
    def edit(self, id, **post):
        environment = Environments.first(id=id)
        if not environment:
            cherrypy.session['flash'] = "404 Environment Not Found"
            raise cherrypy.HTTPRedirect('/environments')

        if post:
            fields = ['name', 'code']
            data = self._get_data('environment', fields, post)
            if environment.update(data, fields):
                cherrypy.session['flash'] = "Environment successfully updated."
                raise cherrypy.HTTPRedirect('/environments')

        env=dict(environment = environment)
        return self.render("/environments/edit.html", crumbs=self.crumbs, **env)
Exemple #4
0
    def edit(self, id, **post):

        repo = YumRepositories.first(id=id)
        if not repo:
            raise cherrypy.HTTPRedirect('/repos')

        if 'repo' in post:
            if repo.validates(post['repo']):
                for k in post['repo']:
                    setattr(repo, k, post['repo'][k])
                YumRepositories.update(repo, ['data'])
                raise cherrypy.HTTPRedirect('/repos/view/%s' % id)

        env = dict(
            repo=repo,
            env=Environments.first(id=repo.environment)
        )
        return self.render("/repos/edit.html", crumbs=self.crumbs, **env)