canvaslms 5.8__py3-none-any.whl → 5.9__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.
@@ -1338,7 +1338,8 @@ content, accept it (which triggers the update), edit further, or discard changes
1338
1338
  title = attributes.get('name', assignment.name)
1339
1339
  result = canvaslms.cli.content.interactive_confirm_and_edit(
1340
1340
  title, body_content, attributes,
1341
- canvaslms.cli.content.ASSIGNMENT_SCHEMA, "Assignment")
1341
+ canvaslms.cli.content.ASSIGNMENT_SCHEMA, "Assignment",
1342
+ content_attr='description')
1342
1343
 
1343
1344
  if result is None:
1344
1345
  print("Discarded changes for this assignment.", file=sys.stderr)
@@ -768,6 +768,7 @@ def assignments_edit_command(config, canvas, args):
768
768
  attributes,
769
769
  canvaslms.cli.content.ASSIGNMENT_SCHEMA,
770
770
  "Assignment",
771
+ content_attr="description",
771
772
  )
772
773
 
773
774
  if result is None:
canvaslms/cli/content.nw CHANGED
@@ -985,9 +985,14 @@ loop. Users can preview their content, choose to accept it, edit it further,
985
985
  or discard their changes.
986
986
 
987
987
  The function is generalized to work with any content type by accepting the
988
- schema for re-editing.
988
+ schema for re-editing. When the user chooses to edit again, we need to pass
989
+ the current content back to [[get_content_from_editor]]. Since that function
990
+ expects content to be stored in the attributes dictionary under a named key
991
+ (e.g., \enquote{message} for announcements, \enquote{body} for pages), we accept
992
+ a [[content_attr]] parameter specifying which key to use.
989
993
  <<interactive functions>>=
990
- def interactive_confirm_and_edit(title, message, attributes, schema, content_type="Content"):
994
+ def interactive_confirm_and_edit(title, message, attributes, schema,
995
+ content_type="Content", content_attr='message'):
991
996
  """Interactive loop for confirming or editing content.
992
997
 
993
998
  Args:
@@ -996,6 +1001,7 @@ def interactive_confirm_and_edit(title, message, attributes, schema, content_typ
996
1001
  attributes: Current attributes
997
1002
  schema: Schema for re-editing
998
1003
  content_type: Type label for display
1004
+ content_attr: Name of attribute that holds body content (for re-editing)
999
1005
 
1000
1006
  Returns:
1001
1007
  Tuple of (attributes, message), or None if cancelled
@@ -1021,7 +1027,9 @@ def interactive_confirm_and_edit(title, message, attributes, schema, content_typ
1021
1027
  if choice in ['a', 'accept']:
1022
1028
  return current_attributes, current_message
1023
1029
  elif choice in ['e', 'edit']:
1024
- result = get_content_from_editor(schema, current_attributes, current_message)
1030
+ edit_attrs = current_attributes.copy()
1031
+ edit_attrs[content_attr] = current_message
1032
+ result = get_content_from_editor(schema, edit_attrs, content_attr=content_attr)
1025
1033
  if result is None:
1026
1034
  print("Editor cancelled or failed. Keeping previous content.", file=sys.stderr)
1027
1035
  else:
canvaslms/cli/content.py CHANGED
@@ -479,7 +479,7 @@ def render_content_preview(
479
479
 
480
480
 
481
481
  def interactive_confirm_and_edit(
482
- title, message, attributes, schema, content_type="Content"
482
+ title, message, attributes, schema, content_type="Content", content_attr="message"
483
483
  ):
484
484
  """Interactive loop for confirming or editing content.
485
485
 
