summaryrefslogtreecommitdiff
path: root/django/archives/util.py
diff options
context:
space:
mode:
authorMagnus Hagander2019-01-03 20:15:38 +0000
committerMagnus Hagander2019-01-04 11:24:06 +0000
commit3fb227230c145c828888aa2e7c5d8b9a8c0760a0 (patch)
tree2eeba42da158e6e00c06d537dc6da3a895e39b6c /django/archives/util.py
parent1e173c362aa105ab4397fb77f8c693a1e01efa11 (diff)
Tabs to 4 spaces
pep8 standard for indentation
Diffstat (limited to 'django/archives/util.py')
-rw-r--r--django/archives/util.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/django/archives/util.py b/django/archives/util.py
index 425fffe..4ed9730 100644
--- a/django/archives/util.py
+++ b/django/archives/util.py
@@ -3,42 +3,42 @@ from django.db import connection
from django.utils.functional import SimpleLazyObject
def validate_new_user(username, email, firstname, lastname):
- # Only allow user creation if they are already a subscriber
- curs = connection.cursor()
- curs.execute("SELECT EXISTS(SELECT 1 FROM listsubscribers WHERE username=%(username)s)", {
- 'username': username,
- })
- if curs.fetchone()[0]:
- # User is subscribed to something, so allow creation
- return None
+ # Only allow user creation if they are already a subscriber
+ curs = connection.cursor()
+ curs.execute("SELECT EXISTS(SELECT 1 FROM listsubscribers WHERE username=%(username)s)", {
+ 'username': username,
+ })
+ if curs.fetchone()[0]:
+ # User is subscribed to something, so allow creation
+ return None
- return HttpResponse("You are not currently subscribed to any mailing list on this server. Account not created.")
+ return HttpResponse("You are not currently subscribed to any mailing list on this server. Account not created.")
def _get_gitrev():
- # Return the current git revision, that is used for
- # cache-busting URLs.
- try:
- with open('../.git/refs/heads/master') as f:
- return f.readline()[:8]
- except IOError:
- # A "git gc" will remove the ref and replace it with a packed-refs.
- try:
- with open('../.git/packed-refs') as f:
- for l in f.readlines():
- if l.endswith("refs/heads/master\n"):
- return l[:8]
- # Not found in packed-refs. Meh, just make one up.
- return 'ffffffff'
- except IOError:
- # If packed-refs also can't be read, just give up
- return 'eeeeeeee'
+ # Return the current git revision, that is used for
+ # cache-busting URLs.
+ try:
+ with open('../.git/refs/heads/master') as f:
+ return f.readline()[:8]
+ except IOError:
+ # A "git gc" will remove the ref and replace it with a packed-refs.
+ try:
+ with open('../.git/packed-refs') as f:
+ for l in f.readlines():
+ if l.endswith("refs/heads/master\n"):
+ return l[:8]
+ # Not found in packed-refs. Meh, just make one up.
+ return 'ffffffff'
+ except IOError:
+ # If packed-refs also can't be read, just give up
+ return 'eeeeeeee'
# Template context processor to add information about the root link and
# the current git revision. git revision is returned as a lazy object so
# we don't spend effort trying to load it if we don't need it (though
# all general pages will need it since it's used to render the css urls)
def PGWebContextProcessor(request):
- gitrev = SimpleLazyObject(_get_gitrev)
- return {
- 'gitrev': gitrev,
- }
+ gitrev = SimpleLazyObject(_get_gitrev)
+ return {
+ 'gitrev': gitrev,
+ }