Skip to content
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

Use redirect for new notebooks #2218

Merged
merged 2 commits into from Aug 11, 2012
Merged

Conversation

Carreau
Copy link
Member

@Carreau Carreau commented Jul 29, 2012

fixes #2217

Pinging @dlsun,
This should fix the issue you have for new tabs for new notebooks.

@bfroehle
Copy link
Contributor

Seems reasonable, and the redirect works. I haven't examined how this interacts with #2206. Shall we merge?

@Carreau
Copy link
Member Author

Carreau commented Jul 31, 2012

I just want @ellisonbg to say what he think of it,
if there is other places where we should do the same.
And if it has influences on this.

@Carreau
Copy link
Member Author

Carreau commented Aug 1, 2012

using redirect for notebook copy also.
This make me think I need to try it with url prefixes.

@Carreau
Copy link
Member Author

Carreau commented Aug 1, 2012

Ok, it should work with prefixes also now.
It uses redirect for both New and Copy

login_available=self.login_available,
mathjax_url=self.application.ipython_app.mathjax_url,
)
self.redirect((('/',self.application.ipython_app.base_project_url, notebook_id)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to have a urljoin here?

@Carreau
Copy link
Member Author

Carreau commented Aug 1, 2012

stupid me.
I tried on the wrong port... my patch was not working at all...

Should be better now.

also applied your suggestion about *pieces

login_available=self.login_available,
mathjax_url=self.application.ipython_app.mathjax_url,
)
self.redirect('/'+urljoin(self.application.ipython_app.base_project_url, notebook_id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any chance that base_project_url is a full URL (i.e., http://.../) instead of just a relative URL? It seems that it might be easier to just do something like:

self.redirect(self.application.ipython_app/base_project_url.rstrip('/') + '/' + notebook_id)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not according to the doc,
And for example, I access the same server, sometime throught 127.0.0.1 and sometime through 192.x.x.x ... it will be annoying to have an hardcoded ip or hostname...

@ellisonbg
Copy link
Member

I think that SaveWidget.update_url probably doesn't need to be called any longer. I would remove that method and re-test everything.

@Carreau
Copy link
Member Author

Carreau commented Aug 10, 2012

Done.
(and it seems to work)

@ellisonbg
Copy link
Member

OK this looks great and I confirm that it works fine without the update_url calls. I am going to test one more thing and then merge.

ellisonbg added a commit that referenced this pull request Aug 11, 2012
Use redirect for new notebooks
@ellisonbg ellisonbg merged commit 1ad91e6 into ipython:master Aug 11, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
smoofra pushed a commit to smoofra/emacs-ipython-notebook that referenced this pull request Mar 21, 2015
As of ipython/ipython#2218, IPython server
redirects when creating a new notebook.  However, redirection on
local server does not work in url-retrieve.  See:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12374

This bug in url-retrieve is handled in the newly introduced error
callback.
smoofra pushed a commit to smoofra/emacs-ipython-notebook that referenced this pull request Mar 21, 2015
* Workaround the bug in url-retrieve to make notebook creation
  work for the recent developmental version of IPython.
  See: ipython/ipython#2218

* Some refactoring around messaging:
  ein-notebooklist.el uses `ein:log' instead of `message' now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change NewNotebook handler to use 30x redirect
3 participants