Fix a bunch of merge bugs

- Legacy-Id: 3191
This commit is contained in:
Ole Laursen 2011-06-29 13:05:11 +00:00
parent 91b3212330
commit af768fb633
5 changed files with 39 additions and 16 deletions

View file

@ -49,13 +49,13 @@ def send_scheduled_announcementREDESIGN(send_queue):
# announcement.content_type can contain a case-sensitive parts separator,
# so we need to keep it as is, not lowercased, but we want a lowercased
# version for the coming comparisons.
content_type_lowercase = announcement.content_type.lower()
content_type_lowercase = message.content_type.lower()
if not content_type_lowercase or 'text/plain' in content_type_lowercase:
send_mail_text(None, message.to, message.frm, message.subject,
body, cc=message.cc, bcc=message.bcc)
elif 'multipart' in content_type_lowercase:
# make body a real message so we can parse it
body = ("MIME-Version: 1.0\r\nContent-Type: %s\r\n" % announcement.content_type) + body
body = ("MIME-Version: 1.0\r\nContent-Type: %s\r\n" % message.content_type) + body
msg = email.message_from_string(body.encode("utf-8"))
send_mail_mime(None, message.to, message.frm, message.subject,

View file

@ -11,8 +11,8 @@ from django.core.urlresolvers import reverse as urlreverse
from ietf.utils.mail import send_mail, send_mail_text
from ietf.idtracker.models import *
from ietf.ipr.search import iprs_from_docs
from doc.models import WriteupDocEvent, BallotPositionDocEvent, LastCallDocEvent
from person.models import Person
from redesign.doc.models import WriteupDocEvent, BallotPositionDocEvent, LastCallDocEvent, DocAlias
from redesign.person.models import Person
def email_state_changed(request, doc, text):
to = [x.strip() for x in doc.idinternal.state_change_notice_to.replace(';', ',').split(',')]
@ -157,9 +157,8 @@ def generate_last_call_announcementREDESIGN(request, doc):
cc.append(doc.group.list_email)
doc.filled_title = textwrap.fill(doc.title, width=70, subsequent_indent=" " * 3)
url = settings.IDTRACKER_BASE_URL + doc.get_absolute_url()
iprs, docs = iprs_from_docs([ doc ])
iprs, _ = iprs_from_docs([ DocAlias.objects.get(name=doc.canonical_name()) ])
if iprs:
ipr_links = [ urlreverse("ietf.ipr.views.show", kwargs=dict(ipr_id=i.ipr_id)) for i in iprs]
ipr_links = [ settings.IDTRACKER_BASE_URL+url if not url.startswith("http") else url for url in ipr_links ]
@ -168,18 +167,18 @@ def generate_last_call_announcementREDESIGN(request, doc):
mail = render_to_string("idrfc/last_call_announcement.txt",
dict(doc=doc,
doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url() + "ballot/",
expiration_date=expiration_date.strftime("%Y-%m-%d"), #.strftime("%B %-d, %Y"),
cc=", ".join("<%s>" % e for e in cc),
group=group,
docs=docs,
urls=[url],
docs=[ doc ],
urls=[ settings.IDTRACKER_BASE_URL + doc.get_absolute_url() ],
status=status,
impl_report="Draft" in status or "Full" in status,
ipr_links=ipr_links,
)
)
e = WriteupDocEvent()
e.type = "changed_last_call_text"
e.by = request.user.get_profile()

View file

@ -463,11 +463,12 @@ class EditPositionTestCase(django.test.TestCase):
# vote on behalf of AD
events_before = draft.docevent_set.count()
r = self.client.post(url, dict(position="discuss"))
r = self.client.post(url, dict(position="discuss", discuss="Test discuss text"))
self.assertEquals(r.status_code, 302)
pos = draft.latest_event(BallotPositionDocEvent, ad=ad)
self.assertEquals(pos.pos.slug, "discuss")
self.assertEquals(pos.discuss, "Test discuss text")
self.assertTrue("New position" in pos.desc)
self.assertTrue("by Sec" in pos.desc)

View file

@ -471,16 +471,15 @@ def send_ballot_commentREDESIGN(request, name):
c = pos.comment
subj.append("COMMENT")
ad_name = ad.get_name()
ad_name_genitive = ad_name + "'" if ad_name.endswith('s') else ad_name + "'s"
subject = "%s %s on %s" % (ad_name_genitive, pos.pos.name if pos.pos else "No Position", "%s-%02d" % (doc.name, doc.rev))
ad_name_genitive = ad.name + "'" if ad.name.endswith('s') else ad.name + "'s"
subject = "%s %s on %s" % (ad_name_genitive, pos.pos.name if pos.pos else "No Position", doc.name + "-" + doc.rev)
if subj:
subject += ": (with %s)" % " and ".join(subj)
doc.filename = doc.name # compatibility attributes
doc.revision_display = doc.rev
body = render_to_string("idrfc/ballot_comment_mail.txt",
dict(discuss=d, comment=c, ad=ad.get_name(), doc=doc, pos=pos.pos))
dict(discuss=d, comment=c, ad=ad.name, doc=doc, pos=pos.pos))
frm = ad.formatted_email()
to = "The IESG <iesg@ietf.org>"

View file

@ -1,6 +1,7 @@
from django.contrib.auth.models import User
from ietf.iesg.models import TelechatDates, WGAction
from ietf.ipr.models import IprDetail, IprDocAlias
from redesign.doc.models import *
from redesign.name.models import *
from redesign.group.models import *
@ -122,7 +123,7 @@ def make_test_data():
note="",
)
DocAlias.objects.create(
doc_alias = DocAlias.objects.create(
document=draft,
name=draft.name,
)
@ -140,6 +141,29 @@ def make_test_data():
doc=draft,
desc="Added draft",
)
# IPR
ipr = IprDetail.objects.create(
title="Statement regarding rights",
legal_name="Native Martians United",
is_pending=0,
applies_to_all=1,
licensing_option=1,
lic_opt_a_sub=2,
lic_opt_b_sub=2,
lic_opt_c_sub=2,
comments="",
lic_checkbox=True,
other_notes="",
status=1,
submitted_date=datetime.date.today(),
)
IprDocAlias.objects.create(
ipr=ipr,
doc_alias=doc_alias,
rev="00",
)
# telechat dates
t = datetime.date.today()