Last change
on this file since 3501 was
3501,
checked in by potar, 12 years ago
|
fixed pep8
|
-
Property svn:eol-style set to
native
|
File size:
791 bytes
|
Line | |
---|
1 | from urllib2 import urlopen |
---|
2 | from urllib import quote as urlquote |
---|
3 | from DateTime import DateTime |
---|
4 | |
---|
5 | from Globals import DevelopmentMode |
---|
6 | #from OFS.ObjectManager import BadRequestException |
---|
7 | |
---|
8 | from quintagroup.plonegooglesitemaps import config |
---|
9 | |
---|
10 | |
---|
11 | def ping_google(url, sitemap_id): |
---|
12 | """Ping sitemap to Google""" |
---|
13 | |
---|
14 | resurl = url + "/" + sitemap_id |
---|
15 | |
---|
16 | if DevelopmentMode or config.testing: |
---|
17 | #prevent pinging in debug or testing mode |
---|
18 | print "Pinged %s sitemap to Google" % resurl |
---|
19 | return 0 |
---|
20 | |
---|
21 | sitemap_url = urlquote(resurl) |
---|
22 | |
---|
23 | g = urlopen('http://www.google.com/webmasters/tools/ping?sitemap=' + |
---|
24 | sitemap_url) |
---|
25 | g.read() |
---|
26 | g.close() |
---|
27 | |
---|
28 | return 0 |
---|
29 | |
---|
30 | |
---|
31 | def dateTime(obj): |
---|
32 | """ Method gets modification date """ |
---|
33 | return DateTime(obj.ModificationDate()) |
---|
Note: See
TracBrowser
for help on using the repository browser.