learning-credentials 0.4.1rc3__tar.gz → 0.4.1rc5__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.
- {learning_credentials-0.4.1rc3/learning_credentials.egg-info → learning_credentials-0.4.1rc5}/PKG-INFO +1 -1
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/generators.py +6 -8
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5/learning_credentials.egg-info}/PKG-INFO +1 -1
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/pyproject.toml +1 -1
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_generators.py +6 -7
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/CHANGELOG.rst +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/LICENSE.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/MANIFEST.in +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/README.rst +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/__init__.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/admin.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/__init__.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/urls.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/__init__.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/permissions.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/urls.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/views.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/apps.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/compat.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/conf/locale/config.yaml +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/exceptions.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0001_initial.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0002_migrate_to_learning_credentials.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0003_rename_certificates_to_credentials.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0004_replace_course_keys_with_learning_context_keys.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0005_rename_processors_and_generators.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0006_cleanup_openedx_certificates_tables.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/0007_migrate_to_text_elements_format.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/migrations/__init__.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/models.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/processors.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/settings/__init__.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/settings/common.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/settings/production.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/tasks.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/base.html +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.html +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/urls.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials.egg-info/SOURCES.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials.egg-info/dependency_links.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials.egg-info/entry_points.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials.egg-info/requires.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials.egg-info/top_level.txt +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/setup.cfg +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_migrations.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_models.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_processors.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_tasks.py +0 -0
- {learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/tests/test_views.py +0 -0
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/generators.py
RENAMED
|
@@ -276,9 +276,6 @@ def _write_text_on_template(
|
|
|
276
276
|
# Build and render text elements.
|
|
277
277
|
elements = _build_text_elements(options)
|
|
278
278
|
|
|
279
|
-
if elements['context']:
|
|
280
|
-
elements['context']['text'] = elements['context']['text'].replace(';', '\n')
|
|
281
|
-
|
|
282
279
|
for config in elements.values():
|
|
283
280
|
_render_text_element(pdf_canvas, template_width, config, placeholders)
|
|
284
281
|
|
|
@@ -341,7 +338,7 @@ def generate_pdf_credential(
|
|
|
341
338
|
Options:
|
|
342
339
|
|
|
343
340
|
- template (required): The slug of the PDF template asset.
|
|
344
|
-
- template_multiline: Alternative template for multiline context names (when using '\n'
|
|
341
|
+
- template_multiline: Alternative template for multiline context names (when using '\n').
|
|
345
342
|
- defaults: Global defaults for all text elements.
|
|
346
343
|
- font: Font name (asset slug). Default: Helvetica.
|
|
347
344
|
- color: Hex color code. Default: #000.
|
|
@@ -379,14 +376,15 @@ def generate_pdf_credential(
|
|
|
379
376
|
|
|
380
377
|
username = _get_user_name(user)
|
|
381
378
|
|
|
382
|
-
# Handle multiline context name
|
|
383
|
-
context_name = get_learning_context_name(learning_context_key)
|
|
379
|
+
# Handle multiline context name.
|
|
380
|
+
context_name = get_learning_context_name(learning_context_key)
|
|
381
|
+
custom_context_name = ''
|
|
384
382
|
custom_context_text_element = options.get('text_elements', {}).get('context', {})
|
|
385
383
|
if isinstance(custom_context_text_element, dict):
|
|
386
|
-
|
|
384
|
+
custom_context_name = custom_context_text_element.get('text', '')
|
|
387
385
|
|
|
388
386
|
template_path = options.get('template')
|
|
389
|
-
if '\n' in context_name:
|
|
387
|
+
if '\n' in context_name or '\n' in custom_context_name:
|
|
390
388
|
template_path = options.get('template_multiline', template_path)
|
|
391
389
|
|
|
392
390
|
if not template_path:
|
|
@@ -477,8 +477,6 @@ def test_save_credential(mock_contentfile: Mock, mock_token_hex: Mock, storage:
|
|
|
477
477
|
('Test Course', {'template': 'default', 'template_multiline': 'multiline'}, 'default', 'Test Course'),
|
|
478
478
|
# Specify a different template for multiline course names and replace \n with newline.
|
|
479
479
|
('Test\nCourse', {'template': 'default', 'template_multiline': 'multiline'}, 'multiline', 'Test\nCourse'),
|
|
480
|
-
# Backward compatibility with semicolon separator.
|
|
481
|
-
('Test\nCourse;', {'template_multiline': 'multiline'}, 'multiline', 'Test\nCourse\n'),
|
|
482
480
|
# Ensure that the default template is used when no multiline template is specified.
|
|
483
481
|
('Test\nCourse', {'template': 'default'}, 'default', 'Test\nCourse'),
|
|
484
482
|
# Custom context text with newlines uses multiline template.
|
|
@@ -486,14 +484,15 @@ def test_save_credential(mock_contentfile: Mock, mock_token_hex: Mock, storage:
|
|
|
486
484
|
'Single Line',
|
|
487
485
|
{'template_multiline': 'multiline', 'text_elements': {'context': {'text': 'Line 1\nLine 2'}}},
|
|
488
486
|
'multiline',
|
|
489
|
-
'Line
|
|
487
|
+
'Single Line',
|
|
490
488
|
),
|
|
491
|
-
# Custom context text
|
|
489
|
+
# Custom context text without newlines still uses multiline template if the original context name has newlines.
|
|
490
|
+
# This allows using the `context_name` placeholder in the `context` text element.
|
|
492
491
|
(
|
|
493
|
-
'
|
|
494
|
-
{'template_multiline': 'multiline', 'text_elements': {'context': {'text': '
|
|
492
|
+
'Multi\nLine',
|
|
493
|
+
{'template_multiline': 'multiline', 'text_elements': {'context': {'text': 'Single Line'}}},
|
|
495
494
|
'multiline',
|
|
496
|
-
'
|
|
495
|
+
'Multi\nLine',
|
|
497
496
|
),
|
|
498
497
|
# Disabled context element falls back to learning context name for template selection.
|
|
499
498
|
(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/__init__.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/admin.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/__init__.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/urls.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/urls.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/api/v1/views.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/apps.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/compat.py
RENAMED
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/models.py
RENAMED
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/processors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{learning_credentials-0.4.1rc3 → learning_credentials-0.4.1rc5}/learning_credentials/urls.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|