Conversation
if url != '' and url[0:7] == 'file://': | ||
f = file(dest, 'wb') | ||
fin = url[7:] | ||
if fin.startswith('localhost'): |
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.
can this check be done with regexp instead?
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.
On Feb 15, 2012, at 11:07 PM, AlexJuarez wrote:
response = redirect(worksheet_datafile.url_for(worksheet, name=name))
- if url != '':
- if url != '' and url[0:7] == 'file://':
f = file(dest, 'wb')
fin = url[7:]
if fin.startswith('localhost'):
can this check be done with regexp instead?
Reply to this email directly or view it on GitHub:
https://github.com/sagemath/sagenb/pull/31/files#r455079
Done. Now that the line is gone I don't know how to comment on it, so hopefully you get this. :-)
Thanks for taking the time to review this.
-Ivan
I merged master into this branch - you can add my commit with |
Conflicts: flask_version/worksheet.py flask_version/worksheet_listing.py
Sorry, there was a minor glitch. Look at this diff instead (I've updated the branch head as well). |
The diff looks fine. Sorry I only recently got around to actually testing it though. Things seem to be in order. How do I update my pull request? |
Actually never mind, I think I figured it out. |
Yup, you did :) Now for someone to test/review this pull request... |
It works!!! But one has to have the absolute path, so annoying. Can people at notebook days please check this out? The code seems okay but I'm unfamiliar with the new notebook so there might be other places to check. |
Here is what happens when a server is already running (gvol pointed out that this check was gone in the code up here):
|
I merged, did some testing and updated the pull request. Sorry for the whitespace changes, I was too worried about merging it correctly to get rid of them. Anyway, I tested with
and
and things seemed to work okay except that the flask server will start up another instance. Since twistd is still the default (am I reading that right?) I thought I would let people review this rather than try and fix that myself. I did not test with uwsgi since I don't have it installed. It probably needs help too with starting a new server. |
I cannot figure out how to take these changes that I can see at https://github.com/sagemath/sagenb/pull/31/files and merge them in my sagenb (either on Github or otherwise). I'd really like to test them, and the code seems ok, though I haven't looked at it as much in context as I would like. There is the pull/31.patch file, but it's clearly the "old" version before the "massive changes" commit. Kini, you have a lot of 'splaining left before I'm convinced that Github is a panacea. At this point I can't even tell whether I have the new notebook or not - supposedly I do, I followed the instructions at #11080... sigh. |
You're right, that file is only generated from the initial post in the
Crisman, when I tried to offer you a dose of git 'splaining at SD40.5 As for the Sage library's git switchover, we will try our best to
That is simple. Look at the sagenb directory. If it has flask_version Honestly, a review from someone who can't figure out whether they have Anyway, thank you very much, Ivan, for resolving the merge conflict. |
Well, we can all day long at each other. It remains a fact that I only mentioned kini because he was on this ticket. I guess I should have put a ;-) in that comment, if the 'splaining didn't make it clear enough. (Pull request #61 was another story.) Serious talk: Yes, of course I have flask_version in it. But when I run it I get 2012-06-13 21:16:17-0400 [-] twistd 12.0.0 (/Users/.../sage-5.1.beta1-flask/local/bin/python 2.7.2) starting up. and no one has mentioned having to do anything special to get flask to be used. Now I see that 1174ddc is the commit where this was explained - that was post the spkg used in #11080. In fact, apparently one can't even use flask until then? See 1174ddc#L1R308 At any rate, I can't figure it out, so I can't (yet) test this, not to mention Is is possible (I ask fearfully) to just drop the sagenb code from the Github versions and replace the old devel/sagenb directory with this (possibly modulo some soft links)? Otherwise this is already based on code far enough ahead of #11080 that I'm not sure how to even keep up. That said, I do indeed want to review it. |
That commit is about using flask as a wsgi container, not just as a web application framework. If you have the flask_version, you are using a version of sagenb which uses flask as a web application framework, which is what "the flask notebook" means. The version of sagenb on trac 11080 uses flask for a web application framework but twisted for a wsgi container (which is a much more hands-off role to fill, which is why we can swap it out for any of two different options with simply a keyword argument, as seen in the line of code you linked). |
Yes, that works, depending on what you mean by "the Github versions", and assuming you mean "replace the old devel/sagenb directory with this and apply all the patches on trac 11080". Of course, the correct way to do it is to have a clone of the sagenb repo and fetch and check out this commit into it. |
I see, so the flask notebook doesn't run flask by default as the "server" application that starts up with Yes, I did mean to replace that directory with this (or a symlink); the patches at Trac 11080 have already been applied. I may try this so I can test gvol's changes better. How did you comment on my comments? I can't figure out how to do that within the web interface. Probably one has to use the email interface? |
I just copied and pasted segments of your comment and put a > before them :) Github comments use Markdown syntax, the same syntax that's used on reddit comments, if you're familiar with that. |
Oh, I never dreamed it would have to be by hand :) |
Okay, now I have it, thanks to some extra hints at another ticket. Sweet! All of the following work:
ALL of this from the I'm going to look at the code now. Some of it can obviously remain positive review, like the stuff in notebook_object.py. |
~ is expanded by your shell, by the way. Thanks for reviewing this! |
Question.
So if for some reason one didn't have automatic login but still had upload, it would load? Is that in theory a security flaw? Or should we leave that as
I just don't know whether the original reasoning would hold, given the new way this is written with the Very dumb comments/questions:
Finally, one actual bug. In line 87 or wherever of run_notebook.py, in prepare_kwds, in the Indeed,
So with respect to my earlier comment, I guess that it there isn't a security hole (yet), because you're guaranteed to get a |
Okay, the rest of the code looks good. Got a good education in the current notebook design - certainly easier to read, good work! So the above issue with |
Forgot this: By the way, although this shouldn't be Ivan's job, at least on Mac I was able to get a PID by using But not on this ticket, clearly not an issue unless someone specifically asks for A final dumb thing. What if someone passed
or even
and expected both to show up? The regex match would only get the first one, I think. I think that's okay, since the doc says nothing about two of them, but wanted to mention it. |
I commented there already. They should be fine. |
It's odd to me that the mac app is even in a Sage repo (the data/extcode repo). I don't see why it isn't just its own SPKG, with an upstream project administrated by you and with issues tracked on github or bitbucket or something. |
Sws cmdline (reviewed by @kcrisman)
Looks good enough to me. |
You'd have to ask Ivan about that. Personally, I feel that that code etc. has no purpose for existing outside of Sage, so it makes sense to have it be part of Sage. After all, we do have the extcode repo out there. It also makes it easier to administer - no forking outside repos and stuff like that, just do stuff within Sage. |
Well, sure, but since Ivan is the only person who ever edits it, is there even anyone qualified to review his patches? It seems a little silly for him to have to make patches and wait for review, just to make edits to an app which nobody else has ever written code for. I checked the logs in the |
By the way, I did ask Ivan about it. @gvol is Ivan :) |
At the time, it seemed like a good idea. Looking back, I'm not so sure because it means I have to get everything reviewed instead just making a new release when I want. :-) Of course that means it gets tested, so I suppose it's not all bad. |
Oh, I didn't realize you didn't know that. Sorry - Ivan has many aliases :) It's true that no one else has committed to it, but I do try to read the code as thoroughly as I can. I don't claim to understand every single line, but I do understand the overall structure and try to test it in ways that deal with whatever change is being made. I hope Ivan's been happy with my work :) |
I've been very happy. In fact, I've decided to double what I'm paying you. :-) |
I'm having problems with this. I'm using OS X 10.7, and I've installed the sagenb spkg from [http://trac.sagemath.org/sage_trac/ticket/13121](which includes this change), along with all of its prerequisites. When I run Also, using a tilde in the path ( |
Expanding the tilde is done by the shell so it will depend entirely upon how you quote it:
won't be expanded, but any of
will be. Also, a relative path should be okay as well. Are you starting the notebook server, or do you have it (or worse, an old version) already running? Or rather, does it not work in both cases, or just one? If you start it from the command line is there any error logging? |
For the tilde, I was thinking that you might use Python's os.path.expanduser method. Relative paths are working just fine, by the way. As far as the notebook server: I don't have one running until I give the command from the shell. The output at the command line looks essentially identical (except when it repeats the arguments) if I pass I just tried again with a new .sage directory, but that didn't help. |
Does it work if you check out the latest commit in this branch before the achtung: sent from my phone, may be unduly terse |
I took my existing installation and undid the one-line change in the latest commit. That doesn't fix the problem, but it breaks |
I think what he meant was check out this branch in case the merge into mainline was the cause. I'll try to reproduce this tomorrow or Monday, but I have to go to bed right now. What version of Sage are you using? If a server is already running, does it work then? We could probably use |
I'm using Sage 5.1.beta5, plus #13121. I'll try merging just this branch to see if that helps. It would be nice if someone else could reproduce this, though. I never use Sage with the server already running. Do I still use the syntax I think that os.path.expanduser should behave well, and will be less surprising to users than not having tildes expanded. But that should probably go in a later version. |
I see the same problem with just this branch. (I merged the new notebook and all of the other changes from #11080, and then cloned a new version of the sagenb git repository, checked out this branch, and pointed the link devel/sagenb to the resulting sagenb directory.) |
I'm sorry for the trouble; thanks for checking into this, John. In the previous incarnation of this, I had a lot of similar (though not identical problems) to this, and really had a lot of trouble breaking it this time around. I guess it's good that you were able to break it... ? I wonder what is different in this case. Ivan, could his computer not be logging him in quickly enough to the notebook when he uploads the worksheet? That would possibly cause the problem here. By the way, you're right that in the current state it's not that exciting to have a notebook already running and then do this at the command line instead of just using the upload dialogue, but we have a lot of anecdotal evidence that many people would love the next step, the double-click sws. |
I see: if I have a server already running and try
|
OK, I can confirm what @jhpalmieri sees. If a server is not already running, the browser opens twice and the sws file does not get loaded. If a server is already running, everything works fine. |
I have been able to reproduce it intermittently--though usually it works. It seems that when it doesn't work the sws file is uploaded, but it just opens the page to the worksheet list instead of editing the worksheet. My guess is that it's a timing issue with not being logged in. That is something I was worried about, but since it worked in my testing and it redirects correctly when not logged in (e.g. with |
Since the code resides entirely in the notebook, you should open a github issue, and then put the text "fix #n" (replace n with the issue number) in the commit message of the commit in which you fix the issue :) |
Actually, I think I was able to fix the issue for #76 already. I didn't expect it to be that easy. :-) I don't think there will be any negative repercussions to always using the |
This is for trac #8473 which is meant to allow double-clicking sws (and related files) to open in a locally running Sage notebook, starting it if need be.