Changeset - 32d6c955218c
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-06-07 00:26:52
marcin@python-works.com
added check for repo created outside of hg app
1 file changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/repos.py
Show inline comments
 
@@ -125,43 +125,51 @@ class ReposController(BaseController):
 
        """DELETE /repos/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('repo', id=ID),
 
        #           method='delete')
 
        # url('repo', id=ID)
 
        
 
        repo_model = RepoModel()
 
        repo = repo_model.get(id)
 
        if not repo:
 
            h.flash(_('%s repository is not mapped to db perhaps' 
 
                      ' it was moved or renamed please run the application again'
 
                      ' it was moved or renamed  from the filesystem'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % id, category='error')
 
        
 
            return redirect(url('repos'))
 
        try:
 
            repo_model.delete(repo)            
 
            invalidate_cache('cached_repo_list')
 
            h.flash(_('deleted repository %s') % id, category='success')
 
        except Exception:
 
            h.flash(_('An error occured during deletion of %s') % id,
 
                    category='error')
 
        
 
        return redirect(url('repos'))
 
        
 
    def show(self, id, format='html'):
 
        """GET /repos/id: Show a specific item"""
 
        # url('repo', id=ID)
 
        
 
    def edit(self, id, format='html'):
 
        """GET /repos/id/edit: Form to edit an existing item"""
 
        # url('edit_repo', id=ID)
 
        repo_model = RepoModel()
 
        c.repo_info = repo_model.get(id)
 
        c.repo_info = repo = repo_model.get(id)
 
        if not repo:
 
            h.flash(_('%s repository is not mapped to db perhaps' 
 
                      ' it was created or renamed from the filesystem'
 
                      ' please run the application again'
 
                      ' in order to rescan repositories') % id, category='error')
 
        
 
            return redirect(url('repos'))        
 
        defaults = c.repo_info.__dict__
 
        defaults.update({'user':c.repo_info.user.username})        
 
        return htmlfill.render(
 
            render('admin/repos/repo_edit.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )          
0 comments (0 inline, 0 general)