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
 
@@ -257,22 +257,27 @@ class SettingsController(BaseController)
 
        # Or using helpers:
 
        #    h.form(url('admin_settings_my_account_update'),
 
        #           method='put')
 
        # 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))
 
            user_model.update_my_account(uid, form_result)
 
            h.flash(_('Your account was updated succesfully'),
 
                    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,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8")
pylons_app/lib/utils.py
Show inline comments
 
@@ -218,12 +218,13 @@ def invalidate_cache(name, *args):
 
        region_invalidate(_full_changelog_cached, None, *args)
 
        
 
class EmptyChangeset(BaseChangeset):
 
    
 
    revision = -1
 
    message = ''
 
    author = ''
 
    
 
    @LazyProperty
 
    def raw_id(self):
 
        """
 
        Returns raw string identifing this changeset, useful for web
 
        representation.
 
@@ -426,7 +427,8 @@ OXDGKEud/R8efZUt\n
 
    cur_dir = dn(dn(os.path.abspath(__file__)))
 
    tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz"))
 
    tar.extractall('/tmp')
 
    tar.close()
 
    
 
    
 
    
 
    
 
\ No newline at end of file
pylons_app/model/forms.py
Show inline comments
 
@@ -206,25 +206,29 @@ class ValidPath(formencode.validators.Fa
 
        else:
 
            msg = _('You need to specify * or ** at the end of path (ie. /tmp/*)')
 
        
 
        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()
 
            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):
 
        sa = meta.Session
 
        try:
 
            user = sa.query(User).filter(User.email == value).scalar()
 
            if  user is None:
 
@@ -273,13 +277,13 @@ def UserForm(edit=False, old_data={}):
 
            admin = StringBoolean(if_missing=False)
 
        else:
 
            password = All(UnicodeString(strip=True, min=8, not_empty=True), ValidPassword)
 
        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
 

	
 
RegisterForm = UserForm
 

	
 
def PasswordResetForm():
pylons_app/templates/summary/summary.html
Show inline comments
 
@@ -74,13 +74,13 @@ E.onDOMReady(function(e){
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Last change')}:</label>
 
			  </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>
 
			
 
			 <div class="field">
 
			  <div class="label">
0 comments (0 inline, 0 general)