piprints 4.2.2__tar.gz → 4.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- piprints-4.2.2/README.md → piprints-4.2.3/PKG-INFO +66 -0
- piprints-4.2.2/PKG-INFO → piprints-4.2.3/README.md +41 -24
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/api_views.py +2 -1
- piprints-4.2.3/piprints/main/conftest.py +19 -0
- piprints-4.2.3/piprints/main/management/commands/test.py +15 -0
- piprints-4.2.3/piprints/main/test_api.py +54 -0
- piprints-4.2.3/piprints/main/test_csrf.py +179 -0
- piprints-4.2.3/piprints/main/test_main.py +76 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/test_visibility_access.py +14 -11
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/views.py +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/settings.py +9 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/piprints-custom.css +26 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/maintainance.html +4 -4
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/adm.html +1 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/base.html +7 -9
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/calendar_popup.html +2 -4
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/edit_form.html +2 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/email_base.html +2 -2
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event_participants.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event_registration.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/human.html +1 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/login.html +2 -0
- piprints-4.2.3/piprints/templates/logout_form.html +4 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/main.html +2 -2
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/paper.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/passwd.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/person.html +1 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/person_arxiv.html +2 -2
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/person_request.html +3 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/remove_form.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/request.html +1 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/send_form.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/upload_curriculum.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/upload_form.html +12 -3
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-cvgmt/email_base.html +2 -2
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-cvgmt/request.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/base.html +5 -5
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/edit_form.html +2 -1
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/email_base.html +2 -2
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/request.html +1 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/urls.py +5 -0
- piprints-4.2.3/pyproject.toml +36 -0
- piprints-4.2.2/piprints/main/management/commands/test.py +0 -13
- piprints-4.2.2/piprints/main/test_main.py +0 -36
- piprints-4.2.2/pyproject.toml +0 -26
- {piprints-4.2.2 → piprints-4.2.3}/piprints/Makefile +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/backup.sh +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/clear_database.sh +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/design/alert.xcf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/design/error.xcf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/design/info.xcf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/design/ok.xcf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/import_set_passwords.sh +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/import_sync_timestamps.sh +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/initial_import_messages.txt +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/admin.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/api_serializers.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/auth.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/data_import.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/excel.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/feeds.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/forms.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/google.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/human.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/geocode_event_places.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/google.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/install.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/merge_duplicates.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/send_bulletin.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/management/commands/wait_for_db.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0001_initial.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0002_auto_20160108_0818.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0003_auto_20160121_1738.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0004_researchproject_order.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0005_auto_20160123_1228.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0006_auto_20160124_1212.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0007_populate_site_parameters.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0008_auto_20160124_1803.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0009_auto_20160124_2031.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0010_siteparameters_welcome_message.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0011_siteparameters_credits.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0012_auto_20170428_1732.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0013_auto_20170428_2243.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0014_auto_20170428_2246.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0015_seminar_google_id.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0016_paper_arxiv_id.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0017_auto_20170503_0016.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0018_auto_20170520_1002.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0019_person_orcid_id.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0020_auto_20170530_1020.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0021_auto_20180803_0845.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0022_auto_20180803_0906.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0023_auto_20200519_1030.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0024_auto_20210206_1907.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0025_auto_20210906_1041.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0026_siteparameters_header_injection.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0027_siteparameters_footer_injection.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0028_siteparameters_authorbycontributioncount.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0029_alter_document_created_by_alter_document_id_and_more.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0030_alter_event_slug.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0031_event_place_coordinates.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0032_researchproject_order_charfield.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0033_researchproject_remove_hide.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0034_paper_ai_statement.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0035_base_visibility.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/0036_enable_visibility_access.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/migrations/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/models.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/template.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/templatetags/__init__.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/templatetags/piprints.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/test_ai_statement.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/test_auth_session.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/test_human.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/test_visibility.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/main/visibility.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/makeicons.sh +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/manage.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/media/piprints.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/send_notifications.py +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/MathJax.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/cookiechoices.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/edit_form.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/extensions/MathMenu.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/extensions/MathZoom.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/js/fullcalendar-init.js +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/piprints.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/_variables.scss +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/bootstrap.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/bootstrap.min.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/debug.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/default-logo.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/default-logo.svg +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/fm.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static/style/jquery-ui.min.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/gecogedi-alessandra-trasparente.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/gecogedi-alessandra.jpg +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/gecogedi.css +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/gecogedi.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/gecogedi.svg +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/geometriaglobale.png +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/geometriaglobale.svg +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/scritta-gecogedi.pdf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/scritta-gecogedi.svg +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/static-gecogedi/style/scritta-gecogedi.tex +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/404.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/500.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/apache.conf +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/bibtex.bib +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/bulletin.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/citeulike.txt +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/cookies.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/credits.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event_participants.xml +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event_speakers.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/event_timetable.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/events.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/events_map.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/keyword.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/logs.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail/bulletin.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail/change_password.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail/note_to_staff.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail/participant_notification.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail/password_new_user.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/mail.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/news.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/newss.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/papers.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/papers_erc.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/person_requests.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/persons.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/position.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/positions.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/seminar.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/seminars.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/tag.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/users.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates/version.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-cvgmt/mail.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-cvgmt/research.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/bulletin.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/credits.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/mail/bulletin.mail +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/mail.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/main.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/persons.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/templates-gecogedi/research.html +0 -0
- {piprints-4.2.2 → piprints-4.2.3}/piprints/wsgi.py +0 -0
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: piprints
|
|
3
|
+
Version: 4.2.3
|
|
4
|
+
Summary: preprint server
|
|
5
|
+
Author: Emanuele Paolini
|
|
6
|
+
Author-email: emanuele.paolini@gmail.com
|
|
7
|
+
Requires-Python: >=3.11,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
|
+
Requires-Dist: argon2-cffi (>=25.1.0,<26.0.0)
|
|
15
|
+
Requires-Dist: django (>=5.2.19,<5.3)
|
|
16
|
+
Requires-Dist: django-filter (>=26.2,<27.0)
|
|
17
|
+
Requires-Dist: djangorestframework (>=3.18.3,<4.0.0)
|
|
18
|
+
Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
|
|
19
|
+
Requires-Dist: pillow (>=13.0.0,<14.0.0)
|
|
20
|
+
Requires-Dist: python-dateutil (>=4.0.0,<5.0.0)
|
|
21
|
+
Requires-Dist: python-dotenv (>=1.2.4,<2.0.0)
|
|
22
|
+
Requires-Dist: requests (>=2.34.2,<3.0.0)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
1
25
|
# INSTALL
|
|
2
26
|
|
|
27
|
+
Requires Python 3.11 or newer (below 4.0). The application uses Django 5.2 LTS.
|
|
28
|
+
|
|
3
29
|
For this checkout, use Python 3.11 with the locked dependencies:
|
|
4
30
|
|
|
5
31
|
```bash
|
|
@@ -131,6 +157,45 @@ poetry self add poetry-plugin-export
|
|
|
131
157
|
poetry export --without-hashes --format requirements.txt --output requirements.txt
|
|
132
158
|
```
|
|
133
159
|
|
|
160
|
+
For the development Docker image, include the optional MariaDB driver group:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
poetry export --only main,docker --without-hashes --format requirements.txt --output docker/requirements.txt
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
# DEVELOPMENT AND TESTS
|
|
167
|
+
|
|
168
|
+
From this repository, install the locked dependencies and run the checks:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
poetry install --with dev
|
|
172
|
+
poetry run manage check
|
|
173
|
+
DATABASE_NAME=/tmp/piprints-check.sqlite3 poetry run python -m pytest -q
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Tests create their own database and use an in-memory email backend. The existing
|
|
177
|
+
naive datetime behavior is preserved explicitly with `USE_TZ=False` after the
|
|
178
|
+
Django upgrade. See [AGENTS.md](AGENTS.md) for the project map and maintenance
|
|
179
|
+
commands, and [SECURITY_REVIEW.md](SECURITY_REVIEW.md) for known security issues.
|
|
180
|
+
|
|
181
|
+
# LOCAL DOCKER EXAMPLE
|
|
182
|
+
|
|
183
|
+
Build from the repository root with
|
|
184
|
+
`docker build -f docker/Dockerfile -t piprints .`, or use Compose:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
export DATABASE_PASSWORD='choose-a-local-database-password'
|
|
188
|
+
docker compose -f docker/docker-compose.yml up --build -d web
|
|
189
|
+
docker compose -f docker/docker-compose.yml run --rm createsuperuser
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The example uses Python 3.14, MariaDB 11.4 and the source in this checkout.
|
|
193
|
+
It binds port 8000 to localhost and runs Django's development server. Configure
|
|
194
|
+
SiteParameters through `/admin/` as described above. Use a production WSGI server
|
|
195
|
+
and review the deployment settings before exposing a public service. Existing
|
|
196
|
+
database volumes need a separate compatibility review before changing MariaDB
|
|
197
|
+
versions.
|
|
198
|
+
|
|
134
199
|
# BACKUP
|
|
135
200
|
|
|
136
201
|
Per fare un dump del database il comando che sembra funzionare e' questo:
|
|
@@ -146,3 +211,4 @@ dall'altro lato:
|
|
|
146
211
|
|
|
147
212
|
|
|
148
213
|
|
|
214
|
+
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: piprints
|
|
3
|
-
Version: 4.2.2
|
|
4
|
-
Summary: preprint server
|
|
5
|
-
Author: Emanuele Paolini
|
|
6
|
-
Author-email: emanuele.paolini@gmail.com
|
|
7
|
-
Requires-Python: >=3.9.2
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Requires-Dist: argon2-cffi (>=23.1.0,<24.0.0)
|
|
14
|
-
Requires-Dist: django (>=4.2.19)
|
|
15
|
-
Requires-Dist: django-filter (>=25.1,<26.0)
|
|
16
|
-
Requires-Dist: djangorestframework (>=3.15.2,<4.0.0)
|
|
17
|
-
Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
|
|
18
|
-
Requires-Dist: pillow (>=11.1.0,<12.0.0)
|
|
19
|
-
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
20
|
-
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
21
|
-
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
|
|
24
1
|
# INSTALL
|
|
25
2
|
|
|
3
|
+
Requires Python 3.11 or newer (below 4.0). The application uses Django 5.2 LTS.
|
|
4
|
+
|
|
26
5
|
For this checkout, use Python 3.11 with the locked dependencies:
|
|
27
6
|
|
|
28
7
|
```bash
|
|
@@ -154,6 +133,45 @@ poetry self add poetry-plugin-export
|
|
|
154
133
|
poetry export --without-hashes --format requirements.txt --output requirements.txt
|
|
155
134
|
```
|
|
156
135
|
|
|
136
|
+
For the development Docker image, include the optional MariaDB driver group:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
poetry export --only main,docker --without-hashes --format requirements.txt --output docker/requirements.txt
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
# DEVELOPMENT AND TESTS
|
|
143
|
+
|
|
144
|
+
From this repository, install the locked dependencies and run the checks:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
poetry install --with dev
|
|
148
|
+
poetry run manage check
|
|
149
|
+
DATABASE_NAME=/tmp/piprints-check.sqlite3 poetry run python -m pytest -q
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Tests create their own database and use an in-memory email backend. The existing
|
|
153
|
+
naive datetime behavior is preserved explicitly with `USE_TZ=False` after the
|
|
154
|
+
Django upgrade. See [AGENTS.md](AGENTS.md) for the project map and maintenance
|
|
155
|
+
commands, and [SECURITY_REVIEW.md](SECURITY_REVIEW.md) for known security issues.
|
|
156
|
+
|
|
157
|
+
# LOCAL DOCKER EXAMPLE
|
|
158
|
+
|
|
159
|
+
Build from the repository root with
|
|
160
|
+
`docker build -f docker/Dockerfile -t piprints .`, or use Compose:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
export DATABASE_PASSWORD='choose-a-local-database-password'
|
|
164
|
+
docker compose -f docker/docker-compose.yml up --build -d web
|
|
165
|
+
docker compose -f docker/docker-compose.yml run --rm createsuperuser
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The example uses Python 3.14, MariaDB 11.4 and the source in this checkout.
|
|
169
|
+
It binds port 8000 to localhost and runs Django's development server. Configure
|
|
170
|
+
SiteParameters through `/admin/` as described above. Use a production WSGI server
|
|
171
|
+
and review the deployment settings before exposing a public service. Existing
|
|
172
|
+
database volumes need a separate compatibility review before changing MariaDB
|
|
173
|
+
versions.
|
|
174
|
+
|
|
157
175
|
# BACKUP
|
|
158
176
|
|
|
159
177
|
Per fare un dump del database il comando che sembra funzionare e' questo:
|
|
@@ -169,4 +187,3 @@ dall'altro lato:
|
|
|
169
187
|
|
|
170
188
|
|
|
171
189
|
|
|
172
|
-
|
|
@@ -11,10 +11,11 @@ from django.utils.dateparse import parse_date
|
|
|
11
11
|
from piprints.main.models import Event, Seminar
|
|
12
12
|
import datetime
|
|
13
13
|
|
|
14
|
-
class PaperViewSet(viewsets.
|
|
14
|
+
class PaperViewSet(viewsets.ReadOnlyModelViewSet):
|
|
15
15
|
"""
|
|
16
16
|
API endpoint that allows access to paper data.
|
|
17
17
|
"""
|
|
18
|
+
http_method_names = ['get']
|
|
18
19
|
queryset = Paper.objects.all().order_by('-year')
|
|
19
20
|
serializer_class = PaperSerializer
|
|
20
21
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from django.contrib.sites.models import Site
|
|
3
|
+
|
|
4
|
+
from .models import SiteParameters
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@pytest.fixture
|
|
8
|
+
def site_parameters(db, settings):
|
|
9
|
+
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
|
10
|
+
settings.FAKE_EMAILS = True
|
|
11
|
+
site, _ = Site.objects.update_or_create(
|
|
12
|
+
pk=settings.SITE_ID,
|
|
13
|
+
defaults={"domain": "testserver", "name": "Test site"},
|
|
14
|
+
)
|
|
15
|
+
SiteParameters.objects.create(site=site, domain=site.domain, name=site.name)
|
|
16
|
+
Site.objects.clear_cache()
|
|
17
|
+
yield
|
|
18
|
+
Site.objects.clear_cache()
|
|
19
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from django.core.management.base import BaseCommand, CommandError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Command(BaseCommand):
|
|
9
|
+
help = "Run the pytest suite (install the dev dependency group first)."
|
|
10
|
+
|
|
11
|
+
def handle(self, *args, **options):
|
|
12
|
+
root = Path(__file__).resolve().parents[4]
|
|
13
|
+
result = subprocess.run([sys.executable, "-m", "pytest"], cwd=root)
|
|
14
|
+
if result.returncode:
|
|
15
|
+
raise CommandError("pytest failed", returncode=result.returncode)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from rest_framework.test import APIClient
|
|
3
|
+
|
|
4
|
+
from .models import Paper, User
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
pytestmark = pytest.mark.django_db
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
def paper():
|
|
12
|
+
return Paper.objects.create(code="api-test", title="Original title", year=2026)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.fixture(params=["anonymous", "user", "superuser"])
|
|
16
|
+
def api_client(request):
|
|
17
|
+
client = APIClient()
|
|
18
|
+
if request.param != "anonymous":
|
|
19
|
+
user = User.objects.create(
|
|
20
|
+
username="api-reader",
|
|
21
|
+
is_staff=request.param == "superuser",
|
|
22
|
+
is_superuser=request.param == "superuser",
|
|
23
|
+
)
|
|
24
|
+
client.force_authenticate(user=user)
|
|
25
|
+
return client
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.mark.parametrize("endpoint", ["/api/", "/api/papers/", "/api/papers/{pk}/"])
|
|
29
|
+
def test_api_get_remains_available(api_client, paper, endpoint):
|
|
30
|
+
response = api_client.get(endpoint.format(pk=paper.pk))
|
|
31
|
+
assert response.status_code == 200
|
|
32
|
+
if "{pk}" in endpoint:
|
|
33
|
+
assert response.json()["title"] == paper.title
|
|
34
|
+
elif endpoint == "/api/papers/":
|
|
35
|
+
assert response.json()["results"][0]["id"] == paper.pk
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.mark.parametrize("endpoint", [
|
|
39
|
+
"/api/", "/api/papers/", "/api/papers/{pk}/", "/api/calendar-events/",
|
|
40
|
+
])
|
|
41
|
+
def test_api_rejects_non_get_methods(api_client, paper, endpoint):
|
|
42
|
+
url = endpoint.format(pk=paper.pk)
|
|
43
|
+
for method in ["POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "TRACE"]:
|
|
44
|
+
response = api_client.generic(
|
|
45
|
+
method, url, '{"title":"Changed title","year":2026}',
|
|
46
|
+
content_type="application/json",
|
|
47
|
+
)
|
|
48
|
+
# DRF may reject anonymous requests at the permission check first.
|
|
49
|
+
assert response.status_code in (403, 405), (method, url, response.status_code)
|
|
50
|
+
if response.status_code == 405:
|
|
51
|
+
assert response["Allow"] == "GET"
|
|
52
|
+
paper.refresh_from_db()
|
|
53
|
+
assert paper.title == "Original title"
|
|
54
|
+
assert Paper.objects.count() == 1
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
2
|
+
from datetime import date, timedelta
|
|
3
|
+
from html.parser import HTMLParser
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
8
|
+
from django.test import Client
|
|
9
|
+
|
|
10
|
+
from .models import Document, Event, EventParticipant, Paper, PaperAuthor, Person, PersonRequest, User
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
pytestmark = pytest.mark.usefixtures("site_parameters")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class FormParser(HTMLParser):
|
|
17
|
+
def __init__(self, html):
|
|
18
|
+
super().__init__()
|
|
19
|
+
self.forms = []
|
|
20
|
+
self.current = None
|
|
21
|
+
self.feed(html)
|
|
22
|
+
|
|
23
|
+
def handle_starttag(self, tag, attrs):
|
|
24
|
+
attrs = dict(attrs)
|
|
25
|
+
if tag == "form":
|
|
26
|
+
self.current = {"method": attrs.get("method", "get").lower(), "tokens": []}
|
|
27
|
+
self.forms.append(self.current)
|
|
28
|
+
elif tag == "input" and self.current is not None:
|
|
29
|
+
if attrs.get("name") == "csrfmiddlewaretoken":
|
|
30
|
+
self.current["tokens"].append(attrs.get("value", ""))
|
|
31
|
+
|
|
32
|
+
def handle_endtag(self, tag):
|
|
33
|
+
if tag == "form":
|
|
34
|
+
self.current = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def form_token(response):
|
|
38
|
+
assert response.status_code == 200
|
|
39
|
+
forms = [form for form in FormParser(response.text).forms if form["method"] == "post"]
|
|
40
|
+
assert forms, "Expected at least one POST form"
|
|
41
|
+
for form in forms:
|
|
42
|
+
assert len(form["tokens"]) == 1
|
|
43
|
+
assert len(form["tokens"][0]) == 64
|
|
44
|
+
return forms[0]["tokens"][0]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@pytest.fixture
|
|
48
|
+
def csrf_client():
|
|
49
|
+
return Client(enforce_csrf_checks=True)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@pytest.mark.parametrize("token_kind", ["missing", "incorrect"])
|
|
53
|
+
def test_account_request_requires_valid_token(csrf_client, token_kind):
|
|
54
|
+
form_token(csrf_client.get("/request/", secure=True))
|
|
55
|
+
data = {"lastname": "Rossi", "firstname": "Mario", "email": "mario@example.org", "human": "yes"}
|
|
56
|
+
if token_kind == "incorrect":
|
|
57
|
+
data["csrfmiddlewaretoken"] = "a" * 64
|
|
58
|
+
response = csrf_client.post("/request/", data, secure=True, HTTP_ORIGIN="https://testserver")
|
|
59
|
+
assert response.status_code == 403
|
|
60
|
+
assert not PersonRequest.objects.exists()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@pytest.mark.parametrize("origin, expected", [
|
|
64
|
+
("https://testserver", 200), ("https://untrusted.invalid", 403),
|
|
65
|
+
])
|
|
66
|
+
def test_account_request_checks_origin(csrf_client, origin, expected):
|
|
67
|
+
token = form_token(csrf_client.get("/request/", secure=True))
|
|
68
|
+
response = csrf_client.post("/request/", {
|
|
69
|
+
"lastname": "Rossi", "firstname": "Mario", "email": "mario@example.org",
|
|
70
|
+
"human": "yes", "csrfmiddlewaretoken": token,
|
|
71
|
+
}, secure=True, HTTP_ORIGIN=origin)
|
|
72
|
+
assert response.status_code == expected
|
|
73
|
+
assert PersonRequest.objects.count() == (1 if expected == 200 else 0)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_login_and_logout_require_csrf(csrf_client):
|
|
77
|
+
user = User.objects.create_user("csrf-user", "original-password")
|
|
78
|
+
token = form_token(csrf_client.get("/login/", secure=True))
|
|
79
|
+
credentials = {"username": user.username, "password": "original-password"}
|
|
80
|
+
assert csrf_client.post("/login/", credentials, secure=True).status_code == 403
|
|
81
|
+
assert "_auth_user_id" not in csrf_client.session
|
|
82
|
+
|
|
83
|
+
response = csrf_client.post("/login/", {
|
|
84
|
+
**credentials, "csrfmiddlewaretoken": token,
|
|
85
|
+
}, secure=True, HTTP_ORIGIN="https://testserver")
|
|
86
|
+
assert response.status_code == 302
|
|
87
|
+
assert csrf_client.session["_auth_user_id"] == str(user.pk)
|
|
88
|
+
|
|
89
|
+
assert csrf_client.get("/logout/", secure=True).status_code == 405
|
|
90
|
+
assert csrf_client.post("/logout/", secure=True).status_code == 403
|
|
91
|
+
assert csrf_client.session["_auth_user_id"] == str(user.pk)
|
|
92
|
+
# Django rotates the token on login: obtain the current one from the menu.
|
|
93
|
+
token = form_token(csrf_client.get("/", secure=True))
|
|
94
|
+
response = csrf_client.post("/logout/", {"csrfmiddlewaretoken": token},
|
|
95
|
+
secure=True, HTTP_ORIGIN="https://testserver")
|
|
96
|
+
assert response.status_code == 302
|
|
97
|
+
assert "_auth_user_id" not in csrf_client.session
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_password_change_requires_csrf(csrf_client):
|
|
101
|
+
user = User.objects.create_user("csrf-user", "original-password")
|
|
102
|
+
csrf_client.force_login(user)
|
|
103
|
+
url = f"/passwd/{user.pk}/"
|
|
104
|
+
token = form_token(csrf_client.get(url, secure=True))
|
|
105
|
+
data = {"old_password": "original-password", "new_password": "new-password",
|
|
106
|
+
"new_password_again": "new-password"}
|
|
107
|
+
assert csrf_client.post(url, data, secure=True).status_code == 403
|
|
108
|
+
user.refresh_from_db()
|
|
109
|
+
assert user.check_password("original-password")
|
|
110
|
+
response = csrf_client.post(url, {**data, "csrfmiddlewaretoken": token},
|
|
111
|
+
secure=True, HTTP_ORIGIN="https://testserver")
|
|
112
|
+
assert response.status_code == 302
|
|
113
|
+
user.refresh_from_db()
|
|
114
|
+
assert user.check_password("new-password")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def test_multipart_upload_requires_csrf(csrf_client, settings, tmp_path):
|
|
118
|
+
settings.MEDIA_ROOT = str(tmp_path)
|
|
119
|
+
user = User.objects.create_user("csrf-staff", "password", is_staff=True)
|
|
120
|
+
event = Event.objects.create(title="Test event", date_from=date.today(), date_to=date.today())
|
|
121
|
+
participant = EventParticipant.objects.create(
|
|
122
|
+
event=event, firstname="Mario", lastname="Rossi", email="mario@example.org",
|
|
123
|
+
date_from=event.date_from, date_to=event.date_to,
|
|
124
|
+
)
|
|
125
|
+
csrf_client.force_login(user)
|
|
126
|
+
token = form_token(csrf_client.get("/upload_curriculum", secure=True))
|
|
127
|
+
|
|
128
|
+
def upload_data():
|
|
129
|
+
return {"email": participant.email,
|
|
130
|
+
"file": SimpleUploadedFile("curriculum.pdf", b"%PDF-1.4\n%%EOF", "application/pdf")}
|
|
131
|
+
|
|
132
|
+
assert csrf_client.post("/upload_curriculum", upload_data(), secure=True).status_code == 403
|
|
133
|
+
assert not Document.objects.exists()
|
|
134
|
+
assert not list(tmp_path.rglob("*.pdf"))
|
|
135
|
+
response = csrf_client.post(
|
|
136
|
+
"/upload_curriculum", {**upload_data(), "csrfmiddlewaretoken": token},
|
|
137
|
+
secure=True, HTTP_ORIGIN="https://testserver",
|
|
138
|
+
)
|
|
139
|
+
assert response.status_code == 200
|
|
140
|
+
document = participant.documents.get()
|
|
141
|
+
assert Path(document.file.path).is_relative_to(tmp_path)
|
|
142
|
+
assert Path(document.file.path).read_bytes() == b"%PDF-1.4\n%%EOF"
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@pytest.mark.parametrize("variant", ["templates", "templates-cvgmt", "templates-gecogedi"])
|
|
146
|
+
def test_rendered_forms_include_tokens(csrf_client, settings, monkeypatch, variant):
|
|
147
|
+
root = Path(__file__).resolve().parents[1]
|
|
148
|
+
templates = deepcopy(settings.TEMPLATES)
|
|
149
|
+
templates[0]["DIRS"] = list(dict.fromkeys([str(root / variant), str(root / "templates")]))
|
|
150
|
+
settings.TEMPLATES = templates
|
|
151
|
+
monkeypatch.setattr("piprints.main.data_import.get_arxiv_author_id_abstracts", lambda _: [])
|
|
152
|
+
user = User.objects.create_user("csrf-staff", "password", is_staff=True)
|
|
153
|
+
person = Person.objects.create(user=user, firstname="Staff", lastname="User",
|
|
154
|
+
email="staff@example.org", arxiv_id="test")
|
|
155
|
+
paper = Paper.objects.create(code="csrf-paper", title="Test paper", year=2026,
|
|
156
|
+
arxiv_id="2601.00001", created_by=user)
|
|
157
|
+
PaperAuthor.objects.create(paper=paper, person=person, order=1)
|
|
158
|
+
event = Event.objects.create(title="Test event", date_from=date.today() + timedelta(days=7),
|
|
159
|
+
date_to=date.today() + timedelta(days=8),
|
|
160
|
+
registration_page_enabled=True, created_by=user)
|
|
161
|
+
account_request = PersonRequest.objects.create(firstname="Mario", lastname="Rossi", email="mario@example.org")
|
|
162
|
+
# Check both login forms before authenticating.
|
|
163
|
+
form_token(csrf_client.get("/login/", secure=True))
|
|
164
|
+
form_token(csrf_client.get("/human/", secure=True))
|
|
165
|
+
csrf_client.force_login(user)
|
|
166
|
+
for url in [
|
|
167
|
+
"/request/", "/add/paper/", "/add/event/", f"/edit/paper/{paper.pk}/",
|
|
168
|
+
f"/paper/{paper.pk}/", f"/upload/paper/{paper.pk}/", f"/remove/paper/{paper.pk}/",
|
|
169
|
+
f"/passwd/{user.pk}/", "/upload_curriculum", f"/person_request/{account_request.pk}/",
|
|
170
|
+
f"/send/paper/{paper.pk}/", f"/event/{event.pk}/", f"/event/{event.pk}/registration",
|
|
171
|
+
f"/event/{event.pk}/participants", f"/person/{person.pk}/", f"/person/{person.pk}/arxiv",
|
|
172
|
+
]:
|
|
173
|
+
response = csrf_client.get(url, secure=True)
|
|
174
|
+
assert response.status_code == 200, url
|
|
175
|
+
token = form_token(response)
|
|
176
|
+
assert token
|
|
177
|
+
account_request.managed = True
|
|
178
|
+
account_request.save()
|
|
179
|
+
form_token(csrf_client.get(f"/person_request/{account_request.pk}/", secure=True))
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from django.core.management import call_command
|
|
5
|
+
|
|
6
|
+
from piprints.main.models import News, PersonRequest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
pytestmark = pytest.mark.usefixtures("site_parameters")
|
|
10
|
+
|
|
11
|
+
def test_messages(client):
|
|
12
|
+
response = client.get("/test_messages")
|
|
13
|
+
assert response.status_code == 200
|
|
14
|
+
for word in ["success", "information", "warning", "error"]:
|
|
15
|
+
assert word in response.text
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_robots(client):
|
|
19
|
+
response = client.get("/robots.txt")
|
|
20
|
+
assert response.status_code == 200
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_account_request(client):
|
|
24
|
+
assert PersonRequest.objects.count() == 0
|
|
25
|
+
assert client.get("/request/").status_code == 200
|
|
26
|
+
response = client.post("/request/", {
|
|
27
|
+
"lastname": "Rossi",
|
|
28
|
+
"firstname": "Mario",
|
|
29
|
+
"email": "mario@example.org",
|
|
30
|
+
"human": "yes",
|
|
31
|
+
})
|
|
32
|
+
assert response.status_code == 200
|
|
33
|
+
assert PersonRequest.objects.filter(email="mario@example.org").count() == 1
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_bulletin(capsys, mailoutbox):
|
|
37
|
+
call_command("send_bulletin", "email@example.org", dummy=True)
|
|
38
|
+
assert "message not really sent" in capsys.readouterr().out
|
|
39
|
+
assert not mailoutbox
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@pytest.mark.parametrize("path", [
|
|
43
|
+
"/", "/login/", "/papers/", "/persons/", "/events/", "/seminars/",
|
|
44
|
+
"/positions/", "/newss/", "/newss/?year=2022", "/bulletin/", "/api/papers/",
|
|
45
|
+
"/api/calendar-events/?start=2026-11-01&end=2026-12-01",
|
|
46
|
+
])
|
|
47
|
+
def test_public_pages(client, path):
|
|
48
|
+
assert client.get(path).status_code == 200
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_news_archive_preserves_naive_datetimes(client, settings):
|
|
52
|
+
# Django 5 defaults to USE_TZ=True. The existing application stores naive
|
|
53
|
+
# timestamps; keep the year archive usable without MySQL timezone tables.
|
|
54
|
+
assert settings.USE_TZ is False
|
|
55
|
+
for year, timestamp in [
|
|
56
|
+
(2022, datetime(2022, 12, 31, 23, 30)),
|
|
57
|
+
(2023, datetime(2023, 1, 1, 0, 30)),
|
|
58
|
+
]:
|
|
59
|
+
news = News.objects.create(title=f"Archive entry {year}")
|
|
60
|
+
News.objects.filter(pk=news.pk).update(creation_time=timestamp)
|
|
61
|
+
|
|
62
|
+
years = list(News.objects.datetimes("creation_time", "year"))
|
|
63
|
+
assert [(value.year, value.tzinfo) for value in years] == [(2022, None), (2023, None)]
|
|
64
|
+
response = client.get("/newss/?year=2022")
|
|
65
|
+
assert response.status_code == 200
|
|
66
|
+
assert "Archive entry 2022" in response.text
|
|
67
|
+
assert "Archive entry 2023" not in response.text
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_password_hasher():
|
|
71
|
+
from django.contrib.auth.hashers import check_password, make_password
|
|
72
|
+
|
|
73
|
+
encoded = make_password("test-password-for-argon2")
|
|
74
|
+
assert encoded.startswith("argon2$")
|
|
75
|
+
assert check_password("test-password-for-argon2", encoded)
|
|
76
|
+
assert not check_password("wrong", encoded)
|
|
@@ -76,7 +76,11 @@ class VisibilityAccessTests(TestCase):
|
|
|
76
76
|
self.assertIn('no-store', response['Cache-Control'])
|
|
77
77
|
if level != 'public':
|
|
78
78
|
self.assertIn('noindex', response['X-Robots-Tag'])
|
|
79
|
-
response.
|
|
79
|
+
if response.streaming:
|
|
80
|
+
# The client already closes normal responses. Exhaust
|
|
81
|
+
# streaming content so its wrapper safely closes files
|
|
82
|
+
# without closing the TestCase database transaction.
|
|
83
|
+
b''.join(response.streaming_content)
|
|
80
84
|
self.set_level(obj, 'public')
|
|
81
85
|
|
|
82
86
|
def test_human_challenge_redirect_csrf_and_cookie(self):
|
|
@@ -181,16 +185,15 @@ class VisibilityAccessTests(TestCase):
|
|
|
181
185
|
url = '/api/papers/{}/'.format(self.paper.pk)
|
|
182
186
|
for level in ('public', 'unlisted', 'human', 'user', 'author'):
|
|
183
187
|
self.set_level(self.paper, level)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
self.assertEqual(response['X-Robots-Tag'], 'noindex, nofollow')
|
|
188
|
+
with self.subTest(level=level):
|
|
189
|
+
response = self.author.get(url, HTTP_ACCEPT='application/json')
|
|
190
|
+
self.assertEqual(response.status_code, 200)
|
|
191
|
+
self.assertIn('no-store', response['Cache-Control'])
|
|
192
|
+
self.assertIn('Cookie', response['Vary'])
|
|
193
|
+
if level == 'public':
|
|
194
|
+
self.assertNotIn('X-Robots-Tag', response)
|
|
195
|
+
else:
|
|
196
|
+
self.assertEqual(response['X-Robots-Tag'], 'noindex, nofollow')
|
|
194
197
|
# Permission errors must retain the same visibility headers.
|
|
195
198
|
response = self.registered.get(url, HTTP_ACCEPT='application/json')
|
|
196
199
|
self.assertEqual(response.status_code, 404)
|
|
@@ -86,6 +86,7 @@ DATABASE_PASSWORD = getenv("DATABASE_PASSWORD", '')
|
|
|
86
86
|
DATABASE_HOST = getenv("DATABASE_HOST", '')
|
|
87
87
|
DATABASE_PORT = getenv("DATABASE_PORT", '')
|
|
88
88
|
DATABASE_ENGINE = getenv("DATABASE_ENGINE", 'sqlite3')
|
|
89
|
+
DATABASE_CHARSET = getenv("DATABASE_CHARSET", "")
|
|
89
90
|
|
|
90
91
|
# [preferences] section: these settings can be choosen at will
|
|
91
92
|
ADMINS = getenv("ADMINS", 'admin <admin@email.com>').split(',')
|
|
@@ -150,12 +151,16 @@ DATABASES = {
|
|
|
150
151
|
'PASSWORD': DATABASE_PASSWORD,
|
|
151
152
|
'HOST': DATABASE_HOST,
|
|
152
153
|
'PORT': DATABASE_PORT,
|
|
154
|
+
'OPTIONS': {},
|
|
153
155
|
'TEST': {
|
|
154
156
|
'NAME': DATABASE_NAME + '_test',
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
if DATABASE_CHARSET:
|
|
162
|
+
DATABASES['default']['OPTIONS']['charset'] = DATABASE_CHARSET
|
|
163
|
+
|
|
159
164
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
160
165
|
|
|
161
166
|
PASSWORD_HASHERS = [
|
|
@@ -178,6 +183,9 @@ USE_I18N = False
|
|
|
178
183
|
# calendars according to the current locale
|
|
179
184
|
USE_L10N = False
|
|
180
185
|
|
|
186
|
+
# Preserve the naive datetimes used by the models when upgrading to Django 5.
|
|
187
|
+
USE_TZ = False
|
|
188
|
+
|
|
181
189
|
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
|
182
190
|
# trailing slash.
|
|
183
191
|
# Examples: "http://foo.com/media/", "/media/".
|
|
@@ -194,7 +202,7 @@ MIDDLEWARE = (
|
|
|
194
202
|
'django.middleware.security.SecurityMiddleware',
|
|
195
203
|
'django.middleware.common.CommonMiddleware',
|
|
196
204
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
197
|
-
|
|
205
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
|
198
206
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
199
207
|
'django.contrib.messages.middleware.MessageMiddleware'
|
|
200
208
|
)
|
|
@@ -21,6 +21,32 @@ h1, h3 {
|
|
|
21
21
|
margin-left: 0.75em;
|
|
22
22
|
vertical-align: top;
|
|
23
23
|
}
|
|
24
|
+
.attachment-table-container {
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
}
|
|
28
|
+
.attachment-table {
|
|
29
|
+
width: 100%;
|
|
30
|
+
min-width: 40rem;
|
|
31
|
+
table-layout: fixed;
|
|
32
|
+
}
|
|
33
|
+
.attachment-file-column { width: 32%; }
|
|
34
|
+
.attachment-visibility-column { width: 20%; }
|
|
35
|
+
.attachment-description-column { width: 36%; }
|
|
36
|
+
.attachment-action-column { width: 12%; }
|
|
37
|
+
.attachment-table td {
|
|
38
|
+
padding-right: 0.4rem;
|
|
39
|
+
overflow-wrap: anywhere;
|
|
40
|
+
}
|
|
41
|
+
.attachment-table input,
|
|
42
|
+
.attachment-table select {
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
max-width: 100%;
|
|
45
|
+
}
|
|
46
|
+
.attachment-table input[name="description"] {
|
|
47
|
+
width: 100%;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
}
|
|
24
50
|
.ai-statement-dot {
|
|
25
51
|
display: inline-block;
|
|
26
52
|
width: 0.8em;
|