Modify

Opened 10 years ago

Closed 10 years ago

#1320 closed defect (duplicate)

When pings are sent, a completely invalid URL is supplied resulting in a leve 400 error.

Reported by: tag@… Owned by: Christian Aust
Priority: normal Component: GoogleSitemapPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Submits incorrect URL.

I had to add the following patch to get it working on my local setup

Index: sitemap/api.py
===================================================================
--- sitemap/api.py      (revision 17)
+++ sitemap/api.py      (working copy)
@@ -155,7 +155,7 @@
         """Ping Google sitemaps to indicate that an updated sitemap is available"""
         href = Href(self.env.abs_href)
         url = 'http://www.google.com/webmasters/sitemaps/ping?' + \
-              urlencode({'sitemap' : href})
+              urlencode({"sitemap" : "http://www.blisted.org/sitemap.xml"})
         self.env.log.info('Sending ping to Google: %s ' % url)
         urllib2.urlopen(url)

I didn't take the time to figure out why the value coming from self.env.abs_href is invalid, but I couldn't also find where self.env is actually defied (granted I know next to nothing about the trac component API).

However, there is obviously a bug here.

Attachments (0)

Change History (2)

comment:1 Changed 10 years ago by Christian Aust

The object instance self.env is created for every request, and considers the current URL that was used when you made the request on the admin interface. Given that your trac might use different URLs at that time, self.env.href makes wrong assumptions. This is currently being discussed on the trac-dev mailing list.

http://groups.google.com/group/trac-dev/browse_frm/thread/a8d18e1d1ed98825/b8fd663ffbe467ef?lnk=gst&q=base+url&rnum=2#b8fd663ffbe467ef

Can you provide more information regarding the setup of your trac instance?

comment:2 Changed 10 years ago by Christian Aust

Resolution: duplicate
Status: newclosed

Implemented a configurable option to store the base url, this should fix it as well. So far, duplicate of #1009

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Aust.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.