diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -109,7 +109,7 @@ class _GetError(object): def __call__(self, field_name, form_errors): tmpl = """%s""" - if form_errors and form_errors.has_key(field_name): + if form_errors and field_name in form_errors: return literal(tmpl % form_errors.get(field_name)) get_error = _GetError() @@ -118,12 +118,15 @@ get_error = _GetError() class _ToolTip(object): def __call__(self, tooltip_title, trim_at=50): - """Special function just to wrap our text into nice formatted + """ + Special function just to wrap our text into nice formatted autowrapped text :param tooltip_title: """ - return escape(tooltip_title) + tooltip_title = escape(tooltip_title) + tooltip_title = tooltip_title.replace('<', '<').replace('>', '>') + return tooltip_title tooltip = _ToolTip() @@ -346,6 +349,14 @@ short_id = lambda x: x[:12] hide_credentials = lambda x: ''.join(credentials_filter(x)) +def fmt_date(date): + if date: + return (date.strftime(_(u"%a, %d %b %Y %H:%M:%S").encode('utf8')) + .decode('utf8')) + + return "" + + def is_git(repository): if hasattr(repository, 'alias'): _type = repository.alias