Compare commits

..

4 Commits

Author SHA1 Message Date
Paul Marillonnet 6972bac29e user_name: fallback on default full name when var defined yet empty (#74507)
gitea/hobo/pipeline/head Something is wrong with the build of this commit Details
2023-02-23 14:51:29 +01:00
Paul Marillonnet f01cfa1d8f profile: add user full name template definition popup (#74507) 2023-02-23 14:50:55 +01:00
Frédéric Péters 266f691c99 ci: update .tar.gz URLs for gitea (#74713)
gitea/hobo/pipeline/head This commit looks good Details
2023-02-22 16:38:04 +01:00
Agate 3d4f80d8e3 Prepare Jenkinsfile for Gitea migration (#74572)
gitea/hobo/pipeline/head Something is wrong with the build of this commit Details
2023-02-20 15:07:51 +01:00
6 changed files with 32 additions and 7 deletions

14
Jenkinsfile vendored
View File

@ -30,10 +30,18 @@ python3 -m venv ./venv/
stage('Packaging') {
steps {
script {
if (env.JOB_NAME == 'hobo' && env.GIT_BRANCH == 'origin/main') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye hobo'
env.SHORT_JOB_NAME=sh(
returnStdout: true,
// given JOB_NAME=gitea/project/PR-46, returns project
// given JOB_NAME=project/main, returns project
script: '''
echo "${JOB_NAME}" | sed "s/gitea\\///" | awk -F/ '{print $1}'
'''
).trim()
if (env.GIT_BRANCH == 'main' || env.GIT_BRANCH == 'origin/main') {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye ${SHORT_JOB_NAME}"
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye --branch ${env.GIT_BRANCH} --hotfix hobo"
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye --branch ${env.GIT_BRANCH} --hotfix ${SHORT_JOB_NAME}"
}
}
}

View File

@ -17,7 +17,7 @@ def get_full_name(user):
context = {}
context['user'] = user
template_vars = getattr(settings, 'TEMPLATE_VARS', {})
if 'user_full_name_template' in template_vars:
if template_vars.get('user_full_name_template'):
try:
template = engines['django'].from_string(template_vars['user_full_name_template'])
return template.render(context)

View File

@ -98,6 +98,11 @@ def test_edit_user_full_name_template(logged_app, admin_user, settings):
page.click('Cancel')
assert Variable.objects.get(name='user_full_name_template').value == value
page = app.get('/profile/edit-user-full-name-template', status=200)
page.form['user_full_name_template'] = ''
page.form.submit()
assert Variable.objects.get(name='user_full_name_template') == ''
def test_attribute_kind_not_restricted_at_model_level(db):
assert models.AttributeDefinition.objects.create(label='test', kind='somestring')

View File

@ -36,9 +36,15 @@ def test_user_get_full_name_from_template(user):
):
assert get_full_name(user) == 'Jane bar'
with override_settings(TEMPLATE_VARS={'user_full_name_template': ''}):
assert get_full_name(user) == 'Jane Doe'
def test_user_get_full_name(user):
with override_settings(
TEMPLATE_VARS={'user_full_name_template': '{{ user.first_name }} {{ user.attributes.foo }}'}
):
assert user.get_full_name() == 'Jane bar'
with override_settings(TEMPLATE_VARS={'user_full_name_template': ''}):
assert user.get_full_name() == 'Jane Doe'

View File

@ -49,6 +49,9 @@ def test_get_full_name_from_template_utils_from_multiple_attrs(db, tenant, setti
):
assert get_full_name(user) == 'Jane Milly Minnie'
with override_settings(TEMPLATE_VARS={'user_full_name_template': ''}):
assert get_full_name(user) == 'Jane Doe'
def test_get_full_name_from_template_accessor_from_multiple_attrs(db, tenant, settings):
with tenant_context(tenant):
@ -90,3 +93,6 @@ def test_get_full_name_from_template_accessor_from_multiple_attrs(db, tenant, se
}
):
assert user.get_full_name() == 'Jane Milly Minnie'
with override_settings(TEMPLATE_VARS={'user_full_name_template': ''}):
assert user.get_full_name() == 'Jane Doe'

View File

@ -63,11 +63,11 @@ deps:
django-mellon
django-webtest
Markdown<3
authentic: https://git.entrouvert.org/authentic.git/snapshot/authentic-main.tar.gz
passerelle: https://git.entrouvert.org/passerelle.git/snapshot/passerelle-main.tar.gz
authentic: https://git.entrouvert.org/entrouvert/authentic/archive/main.tar.gz
passerelle: https://git.entrouvert.org/entrouvert/passerelle/archive/main.tar.gz
passerelle: python-memcached
multitenant: systemd-python
https://git.entrouvert.org/debian/django-tenant-schemas.git/snapshot/django-tenant-schemas-main.tar.gz
https://git.entrouvert.org/entrouvert/debian-django-tenant-schemas/archive/main.tar.gz
mock<4
httmock
requests