2014-01-10 66 views

回答

1

這是你在找什麼?

您可以通過

cherrypy.tree.apps[mount_point].root 

root權限安裝URL處理器始終在安裝實例安裝點。因此,反向功能將類似於:

def reverse(cls): 
    # get link to a class type 
    for app_url in cherrypy.tree.apps.keys(): 
     if isinstance(cherrypy.tree.apps[app_url].root, cls): 
      # NOTE: it will return with the first mount point of this class 
      return app_url 

how to get url of an object in cherrypy?

希望這有助於!