示例#1
0
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))
示例#2
0
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))
示例#3
0
文件: view.py 项目: dwiel/kumquat
	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)
示例#4
0
文件: view.py 项目: iSCInc/kumquat
    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)