diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-29 15:56:10 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-29 15:56:10 -0400 |
commit | dcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9 (patch) | |
tree | f9e9c8d2ba5190d1a71046cdb5fb3abdc0fcf74f /becommands/comment.py | |
parent | 4e8882e74aad64859a16f17fa6bef8c04b33913d (diff) | |
parent | 22a38de80ee11ada710bc6766798ca608f938307 (diff) | |
download | bugseverywhere-dcfe9d5e292fa4a405fafb4bdd6d9e2070f30fa9.tar.gz |
Merged interactive email interface
Diffstat (limited to 'becommands/comment.py')
-rw-r--r-- | becommands/comment.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index 4221ef8..14872a3 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -25,12 +25,12 @@ except ImportError: # look for non-core module from elementtree import ElementTree __desc__ = __doc__ -def execute(args, test=False): +def execute(args, manipulate_encodings=True): """ >>> import time >>> bd = bugdir.simple_bug_dir() >>> os.chdir(bd.root) - >>> execute(["a", "This is a comment about a"], test=True) + >>> execute(["a", "This is a comment about a"], manipulate_encodings=False) >>> bd._clear_bugs() >>> bug = cmdutil.bug_from_shortname(bd, "a") >>> bug.load_comments(load_full=False) @@ -38,7 +38,7 @@ def execute(args, test=False): >>> print comment.body This is a comment about a <BLANKLINE> - >>> comment.From == bd.user_id + >>> comment.author == bd.user_id True >>> comment.time <= int(time.time()) True @@ -47,12 +47,12 @@ def execute(args, test=False): >>> if 'EDITOR' in os.environ: ... del os.environ["EDITOR"] - >>> execute(["b"], test=True) + >>> execute(["b"], manipulate_encodings=False) Traceback (most recent call last): UserError: No comment supplied, and EDITOR not specified. >>> os.environ["EDITOR"] = "echo 'I like cheese' > " - >>> execute(["b"], test=True) + >>> execute(["b"], manipulate_encodings=False) >>> bd._clear_bugs() >>> bug = cmdutil.bug_from_shortname(bd, "b") >>> bug.load_comments(load_full=False) @@ -68,10 +68,10 @@ def execute(args, test=False): raise cmdutil.UsageError("Please specify a bug or comment id.") if len(args) > 2: raise cmdutil.UsageError("Too many arguments.") - + shortname = args[0] if shortname.count(':') > 1: - raise cmdutil.UserError("Invalid id '%s'." % shortname) + raise cmdutil.UserError("Invalid id '%s'." % shortname) elif shortname.count(':') == 1: # Split shortname generated by Comment.comment_shortnames() bugname = shortname.split(':')[0] @@ -79,9 +79,9 @@ def execute(args, test=False): else: bugname = shortname is_reply = False - + bd = bugdir.BugDir(from_disk=True, - manipulate_encodings=not test) + manipulate_encodings=manipulate_encodings) bug = cmdutil.bug_from_shortname(bd, bugname) bug.load_comments(load_full=False) if is_reply: @@ -89,7 +89,7 @@ def execute(args, test=False): bug_shortname=bugname) else: parent = bug.comment_root - + if len(args) == 1: # try to launch an editor for comment-body entry try: if parent == bug.comment_root: @@ -117,11 +117,11 @@ def execute(args, test=False): body = args[1] if not body.endswith('\n'): body+='\n' - + if options.XML == False: new = parent.new_reply(body=body) if options.author != None: - new.From = options.author + new.author = options.author if options.alt_id != None: new.alt_id = options.alt_id if options.content_type != None: |