If no title is provided, use ' ' by default instead of erroring out (issue 5577063)

1 view
Skip to first unread message

mar...@chromium.org

unread,
Jan 27, 2012, 2:46:01 PM1/27/12
to albrec...@googlemail.com, coderevie...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: Andi Albrecht,

Message:
It annoys a lot of devs that a string is required.


http://codereview.appspot.com/5577063/diff/1/upload.py
File upload.py (right):

http://codereview.appspot.com/5577063/diff/1/upload.py#newcode2251
upload.py:2251: title = title or ' '
It's a more redundant written this way but a bit more readable. I'm open
to other format.

Description:
If no title is provided, use ' ' by default instead of erroring out

Please review this at http://codereview.appspot.com/5577063/

Affected files:
M upload.py


Index: upload.py
===================================================================
--- a/upload.py
+++ b/upload.py
@@ -2246,10 +2246,9 @@
prompt = "Title describing this patch set: "
else:
prompt = "New issue subject: "
- title = (
- title or message.split('\n', 1)[0].strip() or
raw_input(prompt)).strip()
- if not title:
- ErrorExit("A non-empty title is required")
+ title = title or message.split('\n', 1)[0].strip()
+ title = title or raw_input(prompt).strip()
+ title = title or ' '
if len(title) > 100:
title = title[:99] + '…'
if title and not options.issue:


albrec...@googlemail.com

unread,
Jan 29, 2012, 3:50:33 AM1/29/12
to mar...@chromium.org, coderevie...@googlegroups.com, re...@codereview-hr.appspotmail.com
I assume that the devs are annoyed when uploading a intermediate result
of their work, but not when publishing a changeset for review.

Therefore I would keep the "empty title" check but broaden it to
something like "if title is empty and send_mail flag is set (or issue is
new)". Otherwise when the title is empty we send mails with " (issue
123)" as subject.

What about parenthesis?

title = (title or message...
or raw_input...
or ' ')

That'd reduce it to a single assignment.

On 2012/01/27 19:46:01, M-A wrote:
> It's a more redundant written this way but a bit more readable. I'm
open to
> other format.

http://codereview.appspot.com/5577063/

mar...@chromium.org

unread,
Jan 30, 2012, 11:03:21 AM1/30/12
to albrec...@googlemail.com, coderevie...@googlegroups.com, re...@codereview-hr.appspotmail.com

albrec...@googlemail.com

unread,
Jan 31, 2012, 2:07:06 AM1/31/12
to mar...@chromium.org, coderevie...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reply all
Reply to author
Forward
0 new messages