Beispiel #1
0
def generate_last_call_announcement(request, doc):
    expiration_date = datetime.date.today() + datetime.timedelta(days=14)
    if doc.group.type_id in ("individ", "area"):
        group = "an individual submitter"
        expiration_date += datetime.timedelta(days=14)
    else:
        group = "the %s %s (%s)" % (doc.group.name, doc.group.type.name,
                                    doc.group.acronym)

    doc.filled_title = textwrap.fill(doc.title,
                                     width=70,
                                     subsequent_indent=" " * 3)

    iprs = iprs_from_docs(
        related_docs(DocAlias.objects.get(name=doc.canonical_name())))
    if iprs:
        ipr_links = [
            urlreverse("ietf.ipr.views.show", kwargs=dict(id=i.id))
            for i in iprs
        ]
        ipr_links = [
            settings.IDTRACKER_BASE_URL +
            url if not url.startswith("http") else url for url in ipr_links
        ]
    else:
        ipr_links = None

    downrefs = [
        rel for rel in doc.relateddocument_set.all()
        if rel.is_downref() and not rel.is_approved_downref()
    ]

    addrs = gather_address_lists('last_call_issued', doc=doc).as_strings()
    mail = render_to_string(
        "doc/mail/last_call_announcement.txt",
        dict(
            doc=doc,
            doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url() +
            "ballot/",
            expiration_date=expiration_date.strftime(
                "%Y-%m-%d"),  #.strftime("%B %-d, %Y"),
            to=addrs.to,
            cc=addrs.cc,
            group=group,
            docs=[doc],
            urls=[settings.IDTRACKER_BASE_URL + doc.get_absolute_url()],
            ipr_links=ipr_links,
            downrefs=downrefs,
        ))

    e = WriteupDocEvent()
    e.type = "changed_last_call_text"
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev
    e.desc = u"Last call announcement was generated"
    e.text = unicode(mail)

    # caller is responsible for saving, if necessary
    return e
Beispiel #2
0
def generate_ballot_writeup(request, doc):
    e = WriteupDocEvent()
    e.type = "changed_ballot_writeup_text"
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev,
    e.desc = u"Ballot writeup was generated"
    e.text = unicode(render_to_string("doc/charter/ballot_writeup.txt"))

    # caller is responsible for saving, if necessary
    return e
Beispiel #3
0
def generate_ballot_rfceditornote(request, doc):
    e = WriteupDocEvent()
    e.type = "changed_ballot_rfceditornote_text"
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev
    e.desc = u"RFC Editor Note for ballot was generated"
    e.text = unicode(render_to_string("doc/mail/ballot_rfceditornote.txt"))
    e.save()

    return e
Beispiel #4
0
def generate_ballot_writeup(request, doc):
    e = doc.latest_event(type="iana_review")
    iana = e.desc if e else ""

    e = WriteupDocEvent()
    e.type = "changed_ballot_writeup_text"
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev
    e.desc = u"Ballot writeup was generated"
    e.text = unicode(
        render_to_string("doc/mail/ballot_writeup.txt", {'iana': iana}))

    # caller is responsible for saving, if necessary
    return e
Beispiel #5
0
def generate_approval_mail(request, doc):
    if doc.get_state_slug(
            "draft-iesg") in DO_NOT_PUBLISH_IESG_STATES or doc.stream_id in (
                'ise', 'irtf'):
        mail = generate_approval_mail_rfc_editor(request, doc)
    else:
        mail = generate_approval_mail_approved(request, doc)

    e = WriteupDocEvent()
    e.type = "changed_ballot_approval_text"
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev
    e.desc = u"Ballot approval text was generated"
    e.text = unicode(mail)

    # caller is responsible for saving, if necessary
    return e
Beispiel #6
0
def generate_last_call_text(request, doc):

    # requester should be set based on doc.group once the group for a status change can be set to something other than the IESG
    # and when groups are set, vary the expiration time accordingly

    requester = "an individual participant"
    expiration_date = datetime.date.today() + datetime.timedelta(days=28)
    cc = []

    new_text = render_to_string(
        "doc/status_change/last_call_announcement.txt",
        dict(doc=doc,
             settings=settings,
             requester=requester,
             expiration_date=expiration_date.strftime("%Y-%m-%d"),
             changes=[
                 '%s from %s to %s\n    (%s)' %
                 (rel.target.name.upper(), rel.target.document.std_level.name,
                  newstatus(rel), rel.target.document.title)
                 for rel in doc.relateddocument_set.filter(
                     relationship__slug__in=STATUSCHANGE_RELATIONS)
             ],
             urls=[
                 rel.target.document.get_absolute_url()
                 for rel in doc.relateddocument_set.filter(
                     relationship__slug__in=STATUSCHANGE_RELATIONS)
             ],
             cc=cc))

    e = WriteupDocEvent()
    e.type = 'changed_last_call_text'
    e.by = request.user.person
    e.doc = doc
    e.rev = doc.rev
    e.desc = 'Last call announcement was generated'
    e.text = unicode(new_text)
    e.save()

    return e
