1.1 --- a/imipweb/resource.py Sun Oct 18 19:33:04 2015 +0200
1.2 +++ b/imipweb/resource.py Sun Oct 18 23:24:37 2015 +0200
1.3 @@ -83,16 +83,20 @@
1.4 self.new_page(title="Redirect")
1.5 self.page.p("Redirecting to: %s" % url)
1.6
1.7 - def link_to(self, uid, recurrenceid=None, args=None):
1.8 + def link_to(self, uid=None, recurrenceid=None, args=None):
1.9
1.10 """
1.11 - Return a link to an object with the given 'uid' and 'recurrenceid'.
1.12 + Return a link to a resource, being an object with any given 'uid' and
1.13 + 'recurrenceid', or the main resource otherwise.
1.14 +
1.15 See get_identifiers for the decoding of such links.
1.16
1.17 If 'args' is specified, the given dictionary is encoded and included.
1.18 """
1.19
1.20 - path = [uid]
1.21 + path = []
1.22 + if uid:
1.23 + path.append(uid)
1.24 if recurrenceid:
1.25 path.append(recurrenceid)
1.26 return "%s%s" % (self.env.new_url("/".join(path)), args and ("?%s" % urlencode(args)) or "")