@@ -37,7 +37,6 @@ from patchwork.parser import parse_patch
from patchwork.models import Patch, Project, Person, Comment, State
from django.contrib.auth.models import User
-default_patch_state = 'New'
list_id_headers = ['List-ID', 'X-Mailing-List', 'X-list']
whitespace_re = re.compile('\s+')
@@ -349,7 +348,7 @@ def get_state(state_name):
return State.objects.get(name__iexact=state_name)
except State.DoesNotExist:
pass
- return State.objects.get(name=default_patch_state)
+ return None
def get_delegate(delegate_email):
""" Return the delegate with the given email or None """
@@ -395,9 +394,13 @@ def parse_mail(mail):
patch.submitter = author
patch.msgid = msgid
patch.project = project
- patch.state = get_state(mail.get('X-Patchwork-State', '').strip())
patch.delegate = get_delegate(
mail.get('X-Patchwork-Delegate', '').strip())
+ initial_patch_state = get_state(
+ mail.get('X-Patchwork-State', '').strip())
+ if not initial_patch_state is None:
+ patch.state = initial_patch_state
+
try:
patch.save()
except Exception, ex:
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> --- (untested, need a bit to get back into it. I cannot assign None to select the default state, can I?) apps/patchwork/bin/parsemail.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)