Skip to content

Commit

Permalink
Always request using https
Browse files Browse the repository at this point in the history
  • Loading branch information
saschwarz committed Dec 28, 2016
1 parent 384e361 commit afce5a4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
dist
.vscode
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django application for inserting Shrink The Web (http://www.shrinktheweb.com/) images into templates.
Django application for inserting Shrink The Web (https://www.shrinktheweb.com/) images into templates.

Contains a templatetag providing a thin wrapper around the STW api:
https://shrinktheweb.com/uploads/STW_API_Documentation.pdf
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='django-stw',
version='1.0.0',
version='1.0.1',
description='This application provides templatetags for simplying using Shrink The Web PagePix',
author='Steve Schwarz',
author_email='steve@agilitynerd.com',
url='http://github.com/saschwarz/django-stw',
url='https://github.com/saschwarz/django-stw',
download_url='https://github.com/saschwarz/django-stw/tarball/1.0.0',
packages=find_packages(),
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions stw/templates/stwexample.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
<div class="container">
<div class="body">
<div class="well">
<h1><a href="http://github.com/saschwarz/django-stw">django-stw</a></h1>
<h1><a href="https://github.com/saschwarz/django-stw">django-stw</a></h1>
<h3>Django + Shrink The Web Examples</h3>
</div>
<p>Simple syntax. At the top of each template file load the templatetags:</p>
<pre>{% templatetag openblock %} load shrinkthewebtags {% templatetag closeblock %}</pre>
<p>At each place you'd like a screen shot insert the <code>stwimage</code> template tag with the two mandatory arguments: the url and the <code>alt</code> text:</p>
<pre>{% templatetag openblock %} stwimage "https://djangoproject.com/" "Django website" {% templatetag closeblock %}</pre>
<p>The following examples demonstrate adding additional <code>key=value</code> options. Some require purchasing and enabling additional features on the <a href="http://shrinktheweb.com" class="href">shrinktheweb.com</a> site.</p>
<p>The following examples demonstrate adding additional <code>key=value</code> options. Some require purchasing and enabling additional features on the <a href="https://shrinktheweb.com" class="href">shrinktheweb.com</a> site.</p>
<div class="alert alert-info" role="alert">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Images may not be shown below if they have expired in the shrinktheweb cache. Wait a moment and refresh the page to see them.
</div>
Expand Down
2 changes: 1 addition & 1 deletion stw/templatetags/shrinkthewebtags.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def render(self, context):
encoded = parse.urlencode(self.kwargs)
if encoded:
encoded += '&'
result = '''<img src="http://images.shrinktheweb.com/xino.php?{0}stwurl={1}" alt="{2}"/>'''.format(encoded, url, alt)
result = '''<img src="https://images.shrinktheweb.com/xino.php?{0}stwurl={1}" alt="{2}"/>'''.format(encoded, url, alt)
return result


Expand Down
4 changes: 2 additions & 2 deletions stw/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def side_effect(*args, **kwargs):

context = {'alt': 'contextalt'}
self.assertEqual(
'''<img src="http://images.shrinktheweb.com/xino.php?stwaccesskeyid=key&stwembed=1&stwsize=lrg&stwurl=url" alt="alt"/>''',
'''<img src="https://images.shrinktheweb.com/xino.php?stwaccesskeyid=key&stwembed=1&stwsize=lrg&stwurl=url" alt="alt"/>''',
node.render(context))

@patch('six.moves.urllib.parse.urlencode')
Expand All @@ -123,7 +123,7 @@ def side_effect(*args, **kwargs):
node._resolve = Mock(side_effect=side_effect)
mockurlencode.return_value = "kwarg=kwargvalue"
self.assertEqual(
'''<img src="http://images.shrinktheweb.com/xino.php?kwarg=kwargvalue&stwurl=url" alt="alt"/>''', node.render(None))
'''<img src="https://images.shrinktheweb.com/xino.php?kwarg=kwargvalue&stwurl=url" alt="alt"/>''', node.render(None))


class TestDoSTWImage(unittest.TestCase):
Expand Down

0 comments on commit afce5a4

Please sign in to comment.