Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
49b90282
Verified
Commit
49b90282
authored
Oct 15, 2021
by
Mattia Rizzolo
Browse files
Merge branch 'django3' of salsa.debian.org:lyknode/debexpo into live
MR:
!183
Signed-off-by:
Mattia Rizzolo
<
mattia@debian.org
>
parents
50d34459
02226345
Pipeline
#303008
passed with stage
in 11 minutes and 7 seconds
Changes
18
Pipelines
1
Show whitespace changes
Inline
Side-by-side
debexpo/accounts/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
AccountsConfig
(
AppConfig
):
class
AccountsConfig
(
AppConfig
):
name
=
'accounts'
name
=
'
debexpo.
accounts'
debexpo/base/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
BaseConfig
(
AppConfig
):
class
BaseConfig
(
AppConfig
):
name
=
'base'
name
=
'
debexpo.
base'
debexpo/bugs/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
BugsConfig
(
AppConfig
):
class
BugsConfig
(
AppConfig
):
name
=
'bugs'
name
=
'
debexpo.
bugs'
debexpo/comments/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
CommentsConfig
(
AppConfig
):
class
CommentsConfig
(
AppConfig
):
name
=
'comments'
name
=
'
debexpo.
comments'
debexpo/importer/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
ImporterConfig
(
AppConfig
):
class
ImporterConfig
(
AppConfig
):
name
=
'importer'
name
=
'
debexpo.
importer'
debexpo/importer/tasks.py
View file @
49b90282
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
celery
.decorators
import
task
from
celery
import
shared_
task
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -34,7 +34,7 @@ from debexpo.importer.models import Importer
...
@@ -34,7 +34,7 @@ from debexpo.importer.models import Importer
from
debexpo.tools.cache
import
enforce_unique_instance
from
debexpo.tools.cache
import
enforce_unique_instance
@
task
@
shared_
task
def
importer
():
def
importer
():
with
enforce_unique_instance
(
'importer'
):
with
enforce_unique_instance
(
'importer'
):
importctl
=
Importer
(
settings
.
UPLOAD_SPOOL
)
importctl
=
Importer
(
settings
.
UPLOAD_SPOOL
)
...
...
debexpo/keyring/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
KeyringConfig
(
AppConfig
):
class
KeyringConfig
(
AppConfig
):
name
=
'keyring'
name
=
'
debexpo.
keyring'
debexpo/keyring/migrations/0004_set_ecc_size_to_zero.py
0 → 100644
View file @
49b90282
# 0004_set_ecc_size_to_zero.py - Set ECC minimum size to zero
#
# This file is part of debexpo
# https://salsa.debian.org/mentors.debian.net-team/debexpo
#
# Copyright © 2021 Baptiste Beauplat <lyknode@debian.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
from
django.db
import
migrations
def
set_ecc_size_to_zero
(
apps
,
schema_editor
):
set_ecc_size
(
apps
,
schema_editor
,
0
)
def
revert_set_ecc_size_to_zero
(
apps
,
schema_editor
):
# pragma: no cover
set_ecc_size
(
apps
,
schema_editor
,
256
)
def
set_ecc_size
(
apps
,
schema_editor
,
size
):
GPGAlgo
=
apps
.
get_model
(
'keyring'
,
'GPGAlgo'
)
algo
=
GPGAlgo
.
objects
.
get
(
name
=
'ed25519'
)
algo
.
minimal_size_requirement
=
size
algo
.
full_clean
()
algo
.
save
()
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
(
'keyring'
,
'0003_fingerprint_uniqueness'
,),
]
operations
=
[
migrations
.
RunPython
(
set_ecc_size_to_zero
,
revert_set_ecc_size_to_zero
),
]
debexpo/nntp/apps.py
View file @
49b90282
...
@@ -29,4 +29,4 @@ from django.apps import AppConfig
...
@@ -29,4 +29,4 @@ from django.apps import AppConfig
class
NntpConfig
(
AppConfig
):
class
NntpConfig
(
AppConfig
):
name
=
'nntp'
name
=
'
debexpo.
nntp'
debexpo/packages/apps.py
View file @
49b90282
...
@@ -29,4 +29,4 @@ from django.apps import AppConfig
...
@@ -29,4 +29,4 @@ from django.apps import AppConfig
class
PackagesConfig
(
AppConfig
):
class
PackagesConfig
(
AppConfig
):
name
=
'packages'
name
=
'
debexpo.
packages'
debexpo/packages/tasks.py
View file @
49b90282
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
celery
.decorators
import
task
from
celery
import
shared_
task
from
datetime
import
timedelta
,
datetime
,
timezone
from
datetime
import
timedelta
,
datetime
,
timezone
from
logging
import
getLogger
from
logging
import
getLogger
from
debian.deb822
import
Changes
from
debian.deb822
import
Changes
...
@@ -97,7 +97,7 @@ def remove_uploads(uploads):
...
@@ -97,7 +97,7 @@ def remove_uploads(uploads):
return
removals
return
removals
@
task
@
shared_
task
def
remove_old_uploads
():
def
remove_old_uploads
():
expiration_date
=
datetime
.
now
(
timezone
.
utc
)
-
\
expiration_date
=
datetime
.
now
(
timezone
.
utc
)
-
\
timedelta
(
weeks
=
settings
.
MAX_AGE_UPLOAD_WEEKS
)
timedelta
(
weeks
=
settings
.
MAX_AGE_UPLOAD_WEEKS
)
...
@@ -128,7 +128,7 @@ def notify_uploaders(removals, reason):
...
@@ -128,7 +128,7 @@ def notify_uploaders(removals, reason):
reason
=
reason
)
reason
=
reason
)
@
task
@
shared_
task
def
remove_uploaded_packages
(
client
=
None
):
def
remove_uploaded_packages
(
client
=
None
):
uploads_to_archive
=
set
()
uploads_to_archive
=
set
()
uploads_to_new
=
set
()
uploads_to_new
=
set
()
...
...
debexpo/plugins/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
PluginsConfig
(
AppConfig
):
class
PluginsConfig
(
AppConfig
):
name
=
'plugins'
name
=
'
debexpo.
plugins'
debexpo/repository/apps.py
View file @
49b90282
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
...
@@ -30,4 +30,4 @@ from django.apps import AppConfig
class
RepositoryConfig
(
AppConfig
):
class
RepositoryConfig
(
AppConfig
):
name
=
'repository'
name
=
'
debexpo.
repository'
debexpo/settings/common.py
View file @
49b90282
...
@@ -260,3 +260,6 @@ REGISTRATION_CACHE_TIMEOUT = 1 * 24 * 3600
...
@@ -260,3 +260,6 @@ REGISTRATION_CACHE_TIMEOUT = 1 * 24 * 3600
# Timeout for processes (10 minutes by default, 30 minutes for lintian)
# Timeout for processes (10 minutes by default, 30 minutes for lintian)
SUBPROCESS_TIMEOUT
=
10
*
60
SUBPROCESS_TIMEOUT
=
10
*
60
SUBPROCESS_TIMEOUT_LINTIAN
=
30
*
60
SUBPROCESS_TIMEOUT_LINTIAN
=
30
*
60
# Default settings for models
DEFAULT_AUTO_FIELD
=
'django.db.models.AutoField'
debexpo/tools/token.py
View file @
49b90282
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
datetime
import
date
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils.crypto
import
constant_time_compare
,
salted_hmac
from
django.utils.crypto
import
constant_time_compare
,
salted_hmac
...
@@ -87,5 +88,12 @@ class EmailChangeTokenGenerator(PasswordResetTokenGenerator):
...
@@ -87,5 +88,12 @@ class EmailChangeTokenGenerator(PasswordResetTokenGenerator):
str
(
login_timestamp
)
+
\
str
(
login_timestamp
)
+
\
str
(
timestamp
)
str
(
timestamp
)
def
_num_days
(
self
,
dt
):
return
(
dt
-
date
(
2001
,
1
,
1
)).
days
def
_today
(
self
):
# Used for mocking in tests
return
date
.
today
()
# pragma: no cover
email_change_token_generator
=
EmailChangeTokenGenerator
()
email_change_token_generator
=
EmailChangeTokenGenerator
()
setup.py
View file @
49b90282
...
@@ -77,13 +77,13 @@ setup(
...
@@ -77,13 +77,13 @@ setup(
# Requirements
# Requirements
install_requires
=
[
install_requires
=
[
'django >= 2.2.10, <
3
'
,
'django >= 2.2.10, <
4
'
,
'bcrypt >= 3.1.6, < 4'
,
'bcrypt >= 3.1.6, < 4'
,
'python-debian >= 0.1.35, < 1'
,
'python-debian >= 0.1.35, < 1'
,
'celery >= 4.2.1, < 6'
,
'celery >= 4.2.1, < 6'
,
'django-celery-beat >= 1.1.1, < 3'
,
'django-celery-beat >= 1.1.1, < 3'
,
'redis >= 3.2.1, < 4'
,
'redis >= 3.2.1, < 4'
,
'django-redis >= 4.10.0, <
5
'
,
'django-redis >= 4.10.0, <
6
'
,
'python-debianbts >= 2.8.2, < 4'
,
'python-debianbts >= 2.8.2, < 4'
,
'lxml >= 4.3.2, < 5'
,
'lxml >= 4.3.2, < 5'
,
'dulwich >= 0.19.11, < 1'
,
'dulwich >= 0.19.11, < 1'
,
...
...
tests/functional/accounts/test_reset.py
View file @
49b90282
...
@@ -27,8 +27,7 @@
...
@@ -27,8 +27,7 @@
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
django.contrib.auth.tokens
import
PasswordResetTokenGenerator
from
django.contrib.auth.tokens
import
PasswordResetTokenGenerator
from
django.contrib.auth.views
import
INTERNAL_RESET_URL_TOKEN
,
\
from
django.contrib.auth.views
import
INTERNAL_RESET_SESSION_TOKEN
INTERNAL_RESET_SESSION_TOKEN
from
django.core
import
mail
from
django.core
import
mail
from
django.urls
import
reverse
from
django.urls
import
reverse
from
django.utils.encoding
import
force_bytes
from
django.utils.encoding
import
force_bytes
...
@@ -67,7 +66,7 @@ class TestResetController(TestController):
...
@@ -67,7 +66,7 @@ class TestResetController(TestController):
response
=
self
.
client
.
post
(
reverse
(
'password_reset_confirm'
,
kwargs
=
{
response
=
self
.
client
.
post
(
reverse
(
'password_reset_confirm'
,
kwargs
=
{
'uidb64'
:
uid
,
'uidb64'
:
uid
,
'token'
:
INTERNAL_RESET_URL_TOKEN
'token'
:
'set-password'
}),
{
}),
{
'new_password1'
:
'newpass'
,
'new_password1'
:
'newpass'
,
'new_password2'
:
'newpass'
,
'new_password2'
:
'newpass'
,
...
...
tox.ini
View file @
49b90282
...
@@ -4,21 +4,23 @@
...
@@ -4,21 +4,23 @@
# and then run "tox" from this directory.
# and then run "tox" from this directory.
[tox]
[tox]
envlist
=
py3-django
2
,flake8
envlist
=
py3-django
{2,3}
,flake8
[testenv]
[testenv]
extras
=
testing
extras
=
testing
deps
=
coverage
deps
=
coverage
django2:
Django
>=
2.2.24,
<
3
django3:
Django
>=
3.2.7,
<4
setenv
=
setenv
=
DJANGO_SETTINGS_MODULE
=
debexpo.settings.test
DJANGO_SETTINGS_MODULE
=
debexpo.settings.test
commands
=
commands
=
coverage
erase
coverage
erase
coverage
run
manage.py
test
-v
2
coverage
run
manage.py
test
-v
2
--exclude-tag
nntp
{posargs}
coverage
report
--include
=
'debexpo*'
coverage
report
--include
=
'debexpo*'
--omit '*/nntp.py'
coverage
html
--include
=
'debexpo*'
coverage
html
--include
=
'debexpo*'
--omit '*/nntp.py'
[testenv:flake8]
[testenv:flake8]
deps
=
flake8
deps
=
flake8
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment