##// END OF EJS Templates
Moved cached function for easier invalidation
Moved cached function for easier invalidation

File last commit:

r115:8c038e58 default
r134:79a4f9f1 default
Show More
hg.py
47 lines | 1.6 KiB | text/x-python | PythonLexer
Marcin Kuzminski
initial commit.
r0 #!/usr/bin/python
# -*- coding: utf-8 -*-
added empty controllers for branches tags files graph, routing and test for them
r93 from mako.template import Template
from mercurial.hg import repository
from mercurial.hgweb import hgweb
from mercurial.hgweb.request import wsgiapplication
from mercurial.localrepo import localrepository
from operator import itemgetter
Marcin Kuzminski
Added app basic auth....
r41 from pylons import tmpl_context as c, app_globals as g, session, request, config
added empty controllers for branches tags files graph, routing and test for them
r93 from pylons.controllers.util import abort
Marcin Kuzminski
Removed default contact name...
r22 from pylons_app.lib import helpers as h
Marcin Kuzminski
refactoring update
r76 from pylons_app.lib.base import BaseController, render
Marcin Kuzminski
Moved summary to seperate controller,...
r82 from pylons_app.lib.utils import get_repo_slug
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 from pylons_app.model.hg_model import HgModel
added empty controllers for branches tags files graph, routing and test for them
r93 import logging
import os
from beaker.cache import cache_region
Marcin Kuzminski
major app speedup moved the wsgi creation to app globals, in order to make it run only once....
r10 log = logging.getLogger(__name__)
Marcin Kuzminski
initial commit.
r0
class HgController(BaseController):
Marcin Kuzminski
Wrapped into mako templates,...
r21
def __before__(self):
Marcin Kuzminski
Added app basic auth....
r41 c.repos_prefix = config['repos_name']
Marcin Kuzminski
Moved summary to seperate controller,...
r82 c.repo_name = get_repo_slug(request)
Marcin Kuzminski
Implemented index page using vcs
r55 def index(self):
added empty controllers for branches tags files graph, routing and test for them
r93
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 hg_model = HgModel()
added empty controllers for branches tags files graph, routing and test for them
r93 @cache_region('short_term', 'repo_list')
def _list():
return list(hg_model.get_repos())
c.repos_list = _list()
Marcin Kuzminski
Implemented main page sorting
r57 c.current_sort = request.GET.get('sort', 'name')
Marcin Kuzminski
Implemented index page using vcs
r55
Marcin Kuzminski
Implemented main page sorting
r57 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.sort(key=itemgetter(sort_key), reverse=True)
else:
c.repos_list.sort(key=itemgetter(sort_key), reverse=False)
Marcin Kuzminski
Implemented index page using vcs
r55 return render('/index.html')