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

Check GitHub for exclude files #115

Merged
merged 6 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions locale/es/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ msgid "Submitting"
msgstr "Entregando"

#: submit50.py:568
msgid "Submitted {}! See https://cs50.me/submissions/{}."
msgstr "¡Se entregó {}! Puedes ver https://cs50.me/submissions/{}."
msgid "Submitted {}! See https://cs50.me/submissions."
msgstr "¡Se entregó {}! Puedes ver https://cs50.me/submissions/."
Copy link
Member

Choose a reason for hiding this comment

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

No need for trailing slash.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!


#: submit50.py:615
msgid "Could not complete two-factor authentication."
Expand Down
12 changes: 10 additions & 2 deletions submit50.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,17 @@ def submit(org, problem):
if problem.split("/")[0].isdigit():
Copy link
Member

Choose a reason for hiding this comment

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

What if problem.split returns []?

Copy link
Member Author

Choose a reason for hiding this comment

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

This will go away, actually, per the other PR.

branch = os.path.join("cs50", problem)

# ensure problem exists
file, submit.EXCLUDE = tempfile.mkstemp()
url = "https://cs50.me/excludes/{}/".format(branch)

# separate branch into problem slug and source repo
branch = branch.rstrip("@cs50/checks")
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to strip this off, if it was, for whatever reason, explicitly mentioned?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's necessary so that students don't end up with some of their submissions on cs50/2017/x/greedy and some of them on cs50/2017/x/greedy@cs50/checks, for example. Best to keep all submissions for the same problem in one predetermined branch.

try:
slug, src = branch.split("@", 1)
Copy link
Member

Choose a reason for hiding this comment

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

Why the 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

Was an old version, not required anymore. Fixed.

except ValueError:
slug, src = branch, "cs50/checks"

# ensure problem exists
url = "https://raw.githubusercontent.com/{}/master/{}/submit50/exclude".format(src, slug)
try:
urllib.request.urlretrieve(url, filename=submit.EXCLUDE)
lines = open(submit.EXCLUDE)
Expand Down