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 23 insertions and 12 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/helpers.py
Show inline comments
 
@@ -219,7 +219,7 @@ def pygmentize(filenode, **kwargs):
 
    pygmentize function using pygments
 
    @param filenode:
 
    """
 
    return literal(code_highlight(filenode.content, 
 
    return literal(code_highlight(filenode.content,
 
                                  filenode.lexer, HtmlFormatter(**kwargs)))
 

	
 
def pygmentize_annotation(filenode, **kwargs):
 
@@ -239,11 +239,11 @@ def pygmentize_annotation(filenode, **kw
 
        h = 0.22717784590367374
 
        #generate 10k nice web friendly colors in the same order
 
        for c in xrange(n):
 
            h +=golden_ratio
 
            h += golden_ratio
 
            h %= 1
 
            HSV_tuple = [h, 0.95, 0.95]
 
            RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
 
            yield map(lambda x:str(int(x*256)),RGB_tuple)           
 
            yield map(lambda x:str(int(x * 256)), RGB_tuple)           
 

	
 
    cgenerator = gen_color()
 
        
 
@@ -255,7 +255,7 @@ def pygmentize_annotation(filenode, **kw
 
        return "color: rgb(%s)! important;" % (', '.join(col))
 
        
 
    def url_func(changeset):
 
        tooltip_html = "<div style='font-size:0.8em'><b>Author:</b>"+\
 
        tooltip_html = "<div style='font-size:0.8em'><b>Author:</b>" + \
 
        " %s<br/><b>Date:</b> %s</b><br/><b>Message:</b> %s<br/></div>" 
 
        
 
        tooltip_html = tooltip_html % (changeset.author,
 
@@ -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)