How to connect an Open Library template to a page
Since Open Library is a wiki, you can create a new page in almost any namespace you want (assuming you are an admin). We created http://openlibrary.org/libraries by going to that URL and clicking “Create it”.
So how can we get /libraries to use the /libraries/index.html template?
Anand helped by adding some python code in openlibrary/plugins/openlibrary/libraries.py:
class libraries(delegate.page): def GET(self): return render_template("libraries/index") |
If the path of the page isn’t at the top level of the namespace, you can specify a path:
class locations(delegate.page): path = "/libraries/locations.txt" def GET(self): libraries = inlibrary.get_libraries() return render_template("libraries/locations")
Reply