From 6ff55e461c159efcb68f84e7c8161d2372271fbe Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Wed, 8 Jun 2011 22:37:37 +0200 Subject: [PATCH] Simplification Conflicts: pastebin/apps/dpaste/models.py --- pastebin/apps/dpaste/forms.py | 2 +- pastebin/apps/dpaste/models.py | 5 +++-- pastebin/apps/dpaste/urls.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pastebin/apps/dpaste/forms.py b/pastebin/apps/dpaste/forms.py index 2e99317..7a9af97 100644 --- a/pastebin/apps/dpaste/forms.py +++ b/pastebin/apps/dpaste/forms.py @@ -13,7 +13,7 @@ EXPIRE_CHOICES = ( (3600, _(u'In one hour')), (3600*24*7, _(u'In one week')), (3600*24*30, _(u'In one month')), - (3600*24*30*12*100, _(u'Save forever')), # 100 years, I call it forever ;) + #(3600*24*30*12*100, _(u'Save forever')), # 100 years, I call it forever ;) ) EXPIRE_DEFAULT = 3600*24*30 diff --git a/pastebin/apps/dpaste/models.py b/pastebin/apps/dpaste/models.py index a4192e7..9e1e114 100644 --- a/pastebin/apps/dpaste/models.py +++ b/pastebin/apps/dpaste/models.py @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _ from pastebin.apps.dpaste.highlight import LEXER_DEFAULT, pygmentize t = 'abcdefghijkmnopqrstuvwwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ1234567890' -def generate_secret_id(length=4): +def generate_secret_id(length=3): return ''.join([random.choice(t) for i in range(length)]) class Snippet(models.Model): @@ -37,7 +37,8 @@ class Snippet(models.Model): if not self.pk: self.published = datetime.datetime.now() self.secret_id = generate_secret_id() - self.content_highlighted = pygmentize(self.content, self.lexer) + #self.content_highlighted = pygmentize(self.content, self.lexer) + self.content_highlighted = self.content super(Snippet, self).save(*args, **kwargs) def get_absolute_url(self): diff --git a/pastebin/apps/dpaste/urls.py b/pastebin/apps/dpaste/urls.py index 6aefb9c..5a31ba8 100644 --- a/pastebin/apps/dpaste/urls.py +++ b/pastebin/apps/dpaste/urls.py @@ -8,7 +8,7 @@ urlpatterns = patterns('pastebin.apps.dpaste.views', url(r'^diff/$', 'snippet_diff', name='snippet_diff'), url(r'^your-latest/$', 'snippet_userlist', name='snippet_userlist'), url(r'^your-settings/$', 'userprefs', name='snippet_userprefs'), - url(r'^(?P[a-zA-Z0-9]{4})/$', 'snippet_details', name='snippet_details'), - url(r'^(?P[a-zA-Z0-9]{4})/delete/$', 'snippet_delete', name='snippet_delete'), - url(r'^(?P[a-zA-Z0-9]{4})/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'), + 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]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'), )