This is needed because the user might introduce characters not handled
by the current encoding and StGIT could no longer change it. The
disadvantage is that not all the e-mail headers are visible in the
editor but users shouldn't manually modify them anyway.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
# encode the body and set the MIME and encoding headers
msg.set_charset(charset)
# encode the body and set the MIME and encoding headers
msg.set_charset(charset)
+def __edit_message(msg):
fname = '.stgitmail.txt'
# create the initial file
fname = '.stgitmail.txt'
# create the initial file
raise CmdException, 'Only "%(name)s" variables are ' \
'supported in the patch template'
raise CmdException, 'Only "%(name)s" variables are ' \
'supported in the patch template'
+ if options.edit_cover:
+ msg_string = __edit_message(msg_string)
+
# The Python email message
try:
msg = email.message_from_string(msg_string)
# The Python email message
try:
msg = email.message_from_string(msg_string)
msg_string = msg.as_string(options.mbox)
msg_string = msg.as_string(options.mbox)
- if options.edit_cover:
- msg_string = edit_message(msg_string)
-
return msg_string.strip('\n')
def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
return msg_string.strip('\n')
def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
raise CmdException, 'Only "%(name)s" variables are ' \
'supported in the patch template'
raise CmdException, 'Only "%(name)s" variables are ' \
'supported in the patch template'
+ if options.edit_patches:
+ msg_string = __edit_message(msg_string)
+
# The Python email message
try:
msg = email.message_from_string(msg_string)
# The Python email message
try:
msg = email.message_from_string(msg_string)
msg_string = msg.as_string(options.mbox)
msg_string = msg.as_string(options.mbox)
- if options.edit_patches:
- msg_string = edit_message(msg_string)
-
return msg_string.strip('\n')
def func(parser, options, args):
return msg_string.strip('\n')
def func(parser, options, args):