##// END OF EJS Templates
fixed bug when new repo had no last commiter,...
marcink -
r489:460ad816 celery
parent child Browse files
Show More
@@ -38,7 +38,7 b' from pylons_app.model.forms import UserF'
38 ApplicationUiSettingsForm
38 ApplicationUiSettingsForm
39 from pylons_app.model.hg_model import HgModel
39 from pylons_app.model.hg_model import HgModel
40 from pylons_app.model.user_model import UserModel
40 from pylons_app.model.user_model import UserModel
41 from pylons_app.lib.celerylib import tasks,run_task
41 from pylons_app.lib.celerylib import tasks, run_task
42 import formencode
42 import formencode
43 import logging
43 import logging
44 import traceback
44 import traceback
@@ -105,8 +105,8 b' class SettingsController(BaseController)'
105
105
106 if setting_id == 'whoosh':
106 if setting_id == 'whoosh':
107 repo_location = get_hg_ui_settings()['paths_root_path']
107 repo_location = get_hg_ui_settings()['paths_root_path']
108 full_index = request.POST.get('full_index',False)
108 full_index = request.POST.get('full_index', False)
109 task = run_task(tasks.whoosh_index,repo_location,full_index)
109 task = run_task(tasks.whoosh_index, repo_location, full_index)
110
110
111 h.flash(_('Whoosh reindex task scheduled'), category='success')
111 h.flash(_('Whoosh reindex task scheduled'), category='success')
112 if setting_id == 'global':
112 if setting_id == 'global':
@@ -260,7 +260,8 b' class SettingsController(BaseController)'
260 # url('admin_settings_my_account_update', id=ID)
260 # url('admin_settings_my_account_update', id=ID)
261 user_model = UserModel()
261 user_model = UserModel()
262 uid = c.hg_app_user.user_id
262 uid = c.hg_app_user.user_id
263 _form = UserForm(edit=True, old_data={'user_id':uid})()
263 _form = UserForm(edit=True, old_data={'user_id':uid,
264 'email':c.hg_app_user.email})()
264 form_result = {}
265 form_result = {}
265 try:
266 try:
266 form_result = _form.to_python(dict(request.POST))
267 form_result = _form.to_python(dict(request.POST))
@@ -269,7 +270,11 b' class SettingsController(BaseController)'
269 category='success')
270 category='success')
270
271
271 except formencode.Invalid as errors:
272 except formencode.Invalid as errors:
272 #c.user = self.sa.query(User).get(c.hg_app_user.user_id)
273 c.user = self.sa.query(User).get(c.hg_app_user.user_id)
274 c.user_repos = []
275 for repo in c.cached_repo_list.values():
276 if repo.dbrepo.user.username == c.user.username:
277 c.user_repos.append(repo)
273 return htmlfill.render(
278 return htmlfill.render(
274 render('admin/users/user_edit_my_account.html'),
279 render('admin/users/user_edit_my_account.html'),
275 defaults=errors.value,
280 defaults=errors.value,
@@ -221,6 +221,7 b' class EmptyChangeset(BaseChangeset):'
221
221
222 revision = -1
222 revision = -1
223 message = ''
223 message = ''
224 author = ''
224
225
225 @LazyProperty
226 @LazyProperty
226 def raw_id(self):
227 def raw_id(self):
@@ -414,7 +415,7 b' e/8cHEcHpf1/CI+jHwEP3AToLtx8e9/9e//w8Hun'
414 MdfNQo9P+eS7youNdyVuJq4ot2zRsdnLgLCYYip/b7w5jKqUX51IREv4F/FJ7YBy96ja963sJS\n34yd
415 MdfNQo9P+eS7youNdyVuJq4ot2zRsdnLgLCYYip/b7w5jKqUX51IREv4F/FJ7YBy96ja963sJS\n34yd
415 OXDGKEud/R8efZUt\n
416 OXDGKEud/R8efZUt\n
416 """
417 """
417 newdb = open('test.db','wb')
418 newdb = open('test.db', 'wb')
418 newdb.write(new_db_dump.decode('base64').decode('zlib'))
419 newdb.write(new_db_dump.decode('base64').decode('zlib'))
419 newdb.close()
420 newdb.close()
420
421
@@ -424,9 +425,9 b' OXDGKEud/R8efZUt\\n'
424 shutil.rmtree('/tmp/vcs_test')
425 shutil.rmtree('/tmp/vcs_test')
425
426
426 cur_dir = dn(dn(os.path.abspath(__file__)))
427 cur_dir = dn(dn(os.path.abspath(__file__)))
427 tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz"))
428 tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test.tar.gz"))
428 tar.extractall('/tmp')
429 tar.extractall('/tmp')
429 tar.close()
430 tar.close()
430
431
431
432
432 No newline at end of file
433
@@ -209,18 +209,22 b' class ValidPath(formencode.validators.Fa'
209 raise formencode.Invalid(msg, value, state,
209 raise formencode.Invalid(msg, value, state,
210 error_dict={'paths_root_path':msg})
210 error_dict={'paths_root_path':msg})
211
211
212 class UniqSystemEmail(formencode.validators.FancyValidator):
212 def UniqSystemEmail(old_data):
213 def to_python(self, value, state):
213 class _UniqSystemEmail(formencode.validators.FancyValidator):
214 sa = meta.Session
214 def to_python(self, value, state):
215 try:
215 if old_data['email'] != value:
216 user = sa.query(User).filter(User.email == value).scalar()
216 sa = meta.Session
217 if user:
217 try:
218 raise formencode.Invalid(_("That e-mail address is already taken") ,
218 user = sa.query(User).filter(User.email == value).scalar()
219 value, state)
219 if user:
220 finally:
220 raise formencode.Invalid(_("That e-mail address is already taken") ,
221 meta.Session.remove()
221 value, state)
222
222 finally:
223 return value
223 meta.Session.remove()
224
225 return value
226
227 return _UniqSystemEmail
224
228
225 class ValidSystemEmail(formencode.validators.FancyValidator):
229 class ValidSystemEmail(formencode.validators.FancyValidator):
226 def to_python(self, value, state):
230 def to_python(self, value, state):
@@ -276,7 +280,7 b' def UserForm(edit=False, old_data={}):'
276 active = StringBoolean(if_missing=False)
280 active = StringBoolean(if_missing=False)
277 name = UnicodeString(strip=True, min=3, not_empty=True)
281 name = UnicodeString(strip=True, min=3, not_empty=True)
278 lastname = UnicodeString(strip=True, min=3, not_empty=True)
282 lastname = UnicodeString(strip=True, min=3, not_empty=True)
279 email = All(Email(not_empty=True), UniqSystemEmail())
283 email = All(Email(not_empty=True), UniqSystemEmail(old_data))
280
284
281 return _UserForm
285 return _UserForm
282
286
@@ -77,7 +77,7 b' E.onDOMReady(function(e){'
77 </div>
77 </div>
78 <div class="input-short">
78 <div class="input-short">
79 ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)}
79 ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)}
80 ${_('by')} ${c.repo_info.get_changeset('tip').author}
80 ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author}
81
81
82 </div>
82 </div>
83 </div>
83 </div>
General Comments 0
You need to be logged in to leave comments. Login now