Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Fix various URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksergeant committed Nov 30, 2016
1 parent b6305d3 commit bcb8393
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions snipts/models.py
Expand Up @@ -236,18 +236,12 @@ def get_full_absolute_url(self):
return u'https://{}.snipt.net/{}/'.format(
self.user.username, self.slug)

if settings.DEBUG:
root = 'http://local.snipt.net'
else:
root = 'https://snipt.net'

if self.public:
return u'{}/{}/{}/'.format(root, self.user.username, self.slug)
return u'/{}/{}/'.format(self.user.username, self.slug)
else:
return u'{}/{}/{}/?key={}'.format(root,
self.user.username,
self.slug,
self.key)
return u'/{}/{}/?key={}'.format(self.user.username,
self.slug,
self.key)

def get_download_url(self):

Expand All @@ -264,12 +258,7 @@ def get_download_url(self):
else:
filename = u'{}.txt'.format(self.slug)

if settings.DEBUG:
root = 'http://local.snipt.net'
else:
root = 'https://snipt.net'

return u'{}/download/{}/{}'.format(root, self.key, filename)
return u'/download/{}/{}'.format(self.key, filename)

def get_embed_url(self):

Expand All @@ -281,13 +270,7 @@ def get_embed_url(self):
return '{}/embed/{}/'.format(root, self.key)

def get_raw_url(self):

if settings.DEBUG:
root = 'http://local.snipt.net'
else:
root = 'https://snipt.net'

return '{}/raw/{}/'.format(root, self.key)
return '/raw/{}/'.format(self.key)

@property
def sorted_tags(self):
Expand Down

0 comments on commit bcb8393

Please sign in to comment.