-
Notifications
You must be signed in to change notification settings - Fork 374
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
Make CWS multi-contest #594
Conversation
250c7ce
to
3989ad8
Compare
participation = self.current_user | ||
|
||
if not self.r_params["testing_enabled"]: | ||
self.redirect("/") | ||
return | ||
raise tornado.web.HTTPError(403) |
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.
This change is not needed for the overall patch, but I figured it was a sensible change (which didn't require a different commit or a different PR)
fee5af7
to
c732e40
Compare
2d01624
to
8d867ab
Compare
|
||
ret["contest"] = self.contest | ||
ret["contest_root"] = ret["url_root"] | ||
ret["real_contest_root"] = "/" |
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 you explain the semantic of contest_root
and real_contest_root
?
In some scenarios, this PR causes trouble with StartHandler
and LogoutHandler
.
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.
url_root
includes all necessary ../
to go back to the root, so if the URL is localhost:8888/a/b/c
then url_root
is ../../
real_url_root
is always /
contest_root
is url_root
+ the name of the contest, real_contest_root
is /
+ the contest name.
Anyway, I once saw some issues with LogoutHandler, but then I think I fixed them. Do you still see issues?
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.
Assume that current URL is localhost:8888/a
. Let's start our timer to compete, actually calling StartHandler
.
Now that I've understood the meaning, variables are correctly setted as:
url_root = ..
contest_root = ../a
real_contest_root = /a
StartHandler
tries to redirect the user to ../a
(see https://github.com/wil93/cms/blob/multi_cws/cms/server/contest/handlers/main.py#L148)
but our custom redirector (see https://github.com/wil93/cms/blob/multi_cws/cms/server/util.py#L714) creates the invalid URL localhost:8888/a/..../a
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.
I thought I had fixed that, but it seems this bug is still on the multi_cws
branch 😕
I think I fixed it in PR #646 (which is based on this one). I'll backport the fixes here 😄
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.
Done, thanks 😄 it looks like I had fixed this in the wrong branch (and just for LogoutHandler, thus leaving a broken StartHandler)
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.
Everything works as expected now ;)
With this branch I don't see a language selection option in CWS. Can you reproduce this? |
@andreyv Yes, I had noticed that some time ago but didn't investigate. I tried to fix it now, it should work |
I rebased this PR to master - it was great fun, but I suggest we don't do it again and try to close it asap, by commenting here and fixing up in my branch (once done commenting, I can publish my branch to let you try it out, if you want) Unless you have better ideas, that is... Looking again at the code now. |
I'm not sure I understand what's the plan 😅 |
@@ -83,15 +84,25 @@ def __init__(self, shard, contest): | |||
"contest_listen_address and contest_listen_port " | |||
"in cms.conf." % __name__) | |||
|
|||
self.contest = contest | |||
del contest |
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.
Why are you deleting a local variable?
How does this work when CWS is managed by RS? From what I see I understand that CWS will always be started in single-contest mode. Is that correct? |
If you put -c some_number, then it will start as usual (single contest),
otherwise it will require a prefix /contest_name/ in the URL. In the home
page a list of contests will be shown.
The reason of deleting the local variable was just to ensure a single point
of truth, I think I've seen somebody using that practice
Il mar 28 mar 2017, 15:41 Luca Wehrstedt <notifications@github.com> ha
scritto:
… How does this work when CWS is managed by RS? From what I see I understand
that CWS will always be started in single-contest mode. Is that correct?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#594 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABOc8QZmRgvQGPGsQoP-IXQ6kIwcUZH1ks5rqQ37gaJpZM4H5HWi>
.
|
You didn't understand my question. I wasn't talking about how to launch CWS from the command line. I was in some sense saying that it appears to me that it's impossible to launch CWS in multi-contest mode when RS is used to manage it. Am I wrong? Also, AFAIK, we don't do that, we don't remove local variables. |
@lerks I don't see it as a problem for the first submitted version of this code. @wil93 I wanted to comment here, but my work is done mostly when I don't have internet connection and reviewable doesn't make it easy - how about I jot down a first fixup commit with straightforward stuff, send a PR with these commits and my fixups, and we can continue the discussion there? |
Yes I did not modify RS so it will launch CWS as single contest. I don't
use RS (I prefer supervisord) so I didn't think about this.
Stefano: OK for me
Il mar 28 mar 2017, 15:55 Stefano Maggiolo <notifications@github.com> ha
scritto:
… @lerks <https://github.com/lerks> I don't see it as a problem for the
first submitted version of this code.
@wil93 <https://github.com/wil93> I wanted to comment here, but my work
is done mostly when I don't have internet connection and reviewable doesn't
make it easy - how about I jot down a first fixup commit with
straightforward stuff, send a PR with these commits and my fixups, and we
can continue the discussion there?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#594 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABOc8fDU0Lsz1KTss57FynCGMZrqNePFks5rqRFpgaJpZM4H5HWi>
.
|
See #739 |
Damn, just a tad out of our service level agreement of one year ;P Merged! |
With this patch, ContestWebServer does not require a
-c
flag anymore. When you start CWS, it will expose a list of all available contests on/
, and you can click on the contest that you're interested in.The former cookie behavior was to save 2 cookies:
login
andunread_count
. The new cookie behavior is to save 2*N cookies where N is the number of contests. Each cookie will either be<contest-name>_login
or<contest-name>_unread_count
.This PR depends on #545
This change is