Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up readme.

  • Loading branch information...
commit 4eb8694bb6fe58c2a73073e4f849bf20cdde119c 1 parent 62f2767
@tomatohater authored
View
18 README.rst
@@ -1,31 +1,31 @@
django-unfriendly
========================
-django-unfriendly is a Django app that obfuscates URLs and allows your application to natively execute the original URL's view.
+django-unfriendly is a Django app that obfuscates urls and allows your application to natively execute the original url's view.
-There is lots of talk about SEO friendly URLs. The trend is towards more and more readable human information in your URLs and Django makes it easy to create URLs like::
+There is lots of talk about SEO friendly urls. The trend is towards more and more readable human information in your urls and Django makes it easy to create urls like::
http://yoursite.com/music/black-sabbath-is-awesome/
-But sometimes URLs can give too much away. This is where django-unfriendly comes in.
+But sometimes urls can give too much away. This is where django-unfriendly comes in.
-django-unfriendly provides a template filter that obfuscates URLs in your templates, and a URL handler that deobfuscates and executes the original view (no redirection).
+django-unfriendly provides a template filter that obfuscates urls in your templates, and a url handler that deobfuscates and executes the original view (no redirection).
Why?
****
-Perhaps you have a Django application with URLs like the one above and you don't want anyone tampering with your URLs or guessing other possibilities::
+Perhaps you have a Django application with urls like the one above and you don't want anyone tampering with your urls or guessing other possibilities::
http://yoursite.com/music/melvins-are-awesome/
-You can obfuscation the URL which might look like::
+You can obfuscation the url which might look like::
http://yoursite.com/u/E5v4uxuNSA8I2is33c6V8lqFTcdv_IxPLDGG/
-Tampering with the obfuscated URL should return a ``404 - Page not found`` error.
+Tampering with the obfuscated url should return a ``404 - Page not found`` error.
-Obfuscated URLs are idempotent and may be safely cached.
+Obfuscated urls are idempotent and may be safely cached.
Installation
@@ -56,7 +56,7 @@ Load this tag library into any templates where you want to use django-unfriendly
{% load unfriendly_tags %}
-Then apply the obfuscate filter to any URL you'd like to hide::
+Then apply the obfuscate filter to any url you'd like to hide::
<a href="{{ "/music/black-sabbath-is-awesome/"|obfuscate }}">Sabbath awesome</a>
View
2  setup.py
@@ -10,7 +10,7 @@ def read(fname):
setup(
name = "django-unfriendly",
version = unfriendly.__version__,
- description = 'The unfriendliest urls in town.',
+ description = 'The unfriendliest urls in town! Django app that obfuscates urls and allows your application to natively execute the original view.',
long_description = README,
url = 'http://github.com/tomatohater/django-unfriendly',
author = 'Drew Engelson',
View
4 unfriendly/tests/__init__.py
@@ -15,9 +15,9 @@ class UnfriendlyTests(TestCase):
def setUp(self):
self.juice = 'Lorem ipsum dolor sit amet'
- def test_obfuscator(self):
+ def test_encryption(self):
"""
- Test the Obfuscator.
+ Test the encryption.
"""
original = self.juice
View
4 unfriendly/utils.py
@@ -3,15 +3,18 @@
import struct
from Crypto.Cipher import AES
+
class CheckSumError(Exception):
pass
+
def _lazysecret(secret, blocksize=32, padding='}'):
"""Pads secret if not legal AES block size (16, 24, 32)"""
if not len(secret) in (16, 24, 32):
return secret + (blocksize - len(secret)) * padding
return secret
+
def encrypt(plaintext, secret, checksum=True, lazy=True):
"""Encrypts plaintext with secret
plaintext - content to encrypt
@@ -30,6 +33,7 @@ def encrypt(plaintext, secret, checksum=True, lazy=True):
return base64.urlsafe_b64encode(encobj.encrypt(plaintext)).replace('=', '')
+
def decrypt(ciphertext, secret, checksum=True, lazy=True):
"""Decrypts ciphertext with secret
ciphertext - encrypted content to decrypt
Please sign in to comment.
Something went wrong with that request. Please try again.