Commit graph

41 commits

Author SHA1 Message Date
Jennifer Richards 32054111df
fix: fix failing tests and eliminate naive datetime warnings (#4402)
* test: fix timestamp construction in several doc tests

* refactor: rename date2datetime to datetime_from_date and clarify code

* chore: helper to get tzinfo for PRODUCTION_TIMEZONE

* fix: fix timezone handling in make_last_call()

* test: fix datetime generation in doc.tests_charter

* refactor: remove PRODUCTION_TIMEZONE setting

Replaces the PRODUCTION_TIMEZONE setting with a constant,
DEADLINE_TZINFO, in ietf.utils.timezone.

* test: be more careful about timezone in tests_charter.py

* test: be more careful about timezone in doc/tests.py

* fix: fix timezone handling affecting doc.tests_draft

* fix: fix timezone handling affecting tests_irsg_ballot.py

* fix: fix timezone handling affecting tests_review.py

* fix: fix timezone handling affecting last ietf.doc tests

* fix: fix timezone handling affecting last ietf.group tests

* fix: fix timezone handling affecting ietf.iesg tests

* fix: handle timezones in get_8989_eligibility_querysets

* fix: handle timezones affecting ietfauth tests

* fix: return tz-aware datetime from utc_from_string

* fix: specify timezone for constants in ipr_rfc_number()

* fix: specify tz for ipr deadlines

* fix: handle timezones affecting liaisons tests

* fix: treat leap day in get_8989_eligibility_querysets()

Manual cherry-pick of 248d6474

* test: treat leap day properly in nomcom tests

* fix: fix timezone handling affecting nomcom tests

* test: fix timezone handling in review tests

* fix: fix timezone handling affecting secr.meetings tests

* fix: handle both pytz and zoneinfo timezones in ietf.utils.timezone

* fix: fix timezone handling affecting secr.proceedings tests

* refactor: use make_aware() helper in secr.meetings tests

* test: fix timezone handling in secr.telechat tests

* fix: fix timezone handling affecting stats tests

* fix: eliminate tz-naive helpers affecting sync email parsing

* fix: include timezone data when serializing DeletedEvent data

* fix: fix timezone handling affecting sync tests

* style: remove unused import
2022-09-01 13:07:28 -03:00
Jennifer Richards ebebdbed3e
refactor: replace datetime.now and datetime.today with timezone.now (#4211)
* refactor: replace datetime.now with timezone.now

* refactor: migrate model fields to use timezone.now as default

* refactor: replace datetime.today with timezone.now

datetime.datetime.today() is equivalent to datetime.datetime.now(); both
return a naive datetime with the current local time.

* refactor: rephrase datetime.now(tz) as timezone.now().astimezone(tz)

This is effectively the same, but is less likely to encourage accidental
use of naive datetimes.

* refactor: revert datetime.today() change to old migrations

* refactor: change a missed datetime.now to timezone.now

* chore: renumber timezone_now migration

* chore: renumber migrations
2022-08-25 13:45:16 -03:00
Robert Sparks 49cf639f16
fix: improve person selection when receiving IANA email (#3993) 2022-05-20 16:20:26 -05:00
Jennifer Richards 6f3fb6930f Add timeouts to requests library calls. Fixes #3498. Commit ready for merge.
- Legacy-Id: 19839
2022-01-13 15:06:28 +00:00
Robert Sparks 3697180cc1 Reverted merge of timezone-aware migration efforts.
- Legacy-Id: 18792
2021-01-12 16:54:20 +00:00
Henrik Levkowetz 774e752a54 Snapshot of timezone-aware datatracker code. Tests pass, and the test-crawler shows only expected differences. Trunk changes merged in up to r18768.
- Legacy-Id: 18770
2020-12-16 23:53:37 +00:00
Henrik Levkowetz 488ff08352 Merged in ^/personal/henrik/6.129.2-django2.0 which contains an upgrade of Django from 1.11 to 2.0, with the code changes needed.
- Legacy-Id: 17817
2020-05-18 06:50:50 +00:00
Henrik Levkowetz bc05e7a8d0 Refactored many instances of msg.get_payload(decode=True).decode('utf-8') and similar to get_payload_text(msg), which uses msg.get_charset() to get the actual charset to do the decoding, in a consistent manner. Also removed some instances of force_str, but more remain.
- Legacy-Id: 17807
2020-05-16 20:20:05 +00:00
Henrik Levkowetz 6d7c5b52ee Django 2.0 conversion. Test suite passes, except for javascript tests.
- Legacy-Id: 17762
2020-05-08 13:07:07 +00:00
Henrik Levkowetz f10ddadc0e Merged in changes from trunk up to r17584.
- Legacy-Id: 17593
2020-04-07 16:02:52 +00:00
Henrik Levkowetz 726fcbf27d Removed all __future__ imports.
- Legacy-Id: 17391
2020-03-05 23:53:42 +00:00
Henrik Levkowetz e9a37d8ac8 Removed six.text_type(), changed six.moves.urllib to plain urllib, and removed now unused six imports.
- Legacy-Id: 17385
2020-03-05 14:41:41 +00:00
Henrik Levkowetz a14e38a1a1 Replaced most cases of using of urlopen(), instead using the higher-level 'requests' module where it simplifies the code.
- Legacy-Id: 17380
2020-03-03 17:34:42 +00:00
Henrik Levkowetz ebdad3a5a5 Added charset decoding of data read from an urlopen() object in a few places, and removed some use-once functions that were now dead code.
- Legacy-Id: 17355
2020-02-27 13:39:45 +00:00
Henrik Levkowetz d2ad86c5df Python 2/3 changes pulled from the production server after the switch to python 3.
- Legacy-Id: 17327
2020-02-23 01:34:52 +00:00
Henrik Levkowetz 8c6eb3a30a Python2/3 compatibility: Changed the use of open() and StringIO to io.open() etc.
- Legacy-Id: 16458
2019-07-15 19:14:04 +00:00
Henrik Levkowetz d460721415 Changed regexes to use r strings. Rewrote code to extract From: name and email from iana email text. Fixed charset decode of iana email messages.
- Legacy-Id: 16373
2019-07-04 15:38:15 +00:00
Henrik Levkowetz d7f5c84182 Initial 2to3 patch with added copyright statement updates.
- Legacy-Id: 16309
2019-06-27 14:40:54 +00:00
Alireza Mohammadi d715d82c24 Better punctuation during state change by adding \" before and after old and new state. Fixes issue #1545.
- Legacy-Id: 13913
2017-07-15 16:16:16 +00:00
Henrik Levkowetz 4daf66d11c Added DocEvent rev= parameter througout the code.
- Legacy-Id: 12978
2017-03-06 15:08:21 +00:00
Ole Laursen 86c3a430d1 Merge in ^/branch/iola/event-saving-refactor-r10076, fixing a few problems
- Legacy-Id: 10298
2015-10-27 10:37:06 +00:00
Ole Laursen e1f0917659 Summary: Add new document saving API, Document.save_with_history(events).
The new API requires at least one event and will automatically save a
snapshot of the document and related state. Document.save() will now
throw an exception if called directly, as the new API is intended to
ensure that documents are saved with both an appropriate snapsnot and
relevant history log, both of which are easily defeated by just
calling .save() directly.

To simplify things, the snapshot is generated after the changes to a
document have been made (in anticipation of coming changes), instead
of before as was usual.

While revising the existing code to work with this API, a couple of
missing events was discovered:

- In draft expiry, a "Document has expired" event was only generated
  in case an IESG process had started on the document - now it's
  always generated, as the document changes its state in any case

- Synchronization updates like title and abstract amendmends from the
  RFC Editor were silently (except for RFC publication) applied and
  not accompanied by a descriptive event - they now are

- do_replace in the Secretariat tools now adds an event

- Proceedings post_process in the Secretariat tools now adds an event

- do_withdraw in the Secretariat tools now adds an event

A migration is needed for snapshotting all documents, takes a while to
run. It turns out that a single document had a bad foreign key so the
migration fixes that too.
 - Legacy-Id: 10101
2015-09-28 14:01:03 +00:00
Robert Sparks f30f5c39f1 checkpoint
- Legacy-Id: 10017
2015-08-13 21:16:21 +00:00
Robert Sparks 839d0f89ad checkpoint
- Legacy-Id: 10016
2015-08-13 19:41:02 +00:00
Robert Sparks dd939e8196 Make parsing IANA mail for comments more flexible. Commit ready for merge.
- Legacy-Id: 9641
2015-05-22 19:12:07 +00:00
Henrik Levkowetz 48e24c0a1e Merged in [9548] from rjsparks@nostrum.com:
Allow IANA to switch to (BEGIN IANA COMMENTS) at their leisure. Make sure the captured events are obviously from IANA.
 - Legacy-Id: 9568
Note: SVN reference [9548] has been migrated to Git commit 6ded3411c2
2015-04-26 21:11:05 +00:00
Henrik Levkowetz acc2c59920 Updated a bunch of links from http: to https: based on a patch from lars@netapp.com.
- Legacy-Id: 9556
2015-04-24 21:47:12 +00:00
Robert Sparks 6ded3411c2 Allow IANA to switch to (BEGIN IANA COMMENTS) at their leisure. Make sure the captured events are obviously from IANA. Commit ready for merge.
- Legacy-Id: 9548
2015-04-24 19:11:33 +00:00
Robert Sparks bf4f3ad75f Made several changes to better handle non-ascii UTF-8 in email messages.
Used multipart mime when including the original message in an error message to the secretariat.
Modified the way IANA review email is parsed.
Added non-ascii UTF-8 tests to the IANA review email parser and to the SMTP Exception handling code.

Commit ready for merge.
 - Legacy-Id: 7673
2014-04-29 18:45:37 +00:00
Henrik Levkowetz 8e9f835651 Made ietf/sync pyflakes-clean.
- Legacy-Id: 7498
2014-03-16 07:49:21 +00:00
Ole Laursen 87ca10d122 Remove usage of log_state_changed (and duplicate in
doc/utils_charter.py) in favour of add_state_change_event which has
slightly better API but otherwise does basically the same except it
sets an event type we can later search for. Also expand tests slightly
to exercise three more templates.
 - Legacy-Id: 7129
2014-01-15 17:52:00 +00:00
Ole Laursen 742dbace24 Move views and templatetags from idrfc/ to doc, the I-D specific views
go into views_draft.py and tests in tests_draft.py; what's left in
idrfc is wrapper code, templates and the ballot_icon templatetag
 - Legacy-Id: 6051
2013-08-14 10:32:25 +00:00
Ole Laursen ec2f0cabbf Delete dead code from idrfc, and delete some obsolete imports too
- Legacy-Id: 6001
2013-08-09 14:55:51 +00:00
Ole Laursen 0f69f87a56 Skip IANA - Review Needed and Version Changed - Review Needed changes
from IANA as it turns out that the Datatracker is the authoritative
source on these states. Also improve logging so that the raw JSON from
IANA is dumped, the parsed JSON on imported changes is dumped and we
write to syslog before starting a sync script in the notification view.
 - Legacy-Id: 5800
2013-06-21 16:48:05 +00:00
Henrik Levkowetz c72ab5daa3 Added alternative names for 2 iana states which seems to have changed name since the code was originally deployed. Also added a guard against sending state change emails when the iana state hasn't actually changed.
- Legacy-Id: 5718
2013-05-09 20:07:40 +00:00
Henrik Levkowetz f2c4ed9f24 Changed additional places to use IANA sync settings from settings.py
- Legacy-Id: 5681
2013-04-21 15:57:56 +00:00
Henrik Levkowetz 2f3476690f In order that document states (which may be used by old documents) should not need to be removed when state machines change and states go out of use, all document states have a 'used' field. The code which accesses the state fields have not been requiring that used=True for the states returned, which is an error. Fixed this by adding 'used=True' to all State.objects.get() and State.objects.filter() call where it's relevant.
- Legacy-Id: 5486
2013-03-05 23:24:41 +00:00
Ole Laursen f22b14a8a4 Fix really weird encoding issue with Python 2.6
- Legacy-Id: 5150
2012-12-21 11:46:42 +00:00
Ole Laursen d47878656f Fix a bug in the IANA changes logging, fix spelling mistake, remove
debug print
 - Legacy-Id: 4882
2012-09-24 11:53:30 +00:00
Ole Laursen 915908c203 Add HTTP auth to IANA sync, password is supposed to be saved in settings_local.py
- Legacy-Id: 4875
2012-09-21 09:15:35 +00:00
Ole Laursen 5282bd1d07 Add sync scripts for reading from IANA changes API, reading from the
protocols page (to see when references to newly published RFCs have
been updated) and parsing IANA review emails to be included as
comments
 - Legacy-Id: 4850
2012-09-17 15:54:22 +00:00