~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/contrib/sitemaps/__init__.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from django.contrib.sites.models import Site
2
2
from django.core import urlresolvers, paginator
3
3
from django.core.exceptions import ImproperlyConfigured
4
 
import urllib
 
4
try:
 
5
    from urllib.parse import urlencode
 
6
    from urllib.request import urlopen
 
7
except ImportError:     # Python 2
 
8
    from urllib import urlencode, urlopen
5
9
 
6
10
PING_URL = "http://www.google.com/webmasters/tools/ping"
7
11
 
32
36
    from django.contrib.sites.models import Site
33
37
    current_site = Site.objects.get_current()
34
38
    url = "http://%s%s" % (current_site.domain, sitemap_url)
35
 
    params = urllib.urlencode({'sitemap':url})
36
 
    urllib.urlopen("%s?%s" % (ping_url, params))
 
39
    params = urlencode({'sitemap':url})
 
40
    urlopen("%s?%s" % (ping_url, params))
37
41
 
38
42
class Sitemap(object):
39
43
    # This limit is defined by Google. See the index documentation at