Skip to content

Commit

Permalink
PEP8 fix and version upgrade to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Jul 22, 2014
1 parent b37a408 commit 00da076
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
6 changes: 4 additions & 2 deletions greeking/placeholdit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
URL = 'http://placehold.it/%(width)sx%(height)s/%(bcolor)s/%(tcolor)s/'


def get_url(width, height=None, background_color="cccccc",
text_color="969696", text=None):
def get_url(
width, height=None, background_color="cccccc",
text_color="969696", text=None
):
"""
Craft the URL for a placeholder image.
Expand Down
8 changes: 5 additions & 3 deletions greeking/templatetags/greeking_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,16 @@ def lorem_pixum(parser, token):


@register.simple_tag
def placeholdit(width, height, background_color="cccccc",
text_color="969696", text=None):
def placeholdit(
width, height, background_color="cccccc",
text_color="969696", text=None
):
"""
Creates a placeholder image using placehold.it
Usage format:
{% placeholdit [width] [height] [background_color] [text_color] [text] %}
{% placeholdit [width] [height] [background_color] [text_color] [text] %}
Example usage:
Expand Down
31 changes: 23 additions & 8 deletions greeking/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,34 @@ def testPlaceholdIt(self):
"""
t1 = "{% load greeking_tags %}{% placeholdit 250 250 %}"
ctx, out = self.render(t1)
self.assertEqual(out, '<img src="http://placehold.it/250x250/cccccc/969696/"/>')
self.assertEqual(
out, '<img src="http://placehold.it/250x250/cccccc/969696/"/>'
)
t2 = "{% load greeking_tags %}{% placeholdit 100 200 %}"
ctx, out = self.render(t2)
self.assertEqual(out, '<img src="http://placehold.it/100x200/cccccc/969696/"/>')
t3 = "{% load greeking_tags %}{% placeholdit 100 200 background_color='fff' text_color='000' %}"
self.assertEqual(
out, '<img src="http://placehold.it/100x200/cccccc/969696/"/>'
)
t3 = "{% load greeking_tags %}{% placeholdit 100 200 \
background_color='fff' text_color='000' %}"
ctx, out = self.render(t3)
self.assertEqual(out, '<img src="http://placehold.it/100x200/fff/000/"/>')
t4 = "{% load greeking_tags %}{% placeholdit 100 200 text='Hello LA' %}"
self.assertEqual(
out, '<img src="http://placehold.it/100x200/fff/000/"/>'
)
t4 = "{% load greeking_tags %}{% placeholdit 100 200 \
text='Hello LA' %}"
ctx, out = self.render(t4)
self.assertEqual(out, '<img src="http://placehold.it/100x200/cccccc/969696/&text=Hello+LA"/>')
t5 = "{% load greeking_tags %}{% placeholdit 100 200 'fff' '000' 'Hello LA' %}"
self.assertEqual(
out, '<img src="http://placehold.it/100x200/cccccc/969696/\
&text=Hello+LA"/>'
)
t5 = "{% load greeking_tags %}{% placeholdit 100 200 'fff' \
'000' 'Hello LA' %}"
ctx, out = self.render(t5)
self.assertEqual(out, '<img src="http://placehold.it/100x200/fff/000/&text=Hello+LA"/>')
self.assertEqual(
out,
'<img src="http://placehold.it/100x200/fff/000/&text=Hello+LA"/>'
)
self.assertRaises(
TemplateSyntaxError,
self.render,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

setup(
name='greeking',
version='1.0.0',
version='1.1.0',
description='Django template tools for printing filler, a \
technique from the days of hot type known as greeking.',
author='Ben Welsh',
author_email='Benjamin.Welsh@latimes.com',
author_email='ben.welsh@gmail.com',
url='http://github.com/palewire/django-greeking',
download_url='http://github.com/palewire/django-greeking.git',
packages=find_packages(),
Expand Down

0 comments on commit 00da076

Please sign in to comment.