bfirsh / django-shorturls

A URL shortening app for Django
BSD 3-Clause "New" or "Revised" License
408 stars 68 forks source link

Replaces the BaseConverter class by the SequenceMapper #3

Closed arthurfurlan closed 10 years ago

arthurfurlan commented 13 years ago

Hi Jacob,

I needed to create a ShortURL application for Django and decided to not use "django-shorturls" because I have some different ideas for my project and would have to make lots of changes in the code of your application.

Based on that I started to look about some base converters algorithms to use but all of them are based in the mathematical chains of numbers and, becasue of that, excludes a lot of possible ShortURL codes. I decided to create my own "base converter", which I called "SequenceMapper" because it doesn't convert number between bases in fact, it just maps a number to its respective chain of chars. I created a gist in Github to try to explain what I'm talking about: https://gist.github.com/789720. This code is open source and my application is also hosted in Github: https://github.com/valvim/django-shortim.

So what my patch do is basically change the "BaseConverter" that is currently being used in the "django-shorturls" by the "SequenceMapper" that I'm using in my application. This application is already working in http://va.mu (Brazilian portuguese only, sorry).

Hope my code could be useful. :) Thanks.

bfirsh commented 10 years ago

8 now includes something like this. See how base 32 does mapping of characters.

Thanks for the contribution!