Show More
@@ -38,7 +38,7 b' from pylons_app.model.forms import UserF' | |||
|
38 | 38 | ApplicationUiSettingsForm |
|
39 | 39 | from pylons_app.model.hg_model import HgModel |
|
40 | 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 | 42 | import formencode |
|
43 | 43 | import logging |
|
44 | 44 | import traceback |
@@ -105,8 +105,8 b' class SettingsController(BaseController)' | |||
|
105 | 105 | |
|
106 | 106 | if setting_id == 'whoosh': |
|
107 | 107 | repo_location = get_hg_ui_settings()['paths_root_path'] |
|
108 | full_index = request.POST.get('full_index',False) | |
|
109 | task = run_task(tasks.whoosh_index,repo_location,full_index) | |
|
108 | full_index = request.POST.get('full_index', False) | |
|
109 | task = run_task(tasks.whoosh_index, repo_location, full_index) | |
|
110 | 110 | |
|
111 | 111 | h.flash(_('Whoosh reindex task scheduled'), category='success') |
|
112 | 112 | if setting_id == 'global': |
@@ -260,7 +260,8 b' class SettingsController(BaseController)' | |||
|
260 | 260 | # url('admin_settings_my_account_update', id=ID) |
|
261 | 261 | user_model = UserModel() |
|
262 | 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 | 265 | form_result = {} |
|
265 | 266 | try: |
|
266 | 267 | form_result = _form.to_python(dict(request.POST)) |
@@ -269,7 +270,11 b' class SettingsController(BaseController)' | |||
|
269 | 270 | category='success') |
|
270 | 271 | |
|
271 | 272 | except formencode.Invalid as errors: |
|
272 |
|
|
|
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 | 278 | return htmlfill.render( |
|
274 | 279 | render('admin/users/user_edit_my_account.html'), |
|
275 | 280 | defaults=errors.value, |
@@ -221,6 +221,7 b' class EmptyChangeset(BaseChangeset):' | |||
|
221 | 221 | |
|
222 | 222 | revision = -1 |
|
223 | 223 | message = '' |
|
224 | author = '' | |
|
224 | 225 | |
|
225 | 226 | @LazyProperty |
|
226 | 227 | def raw_id(self): |
@@ -414,7 +415,7 b' e/8cHEcHpf1/CI+jHwEP3AToLtx8e9/9e//w8Hun' | |||
|
414 | 415 | MdfNQo9P+eS7youNdyVuJq4ot2zRsdnLgLCYYip/b7w5jKqUX51IREv4F/FJ7YBy96ja963sJS\n34yd |
|
415 | 416 | OXDGKEud/R8efZUt\n |
|
416 | 417 | """ |
|
417 | newdb = open('test.db','wb') | |
|
418 | newdb = open('test.db', 'wb') | |
|
418 | 419 | newdb.write(new_db_dump.decode('base64').decode('zlib')) |
|
419 | 420 | newdb.close() |
|
420 | 421 | |
@@ -424,9 +425,9 b' OXDGKEud/R8efZUt\\n' | |||
|
424 | 425 | shutil.rmtree('/tmp/vcs_test') |
|
425 | 426 | |
|
426 | 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 | 429 | tar.extractall('/tmp') |
|
429 | 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 | 209 | raise formencode.Invalid(msg, value, state, |
|
210 | 210 | error_dict={'paths_root_path':msg}) |
|
211 | 211 | |
|
212 | class UniqSystemEmail(formencode.validators.FancyValidator): | |
|
213 | def to_python(self, value, state): | |
|
214 | sa = meta.Session | |
|
215 | try: | |
|
216 | user = sa.query(User).filter(User.email == value).scalar() | |
|
217 |
|
|
|
218 | raise formencode.Invalid(_("That e-mail address is already taken") , | |
|
219 | value, state) | |
|
220 | finally: | |
|
221 | meta.Session.remove() | |
|
222 | ||
|
223 | return value | |
|
212 | def UniqSystemEmail(old_data): | |
|
213 | class _UniqSystemEmail(formencode.validators.FancyValidator): | |
|
214 | def to_python(self, value, state): | |
|
215 | if old_data['email'] != value: | |
|
216 | sa = meta.Session | |
|
217 | try: | |
|
218 | user = sa.query(User).filter(User.email == value).scalar() | |
|
219 | if user: | |
|
220 | raise formencode.Invalid(_("That e-mail address is already taken") , | |
|
221 | value, state) | |
|
222 | finally: | |
|
223 | meta.Session.remove() | |
|
224 | ||
|
225 | return value | |
|
226 | ||
|
227 | return _UniqSystemEmail | |
|
224 | 228 | |
|
225 | 229 | class ValidSystemEmail(formencode.validators.FancyValidator): |
|
226 | 230 | def to_python(self, value, state): |
@@ -276,7 +280,7 b' def UserForm(edit=False, old_data={}):' | |||
|
276 | 280 | active = StringBoolean(if_missing=False) |
|
277 | 281 | name = UnicodeString(strip=True, min=3, not_empty=True) |
|
278 | 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 | 285 | return _UserForm |
|
282 | 286 |
@@ -77,7 +77,7 b' E.onDOMReady(function(e){' | |||
|
77 | 77 | </div> |
|
78 | 78 | <div class="input-short"> |
|
79 | 79 | ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)} |
|
80 |
${_('by')} ${ |
|
|
80 | ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author} | |
|
81 | 81 | |
|
82 | 82 | </div> |
|
83 | 83 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now