@@ -489,6 +489,7 @@ def interactive_confirm_and_edit(
489
489
  attributes: Current attributes
490
490
  schema: Schema for re-editing
491
491
  content_type: Type label for display
492
+ content_attr: Name of attribute that holds body content (for re-editing)
492
493
 
493
494
  Returns:
494
495
  Tuple of (attributes, message), or None if cancelled
@@ -516,8 +517,10 @@ def interactive_confirm_and_edit(
516
517
  if choice in ["a", "accept"]:
517
518
  return current_attributes, current_message
518
519
  elif choice in ["e", "edit"]:
520
+ edit_attrs = current_attributes.copy()
521
+ edit_attrs[content_attr] = current_message
519
522
  result = get_content_from_editor(
520
- schema, current_attributes, current_message
523
+ schema, edit_attrs, content_attr=content_attr
521
524
  )
522
525
  if result is None:
523
526
  print(
@@ -394,7 +394,8 @@ for course in course_list:
394
394
 
395
395
  result = canvaslms.cli.content.interactive_confirm_and_edit(
396
396
  title, message, attributes,
397
- canvaslms.cli.content.ANNOUNCEMENT_SCHEMA, "Announcement")
397
+ canvaslms.cli.content.ANNOUNCEMENT_SCHEMA, "Announcement",
398
+ content_attr='message')
398
399
  if result is None:
399
400
  print("Cancelled.", file=sys.stderr)
400
401
  sys.exit(0)
@@ -775,7 +776,8 @@ After editing, we enter the interactive confirm loop.
775
776
  title = edited_attrs.get('title', announcement.title)
776
777
  result = canvaslms.cli.content.interactive_confirm_and_edit(
777
778
  title, body_content, edited_attrs,
778
- canvaslms.cli.content.ANNOUNCEMENT_SCHEMA, "Announcement")
779
+ canvaslms.cli.content.ANNOUNCEMENT_SCHEMA, "Announcement",
780
+ content_attr='message')
779
781
 
780
782
  if result is None:
781
783
  print("Discarded changes.", file=sys.stderr)
@@ -143,6 +143,7 @@ def announce_command(config, canvas, args):
143
143
  attributes,
144
144
  canvaslms.cli.content.ANNOUNCEMENT_SCHEMA,
145
145
  "Announcement",
146
+ content_attr="message",
146
147
  )
147
148
  if result is None:
148
149
  print("Cancelled.", file=sys.stderr)
@@ -436,6 +437,7 @@ def discussions_edit_command(config, canvas, args):
436
437
  edited_attrs,
437
438
  canvaslms.cli.content.ANNOUNCEMENT_SCHEMA,
438
439
  "Announcement",
440
+ content_attr="message",
439
441
  )
440
442
 
441
443
  if result is None:
canvaslms/cli/pages.nw CHANGED
@@ -744,7 +744,8 @@ content, accept it (which triggers the update), edit further, or discard changes
744
744
  title = attributes.get('title', full_page.title)
745
745
  result = canvaslms.cli.content.interactive_confirm_and_edit(
746
746
  title, body_content, attributes,
747
- canvaslms.cli.content.PAGE_SCHEMA, "Page")
747
+ canvaslms.cli.content.PAGE_SCHEMA, "Page",
748
+ content_attr='body')
748
749
 
749
750
  if result is None:
750
751
  print("Discarded changes for this page.", file=sys.stderr)
canvaslms/cli/pages.py CHANGED
@@ -525,6 +525,7 @@ def pages_edit_command(config, canvas, args):
525
525
  attributes,
526
526
  canvaslms.cli.content.PAGE_SCHEMA,
527
527
  "Page",
528
+ content_attr="body",
528
529
  )
529
530
 
530
531
  if result is None:
canvaslms/cli/quizzes.nw CHANGED
@@ -3426,7 +3426,8 @@ def edit_quiz_interactive(quiz, requester, html_mode=False):
3426
3426
  message=body,
3427
3427
  attributes=attributes,
3428
3428
  schema=QUIZ_SCHEMA,
3429
- content_type="Quiz"
3429
+ content_type="Quiz",
3430
+ content_attr='instructions'
3430
3431
  )
3431
3432
 
3432
3433
  if result is None:
canvaslms/cli/quizzes.py CHANGED
@@ -2499,6 +2499,7 @@ def edit_quiz_interactive(quiz, requester, html_mode=False):
2499
2499
  attributes=attributes,
2500
2500
  schema=QUIZ_SCHEMA,
2501
2501
  content_type="Quiz",
2502
+ content_attr="instructions",
2502
2503
  )
2503
2504
 
2504
2505
  if result is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canvaslms
3
- Version: 5.8
3
+ Version: 5.9
4
4
  Summary: Command-line interface to Canvas LMS
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -2,30 +2,30 @@ canvaslms/Makefile,sha256=9zE09HzyU-S2B1RI72UV1S9mmqXKiE9gIn-NuhyQP08,119
2
2
  canvaslms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  canvaslms/cli/Makefile,sha256=8uQf6xKYRr_4mrYA-FnYYh7xAq7CcBvF3rbqDTNLUyY,820
4
4
  canvaslms/cli/__init__.py,sha256=KiOWz1mshRZeqQAmj_l27ZP2krgX-ta0X18Rs4KX8Ng,6515
5
- canvaslms/cli/assignments.nw,sha256=3XyaP_xl42tcMyNmmZ2Bi5vdYuRBx0jEC6Wh2Vwo7t4,54749
6
- canvaslms/cli/assignments.py,sha256=4M8cguSPBuUE7V4sjfFJ3oSL3XiGz7bfEquXFzY9TKU,38710
5
+ canvaslms/cli/assignments.nw,sha256=bgKytV48ya0cGJsuur6sIZ_V7ZvuNR1qF7qPvg1xf2U,54781
6
+ canvaslms/cli/assignments.py,sha256=gphQuMgB0H_y-w4flidu9QRPREheBtuLF8zg70-9gZs,38754
7
7
  canvaslms/cli/cache.nw,sha256=TV9nUkwSUrFyltH98uUJ-3BLXT_-yNGsilaFlbByaxU,13350
8
8
  canvaslms/cli/cache.py,sha256=EBD2YLYa7Efq_RWsDgZOf44SaUemsyPWgeYVS-eW1uk,8217
9
9
  canvaslms/cli/calendar.nw,sha256=-dN8Sx9LWGBwhq2wc3w0GjQL3ywwPKfvi9gjsRJ6qVg,22887
10
10
  canvaslms/cli/calendar.py,sha256=f8af6McSxg5G2Etf6TAxwp1cnYodlcyw7SJgcJJLBks,20898
11
11
  canvaslms/cli/canvas_calendar.py,sha256=AbA6nOZ7e-zACfAqwK1utBjuShVGsaERxIJ4xRKEUZc,22196
12
12
  canvaslms/cli/cli.nw,sha256=f3xbi1kzjVSsFzEmOS_7Pfy7nJbkYuAcR11RVqkSSsE,23675
13
- canvaslms/cli/content.nw,sha256=cFl2raYWrXJXXcjZ2cuzWIHdezUMlBypJhq95ZGEENg,36404
14
- canvaslms/cli/content.py,sha256=BXpQxhTfsNBgdRd3bz4E997gsBtPmk8_ILJqZnwEnHA,17149
13
+ canvaslms/cli/content.nw,sha256=hg_KBHAPXTGyZFMV2Y96oE3VUHaVxsY2hvJBQDDHvOA,36995
14
+ canvaslms/cli/content.py,sha256=OQiyhtwNenOZ1V0665f7p9VE9P3Zz3AX6vIzz0VqpKo,17362
15
15
  canvaslms/cli/courses.nw,sha256=W8hNE8wQYPoSRDbqdU_qFvmOFWF6mRap0NLaz-edHH0,14569
16
16
  canvaslms/cli/courses.py,sha256=XKeV43xNT1or_qv40_IATJgey2zbVEg8qHqnz-Z7qUo,3743
17
- canvaslms/cli/discussions.nw,sha256=IPavr0m43OeCsUvZVqnpSEDb9UZ_oh6IDpsAXW0wMmY,46633
18
- canvaslms/cli/discussions.py,sha256=R6GbFbHYXCa0vyDf4eegGp74Pj6WGC38MEb6kY0PkWY,40388
17
+ canvaslms/cli/discussions.nw,sha256=woTvzURp10kimseuYTZs2RTFpCKnpxCsCnDTFK_4jNI,46687
18
+ canvaslms/cli/discussions.py,sha256=fNhJlfzWLzH7Z_fP95w6Scp_ZS7R5Io7zRKQtKa68YU,40464
19
19
  canvaslms/cli/grade.nw,sha256=ms7sBiGRPbK0CJLKxxYx_CDY9LMWgKxUuf2M3FYepMs,2197
20
20
  canvaslms/cli/grade.py,sha256=b7YkFIz64oXzcV2FcptpYJphevuCU3cdx9CilZHcG_A,662
21
21
  canvaslms/cli/login.nw,sha256=93LyHO_LXL1WdEvMg3OLhWulgkdoO8pfjYZVLwUbX4I,4419
22
22
  canvaslms/cli/login.py,sha256=wbA5Q9fTsW1J-vraRcdq2kG4h_LFtvH_MTEay6h8GcE,2737
