# HG changeset patch # User Marcin Kuzminski # Date 2011-02-26 15:04:38 # Node ID 51076a2a2b64bdf47551d5b470b22616b8f54924 # Parent b25a9f13fda146bae4c8744853ed7c49bb4b76f0 fixed unicode problems with file paths. added feed arg to journal action mapper diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -422,11 +422,12 @@ def bool2icon(value): return value -def action_parser(user_log): - """This helper will map the specified string action into translated +def action_parser(user_log, feed=False): + """This helper will action_map the specified string action into translated fancy names with icons and links :param user_log: user log instance + :param feed: use output for feeds (no html and fancy icons) """ action = user_log.action @@ -470,11 +471,16 @@ def action_parser(user_log): html_tmpl = (' %s ' '%s ' '%s') - cs_links += html_tmpl % (_('and'), uniq_id, _('%s more') \ + if not feed: + cs_links += html_tmpl % (_('and'), uniq_id, _('%s more') \ % (len(revs) - revs_limit), _('revisions')) - html_tmpl = '' + if not feed: + html_tmpl = '' + else: + html_tmpl = ' %s ' + cs_links += html_tmpl % (uniq_id, ', '.join([link_to(rev, url('changeset_home', repo_name=repo_name, revision=rev), @@ -489,7 +495,7 @@ def action_parser(user_log): return _('fork name ') + str(link_to(action_params, url('summary_home', repo_name=repo_name,))) - map = {'user_deleted_repo':(_('[deleted] repository'), None), + action_map = {'user_deleted_repo':(_('[deleted] repository'), None), 'user_created_repo':(_('[created] repository'), None), 'user_forked_repo':(_('[forked] repository'), get_fork_name), 'user_updated_repo':(_('[updated] repository'), None), @@ -503,8 +509,11 @@ def action_parser(user_log): 'stopped_following_repo':(_('[stopped following] repository'), None), } - action_str = map.get(action, action) - action = action_str[0].replace('[', '')\ + action_str = action_map.get(action, action) + if feed: + action = action_str[0].replace('[', '').replace(']', '') + else: + action = action_str[0].replace('[', '')\ .replace(']', '') action_params_func = lambda :"" @@ -588,6 +597,6 @@ def changed_tooltip(nodes): suf = '' if len(nodes) > 30: suf = '
' + _(' and %s more') % (len(nodes) - 30) - return literal(pref + '
'.join([x.path for x in nodes[:30]]) + suf) + return literal(pref + '
'.join([x.path.decode('utf-8') for x in nodes[:30]]) + suf) else: return ': ' + _('No Files') diff --git a/rhodecode/templates/changeset/changeset.html b/rhodecode/templates/changeset/changeset.html --- a/rhodecode/templates/changeset/changeset.html +++ b/rhodecode/templates/changeset/changeset.html @@ -81,7 +81,7 @@ ${_('Files affected')}
%for change,filenode,diff,cs1,cs2 in c.changes: -
${h.link_to(filenode.path,h.url.current(anchor=h.repo_name_slug('C%s' % filenode.path)))}
+
${h.link_to(filenode.path.decode('utf-8'),h.url.current(anchor=h.repo_name_slug('C%s' % filenode.path.decode('utf-8'))))}
%endfor
@@ -92,19 +92,19 @@ %if change !='removed':
-
+
- ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name, - revision=filenode.changeset.raw_id,f_path=filenode.path))} + ${h.link_to_if(change!='removed',filenode.path.decode('utf-8'),h.url('files_home',repo_name=c.repo_name, + revision=filenode.changeset.raw_id,f_path=filenode.path.decode('utf-8')))} %if 1: » ${h.link_to(_('diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='diff'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='diff'))} » ${h.link_to(_('raw diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='raw'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='raw'))} » ${h.link_to(_('download diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='download'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='download'))} %endif
diff --git a/rhodecode/templates/changeset/changeset_range.html b/rhodecode/templates/changeset/changeset_range.html --- a/rhodecode/templates/changeset/changeset_range.html +++ b/rhodecode/templates/changeset/changeset_range.html @@ -54,7 +54,7 @@ %for cs in c.cs_ranges:
r${cs}
%for change,filenode,diff,cs1,cs2 in c.changes[cs.raw_id]: -
${h.link_to(filenode.path,h.url.current(anchor=h.repo_name_slug('C%s-%s' % (cs.short_id,filenode.path))))}
+
${h.link_to(filenode.path.decode('utf-8'),h.url.current(anchor=h.repo_name_slug('C%s-%s' % (cs.short_id,filenode.path.decode('utf-8')))))}
%endfor %endfor
@@ -66,19 +66,19 @@ %if change !='removed':
-
+
- ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name, - revision=filenode.changeset.raw_id,f_path=filenode.path))} + ${h.link_to_if(change!='removed',filenode.path.decode('utf-8'),h.url('files_home',repo_name=c.repo_name, + revision=filenode.changeset.raw_id,f_path=filenode.path.decode('utf-8')))} %if 1: » ${h.link_to(_('diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='diff'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='diff'))} » ${h.link_to(_('raw diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='raw'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='raw'))} » ${h.link_to(_('download diff'), - h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path,diff2=cs2,diff1=cs1,diff='download'))} + h.url('files_diff_home',repo_name=c.repo_name,f_path=filenode.path.decode('utf-8'),diff2=cs2,diff1=cs1,diff='download'))} %endif
diff --git a/rhodecode/templates/journal/public_journal.html b/rhodecode/templates/journal/public_journal.html --- a/rhodecode/templates/journal/public_journal.html +++ b/rhodecode/templates/journal/public_journal.html @@ -15,6 +15,16 @@
${_('Public Journal')}
+ +