Moar cleanup.

This commit is contained in:
Martin Mahner 2013-11-24 23:37:01 +01:00
parent 43f82ba42b
commit b4f01103dc
2 changed files with 3 additions and 9 deletions

View file

@ -8,12 +8,6 @@ def in_list(value, arg):
return value in arg return value in arg
@register.filter @register.filter
def highlight(snippet, maxlines=None): def highlight(snippet):
h = pygmentize(snippet.content, snippet.lexer) h = pygmentize(snippet.content, snippet.lexer)
if not h: return h.splitlines()
s = snippet.content.splitlines()
s = h.splitlines()
if maxlines:
return s[:maxlines]
return s

View file

@ -60,4 +60,4 @@ class SnippetTestCase(TestCase):
response = self.client.post(response.request['PATH_INFO'], data, follow=True) response = self.client.post(response.request['PATH_INFO'], data, follow=True)
self.assertContains(response, data['content']) self.assertContains(response, data['content'])
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(Snippet.objects.count(), 2) self.assertEqual(Snippet.objects.count(), 2)