Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1411 (closed defect: invalid)

Opened 11 years ago

Last modified 10 years ago

malformed urls when using widgets.base.Link with webpath set to absolute url

Reported by: markus Owned by: anonymous
Priority: normal Milestone: 1.5
Component: TurboGears Version: 1.0.2
Severity: normal Keywords:


I have used a CalendarDatePicker? and it didn't work. I chased the problem down to a bug in base.Link: obviously the Link class parts from the webpath being relative, if you use an absolute path as webpath, you get a malformed url, like

/ http://localhost:8080/tg_widgets/turbogears.widgets/calendar/calendar.js

because it always prepends a slash to the url, while this should only be done if a) the url doesn't start with a slash ("bla/blabla") b) the url is not absolute (" http://bla.bla.bla:8080")

My first idea was to build the url with turbogears.url, but this just ignored the webpath, so I just did it this way:

class Link(Resource):

def init(self, mod, *args, kw):

super(Link, self).init(*args, kw) self.mod = mod

def update_params(self, d):

super(Link, self).update_params(d)


if startup.webpath.startswith(" http://"):

link = "%stg_widgets/%s/%s" % (startup.webpath, self.mod, self.name)


link = "/%stg_widgets/%s/%s" % (startup.webpath, self.mod, self.name)

dlink? = link


def hash(self):

return hash(self.mod + self.name)

def eq(self, other):

return self.mod == getattr(other, "mod", None) and \

self.name == getattr(other, "name", None)

I had to make the same changes in i18n

class CalendarLangFileLink?(JSLink):

I start wondering if webpath is meant to keep an absolute url, however, you then should eliminate some of the articles/tutorials in the docs.

Change History

comment:1 Changed 11 years ago by faide

  • Milestone changed from 1.0.3 to 1.1

comment:2 Changed 10 years ago by Chris Arndt

Please provide

a) code that demonstrates the problem.

b) your propsed fix in proper "svn diff" format (see  http://docs.turbogears.org/patching_guidelines).

comment:3 Changed 10 years ago by Chris Arndt

  • Status changed from new to closed
  • Resolution set to invalid

a) webpath should not contain a URL scheme and host (that's what base_url_filter.base_url is for IMO). If the docs give that impression, please point us to the relevant documents and we will fix them.

b) This ticket has received no feedback for over half a year and there is still no proper information fo reproducing the described back, a patch in proper format, nor tests.

Closing this ticket as invalid.

Note: See TracTickets for help on using tickets.