From 5858454c7491fffcfba5d61d26581463ab70899d Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Tue, 3 Apr 2012 16:36:33 +0000
Subject: [PATCH 1/7] Declare coding system to work around annoying problem
 when the date produced by SVN is localized.  - Legacy-Id: 4252

---
 ietf/__init__.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ietf/__init__.py b/ietf/__init__.py
index ef073e9a0..18ae8e6d0 100644
--- a/ietf/__init__.py
+++ b/ietf/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright The IETF Trust 2007, All Rights Reserved
 
 __version__ = "4.01-dev"

From 25cb532348c188c7093830e3076a3105a6554897 Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Tue, 3 Apr 2012 16:46:23 +0000
Subject: [PATCH 2/7] Move last call announcement text to last call event
 rather than stuffing it inside the state change event.  - Legacy-Id: 4253

---
 ietf/idrfc/utils.py        | 7 -------
 ietf/idrfc/views_ballot.py | 4 +++-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/ietf/idrfc/utils.py b/ietf/idrfc/utils.py
index a9f5a6138..f19c25aa0 100644
--- a/ietf/idrfc/utils.py
+++ b/ietf/idrfc/utils.py
@@ -79,13 +79,6 @@ def log_state_changedREDESIGN(request, doc, by, prev_iesg_state, prev_iesg_tag):
     e = DocEvent(doc=doc, by=by)
     e.type = "changed_document"
     e.desc = u"State changed to <b>%s</b> from %s" % (state_name, prev_state_name)
-
-    if state.slug == "lc":
-        writeup = doc.latest_event(WriteupDocEvent, type="changed_last_call_text")
-        if writeup and writeup.text:
-            e.desc += "<br><br><b>The following Last Call Announcement was sent out:</b><br><br>"
-            e.desc += writeup.text.replace("\n", "<br><br>")
-
     e.save()
     return e
 
diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py
index cb090fc9e..416284253 100644
--- a/ietf/idrfc/views_ballot.py
+++ b/ietf/idrfc/views_ballot.py
@@ -1393,7 +1393,9 @@ def make_last_callREDESIGN(request, name):
             
             e = LastCallDocEvent(doc=doc, by=login)
             e.type = "sent_last_call"
-            e.desc = "Last call sent"
+            e.desc = "The following Last Call announcement was sent out:<br><br>"
+            e.desc += announcement
+
             if form.cleaned_data['last_call_sent_date'] != e.time.date():
                 e.time = datetime.datetime.combine(form.cleaned_data['last_call_sent_date'], e.time.time())
             e.expires = form.cleaned_data['last_call_expiration_date']

From 7b2963aaf0efe1925d9764102c1692f1815cc05a Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Thu, 5 Apr 2012 14:45:33 +0000
Subject: [PATCH 3/7] Move note about IANA scraping messages, apparently I
 managed to put it in the wrong place (they're of course scraping draft
 approvals, not the ballot announcements).  - Legacy-Id: 4260

---
 ietf/idrfc/mails.py        | 4 ----
 ietf/idrfc/views_ballot.py | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ietf/idrfc/mails.py b/ietf/idrfc/mails.py
index 4b7bcb78f..8993c0df4 100644
--- a/ietf/idrfc/mails.py
+++ b/ietf/idrfc/mails.py
@@ -586,10 +586,6 @@ def generate_issue_ballot_mailREDESIGN(request, doc):
     e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
     ballot_writeup = e.text if e else ""
 
