def viewurilink(uri): """ given a uri, return a url to view it """ name = schema.uri_to_name(uri) if name: url = '/view/name/' + quote(name) elif uri[:7] == "http://": url = '/view/uri/' + uri[7:] else: url = '/view/uri?id=' + uri return '<a href="%s">%s</a>' % (url, name or n.shorten(uri))
def viewurilink(uri) : """ given a uri, return a url to view it """ name = schema.uri_to_name(uri) if name : url = '/view/name/' + quote(name) elif uri[:7] == "http://" : url = '/view/uri/' + uri[7:] else : url = '/view/uri?id=' + uri return '<a href="%s">%s</a>' % (url, name or n.shorten(uri))
def uri(self, id) : """ if an item has no name, it can be reffered to be uri. The http:// must stripped out due to the way pylons parsing URLs ... They look dirty anyway """ uri = 'http://' + id name = schema.uri_to_name(uri) if name : redirect_to('/view/name/' + str(name)) subquery = 'FILTER( regex(str(?sub), "^%s$") )' % uri if name : object = {'name' : name} else : object = {'id' : uri[7:]} return self._renderItem(subquery, object)
def uri(self, id): """ if an item has no name, it can be reffered to be uri. The http:// must stripped out due to the way pylons parsing URLs ... They look dirty anyway """ uri = 'http://' + id name = schema.uri_to_name(uri) if name: redirect_to('/view/name/' + str(name)) subquery = 'FILTER( regex(str(?sub), "^%s$") )' % uri if name: object = {'name': name} else: object = {'id': uri[7:]} return self._renderItem(subquery, object)