mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-23 23:23:06 +11:00
Simplification
Conflicts: pastebin/apps/dpaste/models.py
This commit is contained in:
parent
4a4d1b96d9
commit
6ff55e461c
3 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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<snippet_id>[a-zA-Z0-9]{4})/$', 'snippet_details', name='snippet_details'),
|
||||
url(r'^(?P<snippet_id>[a-zA-Z0-9]{4})/delete/$', 'snippet_delete', name='snippet_delete'),
|
||||
url(r'^(?P<snippet_id>[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<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]+)/raw/$', 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue