learning-credentials 0.4.1rc1__py3-none-any.whl → 0.4.1rc3__py3-none-any.whl

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.
@@ -276,6 +276,9 @@ 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
+
279
282
  for config in elements.values():
280
283
  _render_text_element(pdf_canvas, template_width, config, placeholders)
281
284
 
@@ -375,11 +378,14 @@ def generate_pdf_credential(
375
378
  log.info("Starting credential generation for user %s", user.id)
376
379
 
377
380
  username = _get_user_name(user)
378
- context_name = get_learning_context_name(learning_context_key)
379
- template_path = options.get('template')
380
381
 
381
382
  # Handle multiline context name (semicolon separator for backward compatibility).
382
- context_name = context_name.replace(';', '\n').replace(r'\n', '\n')
383
+ context_name = get_learning_context_name(learning_context_key).replace(';', '\n')
384
+ custom_context_text_element = options.get('text_elements', {}).get('context', {})
385
+ if isinstance(custom_context_text_element, dict):
386
+ context_name = custom_context_text_element.get('text', '').replace(';', '\n') or context_name
387
+
388
+ template_path = options.get('template')
383
389
  if '\n' in context_name:
384
390
  template_path = options.get('template_multiline', template_path)
385
391
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.4.1rc1
3
+ Version: 0.4.1rc3
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
@@ -3,7 +3,7 @@ learning_credentials/admin.py,sha256=ynK3tVJwLsIeV7Jk66t1FAVyVsU1G-KRIAdRkycVTmA
3
3
  learning_credentials/apps.py,sha256=trdQxe-JRhUdUaOQoQWiGL1sn6I1sfDiTvdCwy8yGuw,1037
4
4
  learning_credentials/compat.py,sha256=bTAB6bTh99ZyhUqOsDtM_BuIPzFxCjySFtfvc-_fCd4,4731
5
5
  learning_credentials/exceptions.py,sha256=UaqBVXFMWR2Iob7_LMb3j4NNVmWQFAgLi_MNMRUvGsI,290
6
- learning_credentials/generators.py,sha256=W13x_pyT-MBjuA1cQmLyB4r5al26fcRczr9LVm54HU8,14748
6
+ learning_credentials/generators.py,sha256=pXxIM5GW8bmZVqMFf37wTYLh7L_Oa0pYcUK_N09xFCU,15052
7
7
  learning_credentials/models.py,sha256=J_SCNiu42yhdi12eDMLsxNCTkJK7_vqneQjyGYG5KJ4,16048
8
8
  learning_credentials/processors.py,sha256=LkdjmkLBnXc9qeMcksB1T8AQ5ZhYaECyQO__KfHB_aU,15212
9
9
  learning_credentials/tasks.py,sha256=byoFEUvN_ayVaU5K5SlEiA7vu9BRPaSSmKnB9g5toec,1927
@@ -32,9 +32,9 @@ learning_credentials/templates/learning_credentials/edx_ace/certificate_generate
32
32
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt,sha256=-n8tjPSwfwAfeOSZ1WhcCTrpOah4VswzMZ5mh63Pxow,20
33
33
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt,sha256=S7Hc5T_sZSsSBXm5_H5HBNNv16Ohl0oZn0nVqqeWL0g,132
35
- learning_credentials-0.4.1rc1.dist-info/licenses/LICENSE.txt,sha256=GDpsPnW_1NKhPvZpZL9imz25P2nIpbwJPEhrlq4vPAU,34523
36
- learning_credentials-0.4.1rc1.dist-info/METADATA,sha256=9S3cVn3gKjMbsbU9OHiPdoX3kMP26V-rjftyl03vtfk,8258
37
- learning_credentials-0.4.1rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- learning_credentials-0.4.1rc1.dist-info/entry_points.txt,sha256=hHqqLUEdzAN24v5OGBX9Fr-wh3ATDPjQjByKz03eC2Y,91
39
- learning_credentials-0.4.1rc1.dist-info/top_level.txt,sha256=Ce-4_leZe_nny7CpmkeRiemcDV6jIHpIvLjlcQBuf18,21
40
- learning_credentials-0.4.1rc1.dist-info/RECORD,,
35
+ learning_credentials-0.4.1rc3.dist-info/licenses/LICENSE.txt,sha256=GDpsPnW_1NKhPvZpZL9imz25P2nIpbwJPEhrlq4vPAU,34523
36
+ learning_credentials-0.4.1rc3.dist-info/METADATA,sha256=QthOvxG-G77c1pR_MyV82enEqzeOoebI3tuQ1x7d65E,8258
37
+ learning_credentials-0.4.1rc3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ learning_credentials-0.4.1rc3.dist-info/entry_points.txt,sha256=hHqqLUEdzAN24v5OGBX9Fr-wh3ATDPjQjByKz03eC2Y,91
39
+ learning_credentials-0.4.1rc3.dist-info/top_level.txt,sha256=Ce-4_leZe_nny7CpmkeRiemcDV6jIHpIvLjlcQBuf18,21
40
+ learning_credentials-0.4.1rc3.dist-info/RECORD,,