diff options
| author | R3v1L <R3v1L@users.noreply.github.com> | 2014-09-01 11:38:08 +0100 |
|---|---|---|
| committer | Loic Bistuer <loic.bistuer@gmail.com> | 2014-09-02 06:33:26 +0700 |
| commit | 03c1a6cb80ef03f16d60e4d34ed61b17497effd0 (patch) | |
| tree | c369b3033b76f15552cf00a5c48dde1fd10923f2 | |
| parent | a8521a2c228bd9e981dc8a2bea4e26f4544a52a7 (diff) | |
Fixed ping_google management command to use argparse.
| -rw-r--r-- | django/contrib/sitemaps/management/commands/ping_google.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/django/contrib/sitemaps/management/commands/ping_google.py b/django/contrib/sitemaps/management/commands/ping_google.py index 3d5b95d6c7..0cac49f13b 100644 --- a/django/contrib/sitemaps/management/commands/ping_google.py +++ b/django/contrib/sitemaps/management/commands/ping_google.py @@ -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']) |