Beispiel #7
0
    def test_edit_verify_permissions(self):
        def verify_fail(username, url):
            if username:
                self.client.login(username=username,
                                  password=username + "+password")
            r = self.client.get(url)
            self.assertEqual(r.status_code, 403)

        def verify_can_see(username, url):
            self.client.login(username=username,
                              password=username + "+password")
            r = self.client.get(url)
            self.assertEqual(r.status_code, 200)
            q = PyQuery(r.content)
            self.assertEqual(len(q("<textarea class=\"form-control\"")), 1)

        draft = make_test_data()

        events = []

        e = WriteupDocEvent()
        e.type = "changed_ballot_approval_text"
        e.by = Person.objects.get(name="(System)")
        e.doc = draft
        e.rev = draft.rev
        e.desc = u"Ballot approval text was generated"
        e.text = u"Test approval text."
        e.save()
        events.append(e)

        e = WriteupDocEvent()
        e.type = "changed_ballot_writeup_text"
        e.by = Person.objects.get(name="(System)")
        e.doc = draft
        e.rev = draft.rev
        e.desc = u"Ballot writeup was generated"
        e.text = u"Test ballot writeup text."
        e.save()
        events.append(e)

        e = WriteupDocEvent()
        e.type = "changed_ballot_rfceditornote_text"
        e.by = Person.objects.get(name="(System)")
        e.doc = draft
        e.rev = draft.rev
        e.desc = u"RFC Editor Note for ballot was generated"
        e.text = u"Test note to the RFC Editor text."
        e.save()
        events.append(e)

        # IETF Stream Documents
        for p in [
                'ietf.doc.views_ballot.ballot_approvaltext',
                'ietf.doc.views_ballot.ballot_writeupnotes',
                'ietf.doc.views_ballot.ballot_rfceditornote'
        ]:
            url = urlreverse(p, kwargs=dict(name=draft.name))

            for username in [
                    'plain', 'marschairman', 'iab chair', 'irtf chair', 'ise',
                    'iana'
            ]:
                verify_fail(username, url)

            for username in ['secretary', 'ad']:
                verify_can_see(username, url)

        # RFC Editor Notes for documents in the IAB Stream
        draft.stream_id = 'iab'
        draft.save_with_history(events)
        url = urlreverse('ietf.doc.views_ballot.ballot_rfceditornote',
                         kwargs=dict(name=draft.name))

        for username in [
                'plain', 'marschairman', 'ad', 'irtf chair', 'ise', 'iana'
        ]:
            verify_fail(username, url)

        for username in ['secretary', 'iab chair']:
            verify_can_see(username, url)

        # RFC Editor Notes for documents in the IRTF Stream
        e = DocEvent(doc=draft,
                     rev=draft.rev,
                     by=Person.objects.get(name="(System)"),
                     type='changed_stream')
        e.desc = u"Changed stream to <b>%s</b>" % 'irtf'
        e.save()

        draft.stream_id = 'irtf'
        draft.save_with_history([e])
        url = urlreverse('ietf.doc.views_ballot.ballot_rfceditornote',
                         kwargs=dict(name=draft.name))

        for username in [
                'plain', 'marschairman', 'ad', 'iab chair', 'ise', 'iana'
        ]:
            verify_fail(username, url)

        for username in ['secretary', 'irtf chair']:
            verify_can_see(username, url)

        # RFC Editor Notes for documents in the IAB Stream
        e = DocEvent(doc=draft,
                     rev=draft.rev,
                     by=Person.objects.get(name="(System)"),
                     type='changed_stream')
        e.desc = u"Changed stream to <b>%s</b>" % 'ise'
        e.save()

        draft.stream_id = 'ise'
        draft.save_with_history([e])
        url = urlreverse('ietf.doc.views_ballot.ballot_rfceditornote',
                         kwargs=dict(name=draft.name))

        for username in [
                'plain', 'marschairman', 'ad', 'iab chair', 'irtf chair',
                'iana'
        ]:
            verify_fail(username, url)

        for username in ['secretary', 'ise']:
            verify_can_see(username, url)