Generalize the url resolution code, make it work in view.open