comparison pylons_app/controllers/repos.py @ 140:b5e59e2b5cfe

moved cache invalidating to utils, as seperate function. Implemented invalidating in
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 09 May 2010 15:06:00 +0200
parents 20dc7a5eb748
children 988477a05db6
comparison
equal deleted inserted replaced
139:f96f4cbf89ae 140:b5e59e2b5cfe
8 from pylons_app.model.db import Users, UserLogs 8 from pylons_app.model.db import Users, UserLogs
9 from pylons_app.lib.auth import authenticate 9 from pylons_app.lib.auth import authenticate
10 from pylons_app.model.hg_model import HgModel 10 from pylons_app.model.hg_model import HgModel
11 from operator import itemgetter 11 from operator import itemgetter
12 import shutil 12 import shutil
13 from pylons_app.lib.utils import invalidate_cache
13 log = logging.getLogger(__name__) 14 log = logging.getLogger(__name__)
14 15
15 class ReposController(BaseController): 16 class ReposController(BaseController):
16 """REST Controller styled on the Atom Publishing Protocol""" 17 """REST Controller styled on the Atom Publishing Protocol"""
17 # To properly map this controller, ensure your config/routing.py 18 # To properly map this controller, ensure your config/routing.py
62 path = g.paths[0][1].replace('*', '') 63 path = g.paths[0][1].replace('*', '')
63 rm_path = os.path.join(path, id) 64 rm_path = os.path.join(path, id)
64 log.info("Removing %s", rm_path) 65 log.info("Removing %s", rm_path)
65 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg')) 66 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg'))
66 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id))) 67 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id)))
68
69 #clear our cached list for refresh with new repo
70 invalidate_cache('repo_list_2')
71
67 return redirect(url('repos')) 72 return redirect(url('repos'))
68 73
69 74
70 def show(self, id, format='html'): 75 def show(self, id, format='html'):
71 """GET /repos/id: Show a specific item""" 76 """GET /repos/id: Show a specific item"""