Changeset - 4cf00c939e88
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-05-25 23:41:03
marcin@python-works.com
cleaned unused imports
1 file changed with 0 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/hg.py
Show inline comments
 
#!/usr/bin/python
 
# -*- coding: utf-8 -*-
 
import logging
 
from operator import itemgetter
 
from pylons import tmpl_context as c, request, config
 
from pylons_app.lib.base import BaseController, render
 
from pylons_app.lib.utils import get_repo_slug
 
from pylons_app.model.hg_model import HgModel
 
from pylons_app.lib.auth import LoginRequired
 
log = logging.getLogger(__name__)
 

	
 
class HgController(BaseController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(HgController, self).__before__()
 
        
 
    def index(self):
 
        c.current_sort = request.GET.get('sort', 'name')
 
        cs = c.current_sort
 
        c.cs_slug = cs.replace('-', '')
 
        sortables = ['name', 'description', 'last_change', 'tip', 'contact']
 
        
 
        if cs and c.cs_slug in sortables:
 
            sort_key = c.cs_slug + '_sort'
 
            if cs.startswith('-'):
 
                c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=True)
 
            else:
 
                c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=False)
 
            
 
        return render('/index.html')
0 comments (0 inline, 0 general)