From 4ba94ce64ec5e9087fe285256f91deb865e53f79 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Fri, 27 Sep 2013 17:39:12 +0200 Subject: [PATCH] Shorter random URLs and no longer a trailing slash. --- dpaste/models.py | 2 +- dpaste/urls/dpaste.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dpaste/models.py b/dpaste/models.py index 1b670d1..50de3e4 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from dpaste.highlight import LEXER_DEFAULT t = 'abcdefghijkmnopqrstuvwwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ1234567890' -def generate_secret_id(length=5): +def generate_secret_id(length=4): return ''.join([random.choice(t) for i in range(length)]) class Snippet(models.Model): diff --git a/dpaste/urls/dpaste.py b/dpaste/urls/dpaste.py index 1877a41..e85bb0f 100644 --- a/dpaste/urls/dpaste.py +++ b/dpaste/urls/dpaste.py @@ -4,7 +4,7 @@ urlpatterns = patterns('dpaste.views', url(r'^$', 'snippet_new', name='snippet_new'), url(r'^diff/$', 'snippet_diff', name='snippet_diff'), url(r'^history/$', 'snippet_history', name='snippet_history'), - url(r'^(?P[a-zA-Z0-9]+)/$', 'snippet_details', name='snippet_details'), + url(r'^(?P[a-zA-Z0-9]+)/?$', 'snippet_details', name='snippet_details'), url(r'^(?P[a-zA-Z0-9]+)/delete/$', 'snippet_delete', name='snippet_delete'), url(r'^(?P[a-zA-Z0-9]+)/gist/$', 'snippet_gist', name='snippet_gist'), url(r'^(?P[a-zA-Z0-9]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'),