Jennifer Richards
8cf609bfa9
refactor: Implement require_api_key with functools.wraps
...
The @decorator mechanism does not seem to work with @method_decorator
in Django 4.0, have not tracked down why.
2023-05-17 09:45:07 -03:00
Lars Eggert
220be21998
chore: Use codespell to fix typos in code. ( #4797 )
...
* chore: Use codespell to fix typos in code.
Second part of replacement of #4651
@rjsparks, I probably need to revert some things here, and I also
still need to add that new migration - how do I do that?
* Revert migrations
* Migrate "Whitelisted" to "Allowlisted"
* TEST_COVERAGE_MASTER_FILE -> TEST_COVERAGE_MAIN_FILE
* Fix permissions
* Add suggestions from @jennifer-richards
2022-12-07 15:10:35 -06: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
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
57938b039d
Converted many cases of plain-text 403 messages to use a properly styled page instead, with a login link when appropriate. Also changed some API endpoint 400 responses to a more correct 403.
...
- Legacy-Id: 18339
2020-08-06 10:59:52 +00:00
Henrik Levkowetz
49bf6090d0
Updated the @require_api_key decorator to not check for recent login dates for staff (which would include robots)
...
- Legacy-Id: 17937
2020-06-08 19:24:42 +00:00
Henrik Levkowetz
bba2149b5e
Added exception handling in the require_api_key() decorator for AttributeError raised by the decorated function.
...
- Legacy-Id: 17629
2020-04-15 11:57:33 +00:00
Henrik Levkowetz
726fcbf27d
Removed all __future__ imports.
...
- Legacy-Id: 17391
2020-03-05 23:53:42 +00:00
Henrik Levkowetz
831fb18f8a
Python2/3 compatibility: Added force_str or force_bytes in some places, to ensure the argument right type
...
- Legacy-Id: 16450
2019-07-15 15:49:35 +00:00
Henrik Levkowetz
d7f5c84182
Initial 2to3 patch with added copyright statement updates.
...
- Legacy-Id: 16309
2019-06-27 14:40:54 +00:00
Henrik Levkowetz
675c652052
Additional changes to speed up the IESG agenda docs page: Changed telechat_page_count() to accept a list of documents if that's already been generated, to avoid double work. Changed the reviewed_by_teams list to provide acronyms directly, to avoid group lookups during template rendering. Provided page counts directly to the template instead of repeated (costly) filtering through telechat_page_count, with new document lookups. Removed the telechat_page_count template filter, due to its cost. Tweaked some lookups in fill_in_document_table_attributes() . Added to the select_related() list for documents in IESG agenda_documents().
...
- Legacy-Id: 14988
2018-04-01 18:51:48 +00:00
Henrik Levkowetz
a08c8dc76f
Added an API endpoint to support automation of IESG ballot position posting, at /api/iesg/position. Added tests for the API endpoint, and updated the apikey validation decorator tests. Tweaked the decorator to handle a weakness found during testing.
...
- Legacy-Id: 14429
2017-12-17 21:55:27 +00:00
Henrik Levkowetz
b0863c8963
Modified some names.
...
- Legacy-Id: 14428
2017-12-16 18:43:08 +00:00
Henrik Levkowetz
e7209c6e50
Added a new personal event table to keep track of personal API key logins, and a management command to send out reports about activity to users with API keys. Added a weekly cronjob script to trigger weekly reports, and a monthly script for future use. Added a @require_api_key decorator to validate API keys for API key views and log in the API key owner. Modified the API key management urls to use create and disable rather than add and delete. Updated the API key list view. Added an API placeholder view function for ballot position setting, for test purposes. Added tests for the decorator and management command.
...
- Legacy-Id: 14426
2017-12-16 18:37:52 +00:00
Henrik Levkowetz
152261a869
Added new infrastructure for personal API keys, to generate, view, and delete them.
...
- Legacy-Id: 14423
2017-12-14 14:30:59 +00:00
Henrik Levkowetz
a36cf95572
Refactored the code to skip coverage testing a bit, and added skipping of template and url coverage.
...
- Legacy-Id: 11472
2016-06-24 15:39:59 +00:00
Henrik Levkowetz
6fa181763b
Changed the code test coverage checking to never register coverage counts for tests that are sometimes skipped. Removed now unwanted skip settings from the releasetest settings.
...
- Legacy-Id: 11453
2016-06-21 20:39:28 +00:00