23
23
  canvaslms/cli/modules.nw,sha256=rvrZe4AU_ok955GZ_ZwwFNFIHIKzft1LR9zTVLW_gic,24122
24
24
  canvaslms/cli/modules.py,sha256=8fZpW_x7eUMUgcn8JrvbGuwtrmHsbVdNvqfcRgfF4x8,12953
25
- canvaslms/cli/pages.nw,sha256=njm6oQT22ryI8Z7O62d-qivQjbMX_je5OwhgHEvtVUg,28934
26
- canvaslms/cli/pages.py,sha256=lW8DpMeyQQoVcu7ztSj_PdW-oUJC0HSh5mDeo8BuaRc,27713
27
- canvaslms/cli/quizzes.nw,sha256=xgivQGColOzayvMn3OcxJf0V7E2K2lzindzPeBqymBw,262940
28
- canvaslms/cli/quizzes.py,sha256=1gX16Mo49rO4j98xy_j7xSuIs0E9DcOJigB90imBNR4,198225
25
+ canvaslms/cli/pages.nw,sha256=ZCv1NAwwXRzSy27ePJ3CI1ET1BBZJsM2scnoZxCW4n4,28959
26
+ canvaslms/cli/pages.py,sha256=7E6gjEfs3L6A9_c84gRHvx7auDDV7MQWUXDwQ2-dkz4,27750
27
+ canvaslms/cli/quizzes.nw,sha256=c1zco19uSt9ULIyYWqoCYgNvK4PeSfC6otUpA_b7Flg,262973
28
+ canvaslms/cli/quizzes.py,sha256=jLb1vVU7WClqaDVfXk9akgfii4X_Z5IO1FV6hEhdAAs,198262
29
29
  canvaslms/cli/results.nw,sha256=SQIiCwcQUO-irUD6-Ya-4QBVHo19uv5QHH7GXNvdrDg,26862
30
30
  canvaslms/cli/results.py,sha256=2KGcqGzmrfqc2Jj5ddQcrm33qF_DYHoljTol4qI9pSg,16845
31
31
  canvaslms/cli/results.py.broken,sha256=njHu8mKfPHqH4daxy-4LMpO6FdUBLPHiVKFFmyH8aJQ,13047
@@ -59,8 +59,8 @@ canvaslms/hacks/attachment_cache.py,sha256=LcOZqaa6jPrEJWUD-JYN5GTc3bxCbv2fr_vqu
59
59
  canvaslms/hacks/canvasapi.nw,sha256=ixmIHn4tgy-ZKtQ1rqWSw97hfY2m0qtGX0de2x89lwA,136470
60
60
  canvaslms/hacks/canvasapi.py,sha256=A-r48x7gO6143_QkuZ8n6EW66i-a2AXXr7X7oeehOAU,31868
61
61
  canvaslms/hacks/test_hacks.py,sha256=JSJNvZqHu1E_s51HsPD7yr1gC-R-xVe-tuMMAKU9Gj8,66709
62
- canvaslms-5.8.dist-info/METADATA,sha256=Xz-kANG9wsPDHQvYbkE_0HfRM1jLN3z8qhmwA0w75pM,6078
63
- canvaslms-5.8.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
64
- canvaslms-5.8.dist-info/entry_points.txt,sha256=lyblfkLbodN5yb7q1c6-rwIoJPV-ygXrB9PYb5boHXM,48
65
- canvaslms-5.8.dist-info/licenses/LICENSE,sha256=N_TKsbzzD5Ax5fWJqEQk9bkwtf394MJkNeFld4HV6-E,1074
66
- canvaslms-5.8.dist-info/RECORD,,
62
+ canvaslms-5.9.dist-info/METADATA,sha256=KADA9jxYVaKQdgBMTccpmz794RWGkw7l296vT6UvxFg,6078
63
+ canvaslms-5.9.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
64
+ canvaslms-5.9.dist-info/entry_points.txt,sha256=lyblfkLbodN5yb7q1c6-rwIoJPV-ygXrB9PYb5boHXM,48
65
+ canvaslms-5.9.dist-info/licenses/LICENSE,sha256=N_TKsbzzD5Ax5fWJqEQk9bkwtf394MJkNeFld4HV6-E,1074
66
+ canvaslms-5.9.dist-info/RECORD,,