##// END OF EJS Templates
replaced all global calls to template context (rhodecode_user), into instance attributes
marcink -
r1121:f3f84771 beta
parent child Browse files
Show More
@@ -158,7 +158,7 b' class ReposController(BaseController):'
158 form_result = {}
158 form_result = {}
159 try:
159 try:
160 form_result = RepoForm()(repo_groups=c.repo_groups).to_python(dict(request.POST))
160 form_result = RepoForm()(repo_groups=c.repo_groups).to_python(dict(request.POST))
161 repo_model.create(form_result, c.rhodecode_user)
161 repo_model.create(form_result, self.rhodecode_user)
162 if form_result['clone_uri']:
162 if form_result['clone_uri']:
163 h.flash(_('created repository %s from %s') \
163 h.flash(_('created repository %s from %s') \
164 % (form_result['repo_name'], form_result['clone_uri']),
164 % (form_result['repo_name'], form_result['clone_uri']),
@@ -383,7 +383,7 b' class ReposController(BaseController):'
383 :param repo_name:
383 :param repo_name:
384 """
384 """
385 try:
385 try:
386 ScmModel().pull_changes(repo_name, c.rhodecode_user.username)
386 ScmModel().pull_changes(repo_name, self.rhodecode_user.username)
387 h.flash(_('Pulled from remote location'), category='success')
387 h.flash(_('Pulled from remote location'), category='success')
388 except Exception, e:
388 except Exception, e:
389 h.flash(_('An error occurred during pull from remote location'),
389 h.flash(_('An error occurred during pull from remote location'),
@@ -255,7 +255,7 b' class SettingsController(BaseController)'
255 """
255 """
256 # url('admin_settings_my_account')
256 # url('admin_settings_my_account')
257
257
258 c.user = UserModel().get(c.rhodecode_user.user_id, cache=False)
258 c.user = UserModel().get(self.rhodecode_user.user_id, cache=False)
259 all_repos = [r.repo_name for r in self.sa.query(Repository)\
259 all_repos = [r.repo_name for r in self.sa.query(Repository)\
260 .filter(Repository.user_id == c.user.user_id)\
260 .filter(Repository.user_id == c.user.user_id)\
261 .order_by(func.lower(Repository.repo_name)).all()]
261 .order_by(func.lower(Repository.repo_name)).all()]
@@ -283,9 +283,9 b' class SettingsController(BaseController)'
283 # method='put')
283 # method='put')
284 # url('admin_settings_my_account_update', id=ID)
284 # url('admin_settings_my_account_update', id=ID)
285 user_model = UserModel()
285 user_model = UserModel()
286 uid = c.rhodecode_user.user_id
286 uid = self.rhodecode_user.user_id
287 _form = UserForm(edit=True, old_data={'user_id':uid,
287 _form = UserForm(edit=True, old_data={'user_id':uid,
288 'email':c.rhodecode_user.email})()
288 'email':self.rhodecode_user.email})()
289 form_result = {}
289 form_result = {}
290 try:
290 try:
291 form_result = _form.to_python(dict(request.POST))
291 form_result = _form.to_python(dict(request.POST))
@@ -294,8 +294,8 b' class SettingsController(BaseController)'
294 category='success')
294 category='success')
295
295
296 except formencode.Invalid, errors:
296 except formencode.Invalid, errors:
297 c.user = user_model.get(c.rhodecode_user.user_id, cache=False)
297 c.user = user_model.get(self.rhodecode_user.user_id, cache=False)
298 c.user = UserModel().get(c.rhodecode_user.user_id, cache=False)
298 c.user = UserModel().get(self.rhodecode_user.user_id, cache=False)
299 all_repos = self.sa.query(Repository)\
299 all_repos = self.sa.query(Repository)\
300 .filter(Repository.user_id == c.user.user_id)\
300 .filter(Repository.user_id == c.user.user_id)\
301 .order_by(func.lower(Repository.repo_name))\
301 .order_by(func.lower(Repository.repo_name))\
@@ -49,7 +49,7 b' class JournalController(BaseController):'
49
49
50 def __before__(self):
50 def __before__(self):
51 super(JournalController, self).__before__()
51 super(JournalController, self).__before__()
52 c.rhodecode_user = self.rhodecode_user
52 self.rhodecode_user = self.rhodecode_user
53 self.title = _('%s public journal %s feed') % (c.rhodecode_name, '%s')
53 self.title = _('%s public journal %s feed') % (c.rhodecode_name, '%s')
54 self.language = 'en-us'
54 self.language = 'en-us'
55 self.ttl = "5"
55 self.ttl = "5"
@@ -52,8 +52,8 b' class LoginController(BaseController):'
52 #redirect if already logged in
52 #redirect if already logged in
53 c.came_from = request.GET.get('came_from', None)
53 c.came_from = request.GET.get('came_from', None)
54
54
55 if c.rhodecode_user.is_authenticated \
55 if self.rhodecode_user.is_authenticated \
56 and c.rhodecode_user.username != 'default':
56 and self.rhodecode_user.username != 'default':
57
57
58 return redirect(url('home'))
58 return redirect(url('home'))
59
59
@@ -189,7 +189,7 b' class SettingsController(BaseRepoControl'
189 try:
189 try:
190 form_result = _form.to_python(dict(request.POST))
190 form_result = _form.to_python(dict(request.POST))
191 form_result.update({'repo_name':repo_name})
191 form_result.update({'repo_name':repo_name})
192 repo_model.create_fork(form_result, c.rhodecode_user)
192 repo_model.create_fork(form_result, self.rhodecode_user)
193 h.flash(_('forked %s repository as %s') \
193 h.flash(_('forked %s repository as %s') \
194 % (repo_name, form_result['fork_name']),
194 % (repo_name, form_result['fork_name']),
195 category='success')
195 category='success')
@@ -65,7 +65,7 b' class SummaryController(BaseRepoControll'
65 c.dbrepo = dbrepo
65 c.dbrepo = dbrepo
66
66
67 c.following = self.scm_model.is_following_repo(c.repo_name,
67 c.following = self.scm_model.is_following_repo(c.repo_name,
68 c.rhodecode_user.user_id)
68 self.rhodecode_user.user_id)
69 def url_generator(**kw):
69 def url_generator(**kw):
70 return url('shortlog_home', repo_name=c.repo_name, **kw)
70 return url('shortlog_home', repo_name=c.repo_name, **kw)
71
71
@@ -79,7 +79,7 b' class SummaryController(BaseRepoControll'
79 username = ''
79 username = ''
80 password = ''
80 password = ''
81 else:
81 else:
82 username = str(c.rhodecode_user.username)
82 username = str(self.rhodecode_user.username)
83 password = '@'
83 password = '@'
84
84
85 uri = u'%(protocol)s://%(user)s%(password)s%(host)s%(prefix)s/%(repo_name)s' % {
85 uri = u'%(protocol)s://%(user)s%(password)s%(host)s%(prefix)s/%(repo_name)s' % {
General Comments 0
You need to be logged in to leave comments. Login now