-    # NOTE: according to Michelle Cotton <michelle.cotton@icann.org>
-    # (as per 2011-10-24) IANA is scraping these messages for
-    # information so would like to know beforehand if the format
-    # changes (perhaps RFC 6359 will change that)
     return render_to_string("idrfc/issue_ballot_mailREDESIGN.txt",
                             dict(doc=doc,
                                  doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py
index 416284253..9f1fa9eb2 100644
--- a/ietf/idrfc/views_ballot.py
+++ b/ietf/idrfc/views_ballot.py
@@ -1228,6 +1228,10 @@ def approve_ballotREDESIGN(request, name):
     else:
         action = "to_announcement_list"
 
+    # NOTE: according to Michelle Cotton <michelle.cotton@icann.org>
+    # (as per 2011-10-24) IANA is scraping these messages for
+    # information so would like to know beforehand if the format
+    # changes (perhaps RFC 6359 will change that)
     announcement = approval_text + "\n\n" + ballot_writeup
         
     if request.method == 'POST':

From b418e5d14135f8083d802f0ce59b3ce9dbf6b9bb Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Mon, 23 Apr 2012 17:52:22 +0000
Subject: [PATCH 4/7] Fix missing "return" in liaison proxy, fixes problem with
 from email on https://datatracker.ietf.org/liaison/1154/ as reported by
 Stephanie McCammon.  - Legacy-Id: 4307

---
 ietf/liaisons/proxy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ietf/liaisons/proxy.py b/ietf/liaisons/proxy.py
index d74ed3d78..d92120330 100644
--- a/ietf/liaisons/proxy.py
+++ b/ietf/liaisons/proxy.py
@@ -136,7 +136,7 @@ class LiaisonDetailProxy(LiaisonStatement):
     def from_sdo(self):
         return self.from_group if self.from_group and self.from_group.type_id == "sdo" else None
     def from_email(self):
-        self.from_contact.address
+        return self.from_contact.address
     def get_absolute_url(self):
 	return '/liaison/%d/' % self.detail_id
     class Meta:

From 9b4415fe5166590591f16a89663ddefed2e77530 Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Mon, 23 Apr 2012 20:14:04 +0000
Subject: [PATCH 5/7] Fix problem with direct replyto path in liaison form not
 using role emails (reported by Stephanie McCammon).  - Legacy-Id: 4310

---
 ietf/liaisons/formsREDESIGN.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/ietf/liaisons/formsREDESIGN.py b/ietf/liaisons/formsREDESIGN.py
index 91a689611..06d999edc 100644
--- a/ietf/liaisons/formsREDESIGN.py
+++ b/ietf/liaisons/formsREDESIGN.py
@@ -16,7 +16,7 @@ from ietf.liaisons.widgets import (FromWidget, ReadOnlyWidget, ButtonWidget,
 from ietf.liaisons.models import LiaisonStatement, LiaisonStatementPurposeName
 from ietf.liaisons.proxy import LiaisonDetailProxy
 from ietf.group.models import Group
-from ietf.person.models import Person
+from ietf.person.models import Person, Email
 from ietf.doc.models import Document
 
 
@@ -313,6 +313,14 @@ class IncomingLiaisonForm(LiaisonForm):
         self.fields['from_field'].choices = [('sdo_%s' % i.pk, i.name) for i in sdos.order_by("name")]
         self.fields['from_field'].widget.submitter = unicode(self.person)
 
+    def set_replyto_field(self):
+        e = Email.objects.filter(person=self.person, role__group__state="active", role__name__in=["liaiman", "auth"])
+        if e:
+            addr = e[0].address
+        else:
+            addr = self.person.email_address()
+        self.fields['replyto'].initial = addr
+
     def set_organization_field(self):
         self.fields['organization'].choices = self.hm.get_all_incoming_entities()
 
@@ -360,6 +368,14 @@ class OutgoingLiaisonForm(LiaisonForm):
         self.fields['from_field'].widget.submitter = unicode(self.person)
         self.fieldsets[0] = ('From', ('from_field', 'replyto', 'approved'))
 
+    def set_replyto_field(self):
+        e = Email.objects.filter(person=self.person, role__group__state="active", role__name__in=["ad", "chair"])
+        if e:
+            addr = e[0].address
+        else:
+            addr = self.person.email_address()
+        self.fields['replyto'].initial = addr
+
     def set_organization_field(self):
         # If the user is a liaison manager and is nothing more, reduce the To field to his SDOs
         if not self.hm.get_entities_for_person(self.person) and is_sdo_liaison_manager(self.person):

From bbeaa2d022480b930413131244f4bb0c0b56162c Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Mon, 23 Apr 2012 20:18:23 +0000
Subject: [PATCH 6/7] Fix bug in liaison form that prevents Secretariat users
 from posting statements on behalf of SDO liaison managers in some cases.  -
 Legacy-Id: 4311

---
 ietf/liaisons/formsREDESIGN.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ietf/liaisons/formsREDESIGN.py b/ietf/liaisons/formsREDESIGN.py
index 06d999edc..507c92e95 100644
--- a/ietf/liaisons/formsREDESIGN.py
+++ b/ietf/liaisons/formsREDESIGN.py
@@ -425,7 +425,7 @@ class OutgoingLiaisonForm(LiaisonForm):
         # If the from entity is one in wich the user has full privileges the to entity could be anyone
         if from_code in [i[0] for i in all_entities]:
             return to_code
-        sdo_codes = ['sdo_%s' % i.pk for i in liaison_manager_sdos(self.person)]
+        sdo_codes = ['sdo_%s' % i.pk for i in liaison_manager_sdos(person)]
         if to_code in sdo_codes:
             return to_code
         entity = self.get_to_entity()

From 7db44f8e50c90bebfec4def61a20e766418aabac Mon Sep 17 00:00:00 2001
From: Ole Laursen <olau@iola.dk>
Date: Wed, 25 Apr 2012 11:00:40 +0000
Subject: [PATCH 7/7] Only query for regular IETF meetings when calculating cut
 off dates (reported by Ryan Cross).  - Legacy-Id: 4319

---
 ietf/meeting/models.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py
index 617ae0d18..4cef31d5d 100644
--- a/ietf/meeting/models.py
+++ b/ietf/meeting/models.py
@@ -52,19 +52,19 @@ class Meeting(models.Model):
 
     @classmethod
     def get_first_cut_off(cls):
-        date = cls.objects.all().order_by('-date')[0].date
+        date = cls.objects.all().filter(type="ietf").order_by('-date')[0].date
         offset = datetime.timedelta(days=settings.FIRST_CUTOFF_DAYS)
         return date - offset
 
     @classmethod
     def get_second_cut_off(cls):
-        date = cls.objects.all().order_by('-date')[0].date
+        date = cls.objects.all().filter(type="ietf").order_by('-date')[0].date
         offset = datetime.timedelta(days=settings.SECOND_CUTOFF_DAYS)
         return date - offset
 
     @classmethod
     def get_ietf_monday(cls):
-        date = cls.objects.all().order_by('-date')[0].date
+        date = cls.objects.all().filter(type="ietf").order_by('-date')[0].date
         return date + datetime.timedelta(days=-date.weekday(), weeks=1)
 
     # the various dates are currently computed