| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4a7c05b commit de04e0a
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,16 +12,16 @@ jobs: | |||
| 12 | 12 | runs-on: ubuntu-latest | |
| 13 | 13 | steps: | |
| 14 | 14 | - name: Checkout source code | |
| 15 | - uses: actions/checkout@v4 | ||
| 15 | + uses: actions/checkout@v6 | ||
| 16 | 16 | - name: Set up Python | |
| 17 | - uses: actions/setup-python@v5 | ||
| 17 | + uses: actions/setup-python@v6 | ||
| 18 | 18 | with: | |
| 19 | - python-version: "3.13" | ||
| 19 | + python-version: "3.14" | ||
| 20 | 20 | cache: 'pip' | |
| 21 | 21 | - name: Set up Go | |
| 22 | - uses: actions/setup-go@v5 | ||
| 22 | + uses: actions/setup-go@v6 | ||
| 23 | 23 | with: | |
| 24 | - go-version: "1.21" | ||
| 24 | + go-version: "1.26" | ||
| 25 | 25 | - name: Install dependencies | |
| 26 | 26 | run: python -m pip install tox | |
| 27 | 27 | - name: Run tox | |
@@ -33,7 +33,7 @@ jobs: | |||
| 33 | 33 | matrix: | |
| 34 | 34 | # NOTE: If you add a version here, don't forget to update the | |
| 35 | 35 | # '[gh-actions]' section in tox.ini | |
| 36 | - python: ["3.9", "3.10", "3.11", "3.12", "3.13"] | ||
| 36 | + python: ["3.11", "3.14"] | ||
| 37 | 37 | db: [postgres, mysql, sqlite3] | |
| 38 | 38 | env: | |
| 39 | 39 | DATABASE_TYPE: "${{ matrix.db }}" | |
@@ -44,7 +44,7 @@ jobs: | |||
| 44 | 44 | MYSQL_ROOT_PASSWORD: root-${{ github.run_id }} | |
| 45 | 45 | services: | |
| 46 | 46 | postgres: | |
| 47 | - image: postgres:latest | ||
| 47 | + image: postgres:17 | ||
| 48 | 48 | env: | |
| 49 | 49 | POSTGRES_DB: ${{ env.DATABASE_NAME }} | |
| 50 | 50 | POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
@@ -57,7 +57,7 @@ jobs: | |||
| 57 | 57 | --health-timeout 5s | |
| 58 | 58 | --health-retries 5 | |
| 59 | 59 | mysql: | |
| 60 | - image: mysql:latest | ||
| 60 | + image: mysql:8.4 | ||
| 61 | 61 | env: | |
| 62 | 62 | MYSQL_DATABASE: ${{ env.DATABASE_NAME }} | |
| 63 | 63 | MYSQL_USER: ${{ env.DATABASE_USER }} | |
@@ -72,9 +72,9 @@ jobs: | |||
| 72 | 72 | --health-retries 5 | |
| 73 | 73 | steps: | |
| 74 | 74 | - name: Checkout source code | |
| 75 | - uses: actions/checkout@v4 | ||
| 75 | + uses: actions/checkout@v6 | ||
| 76 | 76 | - name: Set up Python ${{ matrix.python }} | |
| 77 | - uses: actions/setup-python@v5 | ||
| 77 | + uses: actions/setup-python@v6 | ||
| 78 | 78 | with: | |
| 79 | 79 | python-version: ${{ matrix.python }} | |
| 80 | 80 | cache: 'pip' | |
@@ -104,20 +104,22 @@ jobs: | |||
| 104 | 104 | runs-on: ubuntu-latest | |
| 105 | 105 | steps: | |
| 106 | 106 | - name: Checkout source code | |
| 107 | - uses: actions/checkout@v4 | ||
| 107 | + uses: actions/checkout@v6 | ||
| 108 | 108 | with: | |
| 109 | 109 | fetch-depth: 0 | |
| 110 | + - name: Fetch all branches | ||
| 111 | + run: git fetch --all | ||
| 110 | 112 | - name: Set up Python | |
| 111 | - uses: actions/setup-python@v5 | ||
| 113 | + uses: actions/setup-python@v6 | ||
| 112 | 114 | with: | |
| 113 | - python-version: "3.13" | ||
| 115 | + python-version: "3.14" | ||
| 114 | 116 | cache: 'pip' | |
| 115 | 117 | - name: Install dependencies | |
| 116 | 118 | run: python -m pip install tox | |
| 117 | 119 | - name: Build docs (via tox) | |
| 118 | 120 | run: tox -e docs | |
| 119 | 121 | - name: Archive build results | |
| 120 | - uses: actions/upload-artifact@v4 | ||
| 122 | + uses: actions/upload-artifact@v7 | ||
| 121 | 123 | with: | |
| 122 | 124 | name: html-docs-build | |
| 123 | 125 | path: docs/_build/html | |
@@ -132,13 +134,13 @@ jobs: | |||
| 132 | 134 | COMPOSE_FILE: ${{ matrix.db == 'mysql' && 'docker-compose.yml' || (matrix.db == 'postgres' && 'docker-compose-pg.yml') || 'docker-compose-sqlite3.yml' }} | |
| 133 | 135 | steps: | |
| 134 | 136 | - name: Checkout source code | |
| 135 | - uses: actions/checkout@v4 | ||
| 137 | + uses: actions/checkout@v6 | ||
| 136 | 138 | with: | |
| 137 | 139 | fetch-depth: 0 | |
| 138 | 140 | - name: Set up Python | |
| 139 | - uses: actions/setup-python@v5 | ||
| 141 | + uses: actions/setup-python@v6 | ||
| 140 | 142 | with: | |
| 141 | - python-version: "3.13" | ||
| 143 | + python-version: "3.14" | ||
| 142 | 144 | cache: 'pip' | |
| 143 | 145 | - name: Build docker-compose service | |
| 144 | 146 | run: | | |
@@ -151,7 +153,7 @@ jobs: | |||
| 151 | 153 | { echo patchwork; echo patchwork; } | \ | |
| 152 | 154 | docker compose run -T --rm web \ | |
| 153 | 155 | python manage.py changepassword patchwork | |
| 154 | - # FIXME(stephenfin): Re-enable this once dbbackup supports Django 4.0 | ||
| 156 | + # FIXME(stephenfin): Re-enable this once we've update configuration accordingly | ||
| 155 | 157 | # - name: Test dbbackup/dbrestore | |
| 156 | 158 | # run: | | |
| 157 | 159 | # docker compose run -T --rm web python manage.py dbbackup | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | --- | |
| 2 | 2 | services: | |
| 3 | 3 | db: | |
| 4 | - image: postgres:latest | ||
| 4 | + image: postgres:17 | ||
| 5 | 5 | volumes: | |
| 6 | 6 | - ./tools/docker/db/postdata:/var/lib/postgresql/data | |
| 7 | 7 | environment: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,11 +7,6 @@ | |||
| 7 | 7 | 'DJANGO_SETTINGS_MODULE', 'patchwork.settings.production' | |
| 8 | 8 | ) | |
| 9 | 9 | ||
| 10 | - import django | ||
| 11 | - | ||
| 12 | - if django.VERSION < (3, 2): | ||
| 13 | - raise Exception('Patchwork requires Django 3.2 or greater') | ||
| 14 | - | ||
| 15 | 10 | from django.core.management import execute_from_command_line | |
| 16 | 11 | ||
| 17 | 12 | execute_from_command_line(sys.argv) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,48 +44,42 @@ class DelegationRuleInline(admin.TabularInline): | |||
| 44 | 44 | fields = ('path', 'user', 'priority') | |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | + @admin.register(Project) | ||
| 47 | 48 | class ProjectAdmin(admin.ModelAdmin): | |
| 48 | 49 | list_display = ('name', 'linkname', 'listid', 'listemail') | |
| 49 | 50 | inlines = [ | |
| 50 | 51 | DelegationRuleInline, | |
| 51 | 52 | ] | |
| 52 | 53 | ||
| 53 | 54 | ||
| 54 | - admin.site.register(Project, ProjectAdmin) | ||
| 55 | - | ||
| 56 | - | ||
| 55 | + @admin.register(Person) | ||
| 57 | 56 | class PersonAdmin(admin.ModelAdmin): | |
| 58 | 57 | list_display = ('__str__', 'has_account') | |
| 59 | 58 | search_fields = ('name', 'email') | |
| 60 | 59 | ||
| 60 | + @admin.display( | ||
| 61 | + description='Account', | ||
| 62 | + boolean=True, | ||
| 63 | + ordering='user', | ||
| 64 | + ) | ||
| 61 | 65 | def has_account(self, person): | |
| 62 | 66 | return bool(person.user) | |
| 63 | 67 | ||
| 64 | - has_account.boolean = True | ||
| 65 | - has_account.admin_order_field = 'user' | ||
| 66 | - has_account.short_description = 'Account' | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - admin.site.register(Person, PersonAdmin) | ||
| 70 | - | ||
| 71 | 68 | ||
| 69 | + @admin.register(State) | ||
| 72 | 70 | class StateAdmin(admin.ModelAdmin): | |
| 73 | 71 | list_display = ('name', 'action_required') | |
| 74 | 72 | ||
| 75 | 73 | ||
| 76 | - admin.site.register(State, StateAdmin) | ||
| 77 | - | ||
| 78 | - | ||
| 74 | + @admin.register(Cover) | ||
| 79 | 75 | class CoverAdmin(admin.ModelAdmin): | |
| 80 | 76 | list_display = ('name', 'submitter', 'project', 'date') | |
| 81 | 77 | list_filter = ('project',) | |
| 82 | 78 | search_fields = ('name', 'submitter__name', 'submitter__email') | |
| 83 | 79 | date_hierarchy = 'date' | |
| 84 | 80 | ||
| 85 | 81 | ||
| 86 | - admin.site.register(Cover, CoverAdmin) | ||
| 87 | - | ||
| 88 | - | ||
| 82 | + @admin.register(Patch) | ||
| 89 | 83 | class PatchAdmin(admin.ModelAdmin): | |
| 90 | 84 | list_display = ( | |
| 91 | 85 | 'name', | |
@@ -101,40 +95,35 @@ class PatchAdmin(admin.ModelAdmin): | |||
| 101 | 95 | search_fields = ('name', 'submitter__name', 'submitter__email') | |
| 102 | 96 | date_hierarchy = 'date' | |
| 103 | 97 | ||
| 98 | + @admin.display( | ||
| 99 | + description='Pull', | ||
| 100 | + boolean=True, | ||
| 101 | + ordering='pull_url', | ||
| 102 | + ) | ||
| 104 | 103 | def is_pull_request(self, patch): | |
| 105 | 104 | return bool(patch.pull_url) | |
| 106 | 105 | ||
| 107 | - is_pull_request.boolean = True | ||
| 108 | - is_pull_request.admin_order_field = 'pull_url' | ||
| 109 | - is_pull_request.short_description = 'Pull' | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - admin.site.register(Patch, PatchAdmin) | ||
| 113 | - | ||
| 114 | 106 | ||
| 107 | + @admin.register(CoverComment) | ||
| 115 | 108 | class CoverCommentAdmin(admin.ModelAdmin): | |
| 116 | 109 | list_display = ('cover', 'submitter', 'date') | |
| 117 | 110 | search_fields = ('cover__name', 'submitter__name', 'submitter__email') | |
| 118 | 111 | date_hierarchy = 'date' | |
| 119 | 112 | ||
| 120 | 113 | ||
| 121 | - admin.site.register(CoverComment, CoverCommentAdmin) | ||
| 122 | - | ||
| 123 | - | ||
| 114 | + @admin.register(PatchComment) | ||
| 124 | 115 | class PatchCommentAdmin(admin.ModelAdmin): | |
| 125 | 116 | list_display = ('patch', 'submitter', 'date') | |
| 126 | 117 | search_fields = ('patch__name', 'submitter__name', 'submitter__email') | |
| 127 | 118 | date_hierarchy = 'date' | |
| 128 | 119 | ||
| 129 | 120 | ||
| 130 | - admin.site.register(PatchComment, PatchCommentAdmin) | ||
| 131 | - | ||
| 132 | - | ||
| 133 | 121 | class PatchInline(admin.StackedInline): | |
| 134 | 122 | model = Patch | |
| 135 | 123 | extra = 0 | |
| 136 | 124 | ||
| 137 | 125 | ||
| 126 | + @admin.register(Series) | ||
| 138 | 127 | class SeriesAdmin(admin.ModelAdmin): | |
| 139 | 128 | list_display = ( | |
| 140 | 129 | 'name', | |
@@ -154,11 +143,10 @@ class SeriesAdmin(admin.ModelAdmin): | |||
| 154 | 143 | filter_horizontal = ('dependencies',) | |
| 155 | 144 | inlines = (PatchInline,) | |
| 156 | 145 | ||
| 146 | + @admin.display(boolean=True) | ||
| 157 | 147 | def received_all(self, series): | |
| 158 | 148 | return series.received_all | |
| 159 | 149 | ||
| 160 | - received_all.boolean = True | ||
| 161 | - | ||
| 162 | 150 | def get_queryset(self, request): | |
| 163 | 151 | qs = super(SeriesAdmin, self).get_queryset(request) | |
| 164 | 152 | return qs.prefetch_related( | |
@@ -171,16 +159,12 @@ def get_queryset(self, request): | |||
| 171 | 159 | ) | |
| 172 | 160 | ||
| 173 | 161 | ||
| 174 | - admin.site.register(Series, SeriesAdmin) | ||
| 175 | - | ||
| 176 | - | ||
| 162 | + @admin.register(SeriesReference) | ||
| 177 | 163 | class SeriesReferenceAdmin(admin.ModelAdmin): | |
| 178 | 164 | model = SeriesReference | |
| 179 | 165 | ||
| 180 | 166 | ||
| 181 | - admin.site.register(SeriesReference, SeriesReferenceAdmin) | ||
| 182 | - | ||
| 183 | - | ||
| 167 | + @admin.register(Check) | ||
| 184 | 168 | class CheckAdmin(admin.ModelAdmin): | |
| 185 | 169 | list_display = ( | |
| 186 | 170 | 'patch', | |
@@ -195,27 +179,18 @@ class CheckAdmin(admin.ModelAdmin): | |||
| 195 | 179 | date_hierarchy = 'date' | |
| 196 | 180 | ||
| 197 | 181 | ||
| 198 | - admin.site.register(Check, CheckAdmin) | ||
| 199 | - | ||
| 200 | - | ||
| 182 | + @admin.register(Bundle) | ||
| 201 | 183 | class BundleAdmin(admin.ModelAdmin): | |
| 202 | 184 | list_display = ('name', 'owner', 'project', 'public') | |
| 203 | 185 | list_filter = ('public', 'project') | |
| 204 | 186 | search_fields = ('name', 'owner') | |
| 205 | 187 | ||
| 206 | 188 | ||
| 207 | - admin.site.register(Bundle, BundleAdmin) | ||
| 208 | - | ||
| 209 | - | ||
| 189 | + @admin.register(Tag) | ||
| 210 | 190 | class TagAdmin(admin.ModelAdmin): | |
| 211 | 191 | list_display = ('name',) | |
| 212 | 192 | ||
| 213 | 193 | ||
| 214 | - admin.site.register(Tag, TagAdmin) | ||
| 215 | - | ||
| 216 | - | ||
| 194 | + @admin.register(PatchRelation) | ||
| 217 | 195 | class PatchRelationAdmin(admin.ModelAdmin): | |
| 218 | 196 | model = PatchRelation | |
| 219 | - | ||
| 220 | - | ||
| 221 | - admin.site.register(PatchRelation, PatchRelationAdmin) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,6 @@ | |||
| 3 | 3 | # | |
| 4 | 4 | # SPDX-License-Identifier: GPL-2.0-or-later | |
| 5 | 5 | ||
| 6 | - import django | ||
| 7 | 6 | from django.contrib.auth.models import User | |
| 8 | 7 | from django import forms | |
| 9 | 8 | from django.forms import renderers | |
@@ -179,10 +178,7 @@ def _get_choices(self): | |||
| 179 | 178 | choices.append(self.no_change_choice) | |
| 180 | 179 | return choices | |
| 181 | 180 | ||
| 182 | - if django.VERSION >= (5, 0): | ||
| 183 | - choices = property(_get_choices, forms.ChoiceField.choices.fset) | ||
| 184 | - else: | ||
| 185 | - choices = property(_get_choices, forms.ChoiceField._set_choices) | ||
| 181 | + choices = property(_get_choices, forms.ChoiceField.choices.fset) | ||
| 186 | 182 | ||
| 187 | 183 | def is_no_change(self, value): | |
| 188 | 184 | return value == self.no_change_choice[0] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,7 +119,7 @@ | |||
| 119 | 119 | if os.getenv('DATABASE_TYPE') == 'postgres': | |
| 120 | 120 | DATABASES = { | |
| 121 | 121 | 'default': { | |
| 122 | - 'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
| 122 | + 'ENGINE': 'django.db.backends.postgresql', | ||
| 123 | 123 | 'HOST': os.environ.get('DATABASE_HOST', 'localhost'), | |
| 124 | 124 | 'PORT': os.environ.get('DATABASE_PORT', ''), | |
| 125 | 125 | 'NAME': os.environ.get('DATABASE_NAME', 'patchwork'), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,6 +56,11 @@ | |||
| 56 | 56 | ||
| 57 | 57 | STATIC_ROOT = os.environ.get('STATIC_ROOT', '/srv/patchwork/htdocs/static') | |
| 58 | 58 | ||
| 59 | - STATICFILES_STORAGE = ( | ||
| 60 | - 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' | ||
| 61 | - ) | ||
| 59 | + STORAGES = { | ||
| 60 | + 'default': { | ||
| 61 | + 'BACKEND': 'django.core.files.storage.FileSystemStorage', | ||
| 62 | + }, | ||
| 63 | + 'staticfiles': { | ||
| 64 | + 'BACKEND': 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage', | ||
| 65 | + }, | ||
| 66 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -331,14 +331,18 @@ def _get_auth_string(user): | |||
| 331 | 331 | ||
| 332 | 332 | # Check we can view as owner | |
| 333 | 333 | auth_string = _get_auth_string(self.user) | |
| 334 | - response = self.client.get(self.url, HTTP_AUTHORIZATION=auth_string) | ||
| 334 | + response = self.client.get( | ||
| 335 | + self.url, headers={'authorization': auth_string} | ||
| 336 | + ) | ||
| 335 | 337 | ||
| 336 | 338 | self.assertEqual(response.status_code, 200) | |
| 337 | 339 | self.assertContains(response, self.patches[0].name) | |
| 338 | 340 | ||
| 339 | 341 | # Check we can't view as another user | |
| 340 | 342 | auth_string = _get_auth_string(self.other_user) | |
| 341 | - response = self.client.get(self.url, HTTP_AUTHORIZATION=auth_string) | ||
| 343 | + response = self.client.get( | ||
| 344 | + self.url, headers={'authorization': auth_string} | ||
| 345 | + ) | ||
| 342 | 346 | self.assertEqual(response.status_code, 404) | |
| 343 | 347 | ||
| 344 | 348 | def test_private_bundle_mbox_token_auth(self): | |
@@ -353,14 +357,18 @@ def _get_auth_string(user): | |||
| 353 | 357 | ||
| 354 | 358 | # Check we can view as owner | |
| 355 | 359 | auth_string = _get_auth_string(self.user) | |
| 356 | - response = self.client.get(self.url, HTTP_AUTHORIZATION=auth_string) | ||
| 360 | + response = self.client.get( | ||
| 361 | + self.url, headers={'authorization': auth_string} | ||
| 362 | + ) | ||
| 357 | 363 | ||
| 358 | 364 | self.assertEqual(response.status_code, 200) | |
| 359 | 365 | self.assertContains(response, self.patches[0].name) | |
| 360 | 366 | ||
| 361 | 367 | # Check we can't view as another user | |
| 362 | 368 | auth_string = _get_auth_string(self.other_user) | |
| 363 | - response = self.client.get(self.url, HTTP_AUTHORIZATION=auth_string) | ||
| 369 | + response = self.client.get( | ||
| 370 | + self.url, headers={'authorization': auth_string} | ||
| 371 | + ) | ||
| 364 | 372 | self.assertEqual(response.status_code, 404) | |
| 365 | 373 | ||
| 366 | 374 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments