A couple of fixes, plus required permissions in the grant-all script.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
PATCHWORK_BASE="/srv/patchwork"
PATCHWORK_BASE="/srv/patchwork"
then
echo "usage: $0 <dir>" >&2
exit 1
then
echo "usage: $0 <dir>" >&2
exit 1
+echo "dir: $mail_dir"
+
+if [ ! -d "$mail_dir" ]
- echo "$mail_dir should be a directory"?&2
+ echo "$mail_dir should be a directory"? >&2
echo $line
PYTHONPATH="$PATCHWORK_BASE/apps":"$PATCHWORK_BASE/lib/python" \
DJANGO_SETTINGS_MODULE=settings \
echo $line
PYTHONPATH="$PATCHWORK_BASE/apps":"$PATCHWORK_BASE/lib/python" \
DJANGO_SETTINGS_MODULE=settings \
- "$PATCHWORK_BASE/apps/patchworkbin/parsemail.py" <
+ "$PATCHWORK_BASE/apps/patchwork/bin/parsemail.py" < \
if name is not None:
name = name.strip()
if name is not None:
name = name.strip()
try:
person = Person.objects.get(email = email)
except Person.DoesNotExist:
person = Person(name = name, email = email)
try:
person = Person.objects.get(email = email)
except Person.DoesNotExist:
person = Person(name = name, email = email)
+ return (person, new_person)
def mail_date(mail):
t = parsedate_tz(mail.get('Date', ''))
def mail_date(mail):
t = parsedate_tz(mail.get('Date', ''))
msgid = mail.get('Message-Id').strip()
msgid = mail.get('Message-Id').strip()
- author = find_author(mail)
+ (author, save_required) = find_author(mail)
(patch, comment) = find_content(project, mail)
if patch:
(patch, comment) = find_content(project, mail)
if patch:
+ # we delay the saving until we know we have a patch.
+ if save_required:
+ author.save()
+ save_required = False
patch.submitter = author
patch.msgid = msgid
patch.project = project
patch.submitter = author
patch.msgid = msgid
patch.project = project
print ex.message
if comment:
print ex.message
if comment:
+ if save_required:
+ author.save()
# looks like the original constructor for Comment takes the pk
# when the Comment is created. reset it here.
if patch:
# looks like the original constructor for Comment takes the pk
# when the Comment is created. reset it here.
if patch:
patchwork_person
TO "nobody";
GRANT SELECT ON
patchwork_person
TO "nobody";
GRANT SELECT ON
+ patchwork_project,
+ patchwork_state
TO "nobody";
GRANT UPDATE, SELECT ON
patchwork_patch_id_seq,
TO "nobody";
GRANT UPDATE, SELECT ON
patchwork_patch_id_seq,