diff --git a/progit/__init__.py b/progit/__init__.py index 39427d4..bd2b6b3 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -17,6 +17,7 @@ __version__ = '0.1' import logging import os import subprocess +import textwrap import urlparse from logging.handlers import SMTPHandler @@ -255,6 +256,19 @@ def format_loc(loc): return '\n'.join(output) +@APP.template_filter('wraps') +def text_wraps(text, size=10): + """ Template filter to wrap text at a specified size + """ + if text: + parts = textwrap.wrap(text, size) + if len(parts) > 1: + parts = '%s...' % parts[0] + else: + parts = parts[0] + return parts + + @FAS.postlogin def set_user(return_url): ''' After login method. '''