##// END OF EJS Templates
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.

File last commit:

r191:b68b2246 default
r215:70f645fa default
Show More
admin.py
67 lines | 2.3 KiB | text/x-python | PythonLexer
changed for pylons 0.1 / 1.0...
r43 import logging
Changed creation of repository to vcs implementation,...
r133 import os
changed for pylons 0.1 / 1.0...
r43
from pylons import request, response, session, tmpl_context as c, url, app_globals as g
from pylons.controllers.util import abort, redirect
from pylons_app.lib.base import BaseController, render
Marcin Kuzminski
Updated admin to show last 5 actions + updated db model
r62 from pylons_app.model import meta
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user....
r191 from pylons_app.model.db import UserLogs
Marcin Kuzminski
Implemented paging to admin user acion log
r78 from webhelpers.paginate import Page
moved cache invalidating to utils, as seperate function. Implemented invalidating in
r140 from pylons_app.lib.utils import check_repo, invalidate_cache
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user....
r191 from pylons_app.lib.auth import LoginRequired
moved cache invalidating to utils, as seperate function. Implemented invalidating in
r140
changed for pylons 0.1 / 1.0...
r43 log = logging.getLogger(__name__)
class AdminController(BaseController):
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user....
r191
@LoginRequired()
changed for pylons 0.1 / 1.0...
r43 def __before__(self):
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user....
r191 user = session['hg_app_user']
c.admin_user = user.is_admin
c.admin_username = user.username
super(AdminController, self).__before__()
changed for pylons 0.1 / 1.0...
r43
def index(self):
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user....
r191 sa = meta.Session
users_log = sa.query(UserLogs)\
.order_by(UserLogs.action_date.desc())
p = int(request.params.get('page', 1))
c.users_log = Page(users_log, page=p, items_per_page=10)
c.log_data = render('admin/admin_log.html')
if request.params.get('partial'):
return c.log_data
Html changes and cleanups, made folders for html templates, implemented tags and branches pages
r127 return render('admin/admin.html')
changed for pylons 0.1 / 1.0...
r43
def add_repo(self, new_repo):
#extra check it can be add since it's the command
Added managment pages....
r44 if new_repo == '_admin':
c.msg = 'DENIED'
changed for pylons 0.1 / 1.0...
r43 c.new_repo = ''
Changed creation of repository to vcs implementation,...
r133 return render('admin/add.html')
changed for pylons 0.1 / 1.0...
r43
new_repo = new_repo.replace(" ", "_")
new_repo = new_repo.replace("-", "_")
try:
self._create_repo(new_repo)
c.new_repo = new_repo
c.msg = 'added repo'
Changed creation of repository to vcs implementation,...
r133 #clear our cached list for refresh with new repo
Added universal cache invalidator for two cached functions....
r171 invalidate_cache('cached_repo_list')
changed for pylons 0.1 / 1.0...
r43 except Exception as e:
c.new_repo = 'Exception when adding: %s' % new_repo
c.msg = str(e)
Changed creation of repository to vcs implementation,...
r133 return render('admin/add.html')
changed for pylons 0.1 / 1.0...
r43
def _create_repo(self, repo_name):
if repo_name in [None, '', 'add']:
raise Exception('undefined repo_name of repo')
Changed creation of repository to vcs implementation,...
r133 repo_path = os.path.join(g.base_path, repo_name)
Moved check_repo function to utils, error controller check for first name in url, for this repo and only prints 404 make repo template if repo does not exists, moded check repo from admin
r125 if check_repo(repo_name, g.base_path):
Changed creation of repository to vcs implementation,...
r133 log.info('creating repo %s in %s', repo_name, repo_path)
from vcs.backends.hg import MercurialRepository
MercurialRepository(repo_path, create=True)