diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-09-14 00:36:47 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-09-14 00:36:47 -0300 |
commit | 60a1fc6cc4cef0b9eed58ea4f0ca003b76ec382a (patch) | |
tree | 032ae62668538be964f57a12018d1ab9f696be5f /releng/management/commands/syncisos.py | |
parent | fbd23db51b7160a308cd88e407e676994eb08b10 (diff) | |
parent | 617550628b39f94e6cb11ec032eb18e6195bf64a (diff) |
Merge branch 'master' of git://projects.archlinux.org/archweb
Conflicts:
local_settings.py.example
media/archweb.css
packages/templatetags/package_extras.py
public/views.py
templates/packages/details.html
templates/packages/flag.html
templates/packages/flag_confirmed.html
templates/packages/flagged.html
templates/packages/packages_list.html
templates/packages/search.html
templates/packages/signoffs.html
templates/public/about.html
templates/public/download.html
templates/public/index.html
templates/public/svn.html
templates/releng/results.html
templates/todolists/view.html
Diffstat (limited to 'releng/management/commands/syncisos.py')
-rw-r--r-- | releng/management/commands/syncisos.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/releng/management/commands/syncisos.py b/releng/management/commands/syncisos.py index ba174131..270c6c34 100644 --- a/releng/management/commands/syncisos.py +++ b/releng/management/commands/syncisos.py @@ -1,3 +1,4 @@ +from datetime import datetime import re import urllib from HTMLParser import HTMLParser, HTMLParseError @@ -33,19 +34,28 @@ class IsoListParser(HTMLParser): raise CommandError('Couldn\'t parse "%s"' % url) class Command(BaseCommand): - help = 'Gets new isos from %s' % settings.ISO_LIST_URL + help = 'Gets new ISOs from %s' % settings.ISO_LIST_URL def handle(self, *args, **options): parser = IsoListParser() isonames = Iso.objects.values_list('name', flat=True) active_isos = parser.parse(settings.ISO_LIST_URL) - # create any names that don't already exist for iso in active_isos: + # create any names that don't already exist if iso not in isonames: new = Iso(name=iso, active=True) new.save() + # update those that do if they were marked inactive + else: + existing = Iso.objects.get(name=iso) + if not existing.active: + existing.active = True + existing.removed = None + existing.save() + now = datetime.utcnow() # and then mark all other names as no longer active - Iso.objects.exclude(name__in=active_isos).update(active=False) + Iso.objects.filter(active=True).exclude(name__in=active_isos).update( + active=False, removed=now) # vim: set ts=4 sw=4 et: |