Changeset - 460ad816820d
[Not reviewed]
celery
0 4 0
Marcin Kuzminski - 15 years ago 2010-09-20 22:47:20
marcin@python-works.com
fixed bug when new repo had no last commiter,
fixed bug when my_account updating information failed, by not uniq email address.
4 files changed with 16 insertions and 5 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin/settings.py
Show inline comments
 
@@ -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,
pylons_app/lib/utils.py
Show inline comments
 
@@ -221,6 +221,7 @@ class EmptyChangeset(BaseChangeset):
 
    
 
    revision = -1
 
    message = ''
 
    author = ''
 
    
 
    @LazyProperty
 
    def raw_id(self):
 
@@ -429,4 +430,5 @@ OXDGKEud/R8efZUt\n
 
    tar.close()
 
    
 
    
 
    
 
    
 
\ No newline at end of file
pylons_app/model/forms.py
Show inline comments
 
@@ -209,8 +209,10 @@ class ValidPath(formencode.validators.Fa
 
        raise formencode.Invalid(msg, value, state,
 
                                     error_dict={'paths_root_path':msg})            
 

	
 
class UniqSystemEmail(formencode.validators.FancyValidator):
 
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()
 
@@ -222,6 +224,8 @@ class UniqSystemEmail(formencode.validat
 
            
 
        return value 
 
    
 
    return _UniqSystemEmail
 
    
 
class ValidSystemEmail(formencode.validators.FancyValidator):
 
    def to_python(self, value, state):
 
        sa = meta.Session
 
@@ -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
 

	
pylons_app/templates/summary/summary.html
Show inline comments
 
@@ -77,7 +77,7 @@ E.onDOMReady(function(e){
 
			  </div>
 
			  <div class="input-short">
 
			      ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)} 
 
			      ${_('by')} ${c.repo_info.get_changeset('tip').author} 
 
			      ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author} 
 
			      
 
			  </div>
 
			 </div>
0 comments (0 inline, 0 general)