-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
add redirect handler for notebooks by name #3058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Awesome! We really need this and I think this is a good start. I will try to get going on some code reviews... |
My first draft had this as a special |
@authenticate_unless_readonly | ||
def get(self, notebook_name): | ||
app = self.application | ||
print notebook_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to print the notebook_name, don't you think? The code looks good... This enhancement is really great for the generation of interlinked ipynb-based documents and to access to ipynb easily from iframes... I really like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, certainly not - that's just my debug statement that I accidentally committed. Removed.
Now you can visit `localhost:8888/My Notebook.ipynb`, and it will redirect you to the UUID url. This allows cross-notebook links, etc. with `[other notebook](Notebook Name.ipynb)`
The main thing I think we need to think about is how this relates to the
Also, would it be more consistent to put these under the "files" handler. On Fri, Mar 22, 2013 at 9:04 PM, Min RK notifications@github.com wrote:
Brian E. Granger |
We are going to need to figure out what the URL scheme looks like for notebooks elsewhere before we can think about this. We may want another special redirect that can take more information, but the important thing here is that a relative link to an adjacent notebook resolves.
It would not. a files url is strictly for serving static files - a link to a live notebook is decidedly not serving a static file. Specifically, requesting What should work, given what we have now:
What may need more work (or may never work, depending how we do things):
But we can't begin to think about this one until we have our url scheme for notebooks in other directories. right now: link If we end up with per-directory project UUIDs, such that each notebook would have a url like |
@authenticate_unless_readonly | ||
def get(self, notebook_name): | ||
app = self.application | ||
if notebook_name.endswith('.ipynb'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the regular expression used, this check is not needed. IOW, the notebook_name
will always end with .ipynb
.
OK I am convinced that this PR is a good idea. I think we can merge it - the only question on the code is whether we really need to test if the |
regex already guarantees it
add redirect handler for notebooks by name
Great! Very useful! Thanks for your work on this... |
Thank you thank you! This is amazing when developing teaching lesson plans! |
I still don't understand how to use this feature. Who can give me an example how to redirect to a head cell? edit: I found a detailed explanation, follow this link |
let say you are on notebook This of course only for 1.0/1.1 as it is not relevant on master anymore as we got rid of UUID in URL. |
add redirect handler for notebooks by name
Now you can visit
localhost:8888/My Notebook.ipynb
, and it will redirect you to the UUID url. This allows cross-notebook links, etc. with[other notebook](Notebook Name.ipynb)
.It does not introduce any of the problems associated with 'real' persistent URLs,
since these are only written by humans, and only redirect to real URLs.
A rename breaks such a link, exactly as you would expect.
see #3056