Shorter random URLs and no longer a trailing slash.

This commit is contained in:
Martin Mahner 2013-09-27 17:39:12 +02:00
parent 4c96e1eb17
commit 4ba94ce64e
2 changed files with 2 additions and 2 deletions

View file

@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
from dpaste.highlight import LEXER_DEFAULT from dpaste.highlight import LEXER_DEFAULT
t = 'abcdefghijkmnopqrstuvwwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ1234567890' t = 'abcdefghijkmnopqrstuvwwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ1234567890'
def generate_secret_id(length=5): def generate_secret_id(length=4):
return ''.join([random.choice(t) for i in range(length)]) return ''.join([random.choice(t) for i in range(length)])
class Snippet(models.Model): class Snippet(models.Model):

View file

@ -4,7 +4,7 @@ urlpatterns = patterns('dpaste.views',
url(r'^$', 'snippet_new', name='snippet_new'), url(r'^$', 'snippet_new', name='snippet_new'),
url(r'^diff/$', 'snippet_diff', name='snippet_diff'), url(r'^diff/$', 'snippet_diff', name='snippet_diff'),
url(r'^history/$', 'snippet_history', name='snippet_history'), url(r'^history/$', 'snippet_history', name='snippet_history'),
url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/$', 'snippet_details', name='snippet_details'), url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/?$', 'snippet_details', name='snippet_details'),
url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/delete/$', 'snippet_delete', name='snippet_delete'), url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/delete/$', 'snippet_delete', name='snippet_delete'),
url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/gist/$', 'snippet_gist', name='snippet_gist'), url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/gist/$', 'snippet_gist', name='snippet_gist'),
url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'), url(r'^(?P<snippet_id>[a-zA-Z0-9]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'),