Repository: ietf-tools/datatracker

Issue:
bibtex is invalid for non-current draft versions
Since DocHistory doesn't have a .pub_date(), attempts to render bibtex from a DocHistory object come out like this in production:
```
%% You should probably cite draft-ietf-stir-rfc4916-update-02 instead of this revision.
@techreport{ietf-stir-rfc4916-update-01,
    number =    {draft-ietf-stir-rfc4916-update-01},
    type =      {Internet-Draft},
    institution =   {Internet Engineering Task Force},
    publisher = {Internet Engineering Task Force},
    note =      {Work in Progress},
    url =       {https://datatracker.ietf.org/doc/draft-ietf-stir-rfc4916-update/01/},
        author =    {Jon Peterson and Chris Wendt},
    title =     {{Connected Identity for STIR}},
    pagetotal = 17,
    year =      ,
    month =     ,
    day =       ,
    abstract =  {The SIP Identity header conveys cryptographic identity information about the originators of SIP requests. The Secure Telephone Identity Revisited (STIR) framework however provides no means for determining the identity of the called party in a traditional telephone calling scenario. This document updates prior guidance on the "connected identity" problem to reflect the changes to SIP Identity that accompanied STIR, and considers a revised problem space for connected identity as a means of detecting calls that have been retargeted to a party impersonating the intended destination, as well as the spoofing of mid-dialog or dialog-terminating events by intermediaries or third parties.},
}
```
and this in development
```
%% You should probably cite draft-ietf-stir-rfc4916-update-02 instead of this revision.
@techreport{ietf-stir-rfc4916-update-01,
    number =    {draft-ietf-stir-rfc4916-update-01},
    type =      {Internet-Draft},
    institution =   {Internet Engineering Task Force},
    publisher = {Internet Engineering Task Force},
    note =      {Work in Progress},
    url =       {https://datatracker.ietf.org/doc/draft-ietf-stir-rfc4916-update/01/},
        author =    {Jon Peterson and Chris Wendt},
    title =     {{Connected Identity for STIR}},
    pagetotal = 17,
    year =      ** No value found for 'doc.pub_date.year' **,
    month =     ** No value found for 'doc.pub_date' **,
    day =       ** No value found for 'doc.pub_date.day' **,
    abstract =  {The SIP Identity header conveys cryptographic identity information about the originators of SIP requests. The Secure Telephone Identity Revisited (STIR) framework however provides no means for determining the identity of the called party in a traditional telephone calling scenario. This document updates prior guidance on the "connected identity" problem to reflect the changes to SIP Identity that accompanied STIR, and considers a revised problem space for connected identity as a means of detecting calls that have been retargeted to a party impersonating the intended destination, as well as the spoofing of mid-dialog or dialog-terminating events by intermediaries or third parties.},
}
```


Discussion:

Resolving patch:
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -1112,6 +1112,11 @@ def document_bibtex(request, name, rev=None):
     else:
         doi = None
 
+    if doc.is_dochistory():
+        latest_event = doc.latest_event(type='new_revision', rev=rev)
+        if latest_event:
+            doc.pub_date = latest_event.time
+
     return render(request, "doc/document_bibtex.bib",
                               dict(doc=doc,
                                    replaced_by=replaced_by,


Test patch: