Example #1
0
    def test_credentials_filter(self):
        from rhodecode.lib import credentials_filter

        for url in TEST_URLS:
            self.assertEqual(credentials_filter(url[0]), url[2])
Example #2
0
flash = _Flash()

#==============================================================================
# SCM FILTERS available via h.
#==============================================================================
from vcs.utils import author_name, author_email
from rhodecode.lib import credentials_filter, age as _age

age = lambda  x:_age(x)
capitalize = lambda x: x.capitalize()
email = author_email
email_or_none = lambda x: email(x) if email(x) != x else None
person = lambda x: author_name(x)
short_id = lambda x: x[:12]
hide_credentials = lambda x: ''.join(credentials_filter(x))

def bool2icon(value):
    """Returns True/False values represented as small html image of true/false
    icons

    :param value: bool value
    """

    if value is True:
        return HTML.tag('img', src=url("/images/icons/accept.png"),
                        alt=_('True'))

    if value is False:
        return HTML.tag('img', src=url("/images/icons/cancel.png"),
                        alt=_('False'))