Changeset - c3236d7febad
[Not reviewed]
default
0 3 0
Marcin Kuzminski - 15 years ago 2010-09-03 09:55:48
marcin@python-works.com
fixed, empty cs bug.
Implemented as webhlepers function
3 files changed with 19 insertions and 8 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/helpers.py
Show inline comments
 
@@ -286,6 +286,21 @@ def repo_name_slug(value):
 
    slug = recursive_replace(slug, '-')
 
    return slug
 

	
 
def get_changeset_safe(repo, rev):
 
    from vcs.backends.base import BaseRepository
 
    from vcs.exceptions import RepositoryError
 
    if not isinstance(repo, BaseRepository):
 
        raise Exception('You must pass an Repository '
 
                        'object as first argument got %s', type(repo))
 
        
 
    try:
 
        cs = repo.get_changeset(rev)
 
    except RepositoryError:
 
        from pylons_app.lib.utils import EmptyChangeset
 
        cs = EmptyChangeset()
 
    return cs
 

	
 

	
 
flash = _Flash()
 

	
 

	
 
@@ -351,4 +366,4 @@ def safe_unicode(str):
 
            #incase we have a decode error just represent as byte string
 
            u_str = unicode(str(str).encode('string_escape'))
 
        
 
    return u_str
 
\ No newline at end of file
 
    return u_str
pylons_app/model/hg_model.py
Show inline comments
 
@@ -29,7 +29,7 @@ from pylons.i18n.translation import _
 
from pylons_app.lib.auth import HasRepoPermissionAny
 
from pylons_app.model import meta
 
from pylons_app.model.db import Repository, User
 
from sqlalchemy.orm import joinedload
 
from pylons_app.lib import helpers as h
 
from vcs.exceptions import RepositoryError, VCSError
 
import logging
 
import os
 
@@ -151,11 +151,7 @@ class HgModel(object):
 
                continue
 
            
 
            last_change = repo.last_change
 
            try:
 
                tip = repo.get_changeset('tip')
 
            except RepositoryError:
 
                from pylons_app.lib.utils import EmptyChangeset
 
                tip = EmptyChangeset()
 
            tip = h.get_changeset_safe(repo, 'tip')
 
                
 
            tmp_d = {}
 
            tmp_d['name'] = repo.name
pylons_app/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -98,7 +98,7 @@
 
	             %endif
 
	                                             
 
	            ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td> 
 
	            <td>${_('revision')}: ${repo.revisions[-1]}</td>
 
	            <td>${_('revision')}: ${h.get_changeset_safe(repo,'tip').revision}</td>
 
	            <td>${_('last changed')}: ${h.age(repo.last_change)}</td>
 
	            <td><img class="icon" alt="${_('private')}" src="/images/icons/application_form_edit.png"/> ${h.link_to(_('edit'),h.url('edit_repo',repo_name=repo.name))}</td>
 
	        </tr>
0 comments (0 inline, 0 general)