diff --git a/pylons_app/controllers/admin/settings.py b/pylons_app/controllers/admin/settings.py --- a/pylons_app/controllers/admin/settings.py +++ b/pylons_app/controllers/admin/settings.py @@ -38,7 +38,7 @@ from pylons_app.model.forms import UserF ApplicationUiSettingsForm from pylons_app.model.hg_model import HgModel from pylons_app.model.user_model import UserModel -from pylons_app.lib.celerylib import tasks,run_task +from pylons_app.lib.celerylib import tasks, run_task import formencode import logging import traceback @@ -105,8 +105,8 @@ class SettingsController(BaseController) if setting_id == 'whoosh': repo_location = get_hg_ui_settings()['paths_root_path'] - full_index = request.POST.get('full_index',False) - task = run_task(tasks.whoosh_index,repo_location,full_index) + full_index = request.POST.get('full_index', False) + task = run_task(tasks.whoosh_index, repo_location, full_index) h.flash(_('Whoosh reindex task scheduled'), category='success') if setting_id == 'global': @@ -260,7 +260,8 @@ class SettingsController(BaseController) # url('admin_settings_my_account_update', id=ID) user_model = UserModel() uid = c.hg_app_user.user_id - _form = UserForm(edit=True, old_data={'user_id':uid})() + _form = UserForm(edit=True, old_data={'user_id':uid, + 'email':c.hg_app_user.email})() form_result = {} try: form_result = _form.to_python(dict(request.POST)) @@ -269,7 +270,11 @@ class SettingsController(BaseController) category='success') except formencode.Invalid as errors: - #c.user = self.sa.query(User).get(c.hg_app_user.user_id) + c.user = self.sa.query(User).get(c.hg_app_user.user_id) + c.user_repos = [] + for repo in c.cached_repo_list.values(): + if repo.dbrepo.user.username == c.user.username: + c.user_repos.append(repo) return htmlfill.render( render('admin/users/user_edit_my_account.html'), defaults=errors.value, diff --git a/pylons_app/lib/utils.py b/pylons_app/lib/utils.py --- a/pylons_app/lib/utils.py +++ b/pylons_app/lib/utils.py @@ -221,6 +221,7 @@ class EmptyChangeset(BaseChangeset): revision = -1 message = '' + author = '' @LazyProperty def raw_id(self): @@ -414,7 +415,7 @@ e/8cHEcHpf1/CI+jHwEP3AToLtx8e9/9e//w8Hun MdfNQo9P+eS7youNdyVuJq4ot2zRsdnLgLCYYip/b7w5jKqUX51IREv4F/FJ7YBy96ja963sJS\n34yd OXDGKEud/R8efZUt\n """ - newdb = open('test.db','wb') + newdb = open('test.db', 'wb') newdb.write(new_db_dump.decode('base64').decode('zlib')) newdb.close() @@ -424,9 +425,9 @@ OXDGKEud/R8efZUt\n shutil.rmtree('/tmp/vcs_test') cur_dir = dn(dn(os.path.abspath(__file__))) - tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz")) + tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test.tar.gz")) tar.extractall('/tmp') tar.close() - \ No newline at end of file + diff --git a/pylons_app/model/forms.py b/pylons_app/model/forms.py --- a/pylons_app/model/forms.py +++ b/pylons_app/model/forms.py @@ -209,18 +209,22 @@ class ValidPath(formencode.validators.Fa raise formencode.Invalid(msg, value, state, error_dict={'paths_root_path':msg}) -class UniqSystemEmail(formencode.validators.FancyValidator): - def to_python(self, value, state): - sa = meta.Session - try: - user = sa.query(User).filter(User.email == value).scalar() - if user: - raise formencode.Invalid(_("That e-mail address is already taken") , - value, state) - finally: - meta.Session.remove() - - return value +def UniqSystemEmail(old_data): + class _UniqSystemEmail(formencode.validators.FancyValidator): + def to_python(self, value, state): + if old_data['email'] != value: + sa = meta.Session + try: + user = sa.query(User).filter(User.email == value).scalar() + if user: + raise formencode.Invalid(_("That e-mail address is already taken") , + value, state) + finally: + meta.Session.remove() + + return value + + return _UniqSystemEmail class ValidSystemEmail(formencode.validators.FancyValidator): def to_python(self, value, state): @@ -276,7 +280,7 @@ def UserForm(edit=False, old_data={}): active = StringBoolean(if_missing=False) name = UnicodeString(strip=True, min=3, not_empty=True) lastname = UnicodeString(strip=True, min=3, not_empty=True) - email = All(Email(not_empty=True), UniqSystemEmail()) + email = All(Email(not_empty=True), UniqSystemEmail(old_data)) return _UserForm diff --git a/pylons_app/templates/summary/summary.html b/pylons_app/templates/summary/summary.html --- a/pylons_app/templates/summary/summary.html +++ b/pylons_app/templates/summary/summary.html @@ -77,7 +77,7 @@ E.onDOMReady(function(e){