Fixed ping_google management command to use argparse.

This commit is contained in:
R3v1L 2014-09-01 11:38:08 +01:00 committed by Loic Bistuer
parent a8521a2c22
commit 03c1a6cb80
1 changed files with 4 additions and 5 deletions

View File

@ -5,9 +5,8 @@ from django.contrib.sitemaps import ping_google
class Command(BaseCommand):
help = "Ping Google with an updated sitemap, pass optional url of sitemap"
def add_arguments(self, parser):
parser.add_argument('sitemap_url', nargs='?', default=None)
def execute(self, *args, **options):
if len(args) == 1:
sitemap_url = args[0]
else:
sitemap_url = None
ping_google(sitemap_url=sitemap_url)
ping_google(sitemap_url=options['sitemap_url'])