learning-credentials 0.4.1rc1__tar.gz → 0.4.1rc2__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.
Files changed (53) hide show
  1. {learning_credentials-0.4.1rc1/learning_credentials.egg-info → learning_credentials-0.4.1rc2}/PKG-INFO +1 -1
  2. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/generators.py +6 -3
  3. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2/learning_credentials.egg-info}/PKG-INFO +1 -1
  4. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/pyproject.toml +1 -1
  5. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_generators.py +24 -6
  6. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/CHANGELOG.rst +0 -0
  7. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/LICENSE.txt +0 -0
  8. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/MANIFEST.in +0 -0
  9. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/README.rst +0 -0
  10. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/__init__.py +0 -0
  11. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/admin.py +0 -0
  12. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/__init__.py +0 -0
  13. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/urls.py +0 -0
  14. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/v1/__init__.py +0 -0
  15. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/v1/permissions.py +0 -0
  16. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/v1/urls.py +0 -0
  17. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/api/v1/views.py +0 -0
  18. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/apps.py +0 -0
  19. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/compat.py +0 -0
  20. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/conf/locale/config.yaml +0 -0
  21. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/exceptions.py +0 -0
  22. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0001_initial.py +0 -0
  23. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0002_migrate_to_learning_credentials.py +0 -0
  24. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0003_rename_certificates_to_credentials.py +0 -0
  25. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0004_replace_course_keys_with_learning_context_keys.py +0 -0
  26. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0005_rename_processors_and_generators.py +0 -0
  27. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0006_cleanup_openedx_certificates_tables.py +0 -0
  28. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/0007_migrate_to_text_elements_format.py +0 -0
  29. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/migrations/__init__.py +0 -0
  30. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/models.py +0 -0
  31. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/processors.py +0 -0
  32. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/settings/__init__.py +0 -0
  33. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/settings/common.py +0 -0
  34. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/settings/production.py +0 -0
  35. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/tasks.py +0 -0
  36. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/base.html +0 -0
  37. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.html +0 -0
  38. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.txt +0 -0
  39. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt +0 -0
  40. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html +0 -0
  41. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt +0 -0
  42. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials/urls.py +0 -0
  43. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials.egg-info/SOURCES.txt +0 -0
  44. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials.egg-info/dependency_links.txt +0 -0
  45. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials.egg-info/entry_points.txt +0 -0
  46. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials.egg-info/requires.txt +0 -0
  47. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/learning_credentials.egg-info/top_level.txt +0 -0
  48. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/setup.cfg +0 -0
  49. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_migrations.py +0 -0
  50. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_models.py +0 -0
  51. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_processors.py +0 -0
  52. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_tasks.py +0 -0
  53. {learning_credentials-0.4.1rc1 → learning_credentials-0.4.1rc2}/tests/test_views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.4.1rc1
3
+ Version: 0.4.1rc2
4
4
  Summary: A pluggable service for preparing Open edX credentials.
5
5
  Author-email: OpenCraft <help@opencraft.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -375,11 +375,14 @@ def generate_pdf_credential(
375
375
  log.info("Starting credential generation for user %s", user.id)
376
376
 
377
377
  username = _get_user_name(user)
378
- context_name = get_learning_context_name(learning_context_key)
379
- template_path = options.get('template')
380
378
 
381
379
  # Handle multiline context name (semicolon separator for backward compatibility).
382
- context_name = context_name.replace(';', '\n').replace(r'\n', '\n')
380
+ context_name = get_learning_context_name(learning_context_key).replace(';', '\n')
381
+ custom_context_text_element = options.get('text_elements', {}).get('context', {})
382
+ if isinstance(custom_context_text_element, dict):
383
+ context_name = custom_context_text_element.get('text', '').replace(';', '\n') or context_name
384
+
385
+ template_path = options.get('template')
383
386
  if '\n' in context_name:
384
387
  template_path = options.get('template_multiline', template_path)
385
388
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.4.1rc1
3
+ Version: 0.4.1rc2
4
4
  Summary: A pluggable service for preparing Open edX credentials.
5
5
  Author-email: OpenCraft <help@opencraft.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "learning-credentials"
3
- version = "0.4.1rc1"
3
+ version = "0.4.1rc2"
4
4
  description = "A pluggable service for preparing Open edX credentials."
5
5
  dynamic = ["readme"]
6
6
  requires-python = ">=3.11"
@@ -474,16 +474,34 @@ def test_save_credential(mock_contentfile: Mock, mock_token_hex: Mock, storage:
474
474
  ("context_name", "options", "expected_template_slug", "expected_context_name"),
475
475
  [
476
476
  # Default.
477
- ('Test Course', {'template': 'default'}, 'default', 'Test Course'),
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
- ('Test\\nCourse', {'template_multiline': 'multiline'}, 'multiline', 'Test\nCourse'),
481
480
  # Backward compatibility with semicolon separator.
482
- ('Test;Course', {'template_multiline': 'multiline'}, 'multiline', 'Test\nCourse'),
483
- # Mixed semicolon and newline separators.
484
- ('Te\nst\\nCourse;', {'template_multiline': 'multiline'}, 'multiline', 'Te\nst\nCourse\n'),
481
+ ('Test\nCourse;', {'template_multiline': 'multiline'}, 'multiline', 'Test\nCourse\n'),
485
482
  # Ensure that the default template is used when no multiline template is specified.
486
- ('Test\\nCourse', {'template': 'default'}, 'default', 'Test\nCourse'),
483
+ ('Test\nCourse', {'template': 'default'}, 'default', 'Test\nCourse'),
484
+ # Custom context text with newlines uses multiline template.
485
+ (
486
+ 'Single Line',
487
+ {'template_multiline': 'multiline', 'text_elements': {'context': {'text': 'Line 1\nLine 2'}}},
488
+ 'multiline',
489
+ 'Line 1\nLine 2',
490
+ ),
491
+ # Custom context text with semicolon uses multiline template.
492
+ (
493
+ 'Single Line',
494
+ {'template_multiline': 'multiline', 'text_elements': {'context': {'text': 'Line 1;Line 2'}}},
495
+ 'multiline',
496
+ 'Line 1\nLine 2',
497
+ ),
498
+ # Disabled context element falls back to learning context name for template selection.
499
+ (
500
+ 'Multi\nLine',
501
+ {'template_multiline': 'multiline', 'text_elements': {'context': False}},
502
+ 'multiline',
503
+ 'Multi\nLine',
504
+ ),
487
505
  ],
488
506
  )
489
507
  @patch(