summaryrefslogtreecommitdiff
path: root/devel/management/commands
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-01 16:47:37 -0500
committerDan McGee <dan@archlinux.org>2011-11-01 16:47:37 -0500
commitade2c08899abf77f6d836432c9988ad3f9652a95 (patch)
tree5b6411bd0115ce4a9bab2e8bb0c2e81a89ab9ec2 /devel/management/commands
parent09ea244420a4f8687c9b0122d867dabc5d7d577c (diff)
Really ensure we don't catch any NULL or blank values
Fuck you too, Django. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/management/commands')
-rw-r--r--devel/management/commands/generate_keyring.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/devel/management/commands/generate_keyring.py b/devel/management/commands/generate_keyring.py
index b95d5a8e..35ab8874 100644
--- a/devel/management/commands/generate_keyring.py
+++ b/devel/management/commands/generate_keyring.py
@@ -8,7 +8,6 @@ Usage: ./manage.py generate_keyring <keyserver> <keyring_path>
"""
from django.core.management.base import BaseCommand, CommandError
-from django.db.models import Q
import logging
import subprocess
@@ -44,9 +43,10 @@ class Command(BaseCommand):
def generate_keyring(keyserver, keyring):
logger.info("getting all known key IDs")
- exclude = Q(pgp_key__isnull=True) & Q(pgp_key__exact="")
- key_ids = UserProfile.objects.exclude(
- exclude).values_list("pgp_key", flat=True)
+ # Screw you Django, for not letting one natively do value != <empty string>
+ key_ids = UserProfile.objects.filter(user__is_active=True,
+ pgp_key__isnull=False).extra(where=["pgp_key != ''"]).values_list(
+ "pgp_key", flat=True)
logger.info("%d keys fetched from user profiles", len(key_ids))
gpg_cmd = ["gpg", "--no-default-keyring", "--keyring", keyring,