FossilRepo
Fix ticket_edit template: replace invalid .split calls with hardcoded options; fix empty username in comment links
Commit
9a137565a3abf4d9c39c53221cfa2060df755f7a24c9c4165d625dddb06c08b1
Parent
61b374dbcd1a718…
2 files changed
-12
+24
-15
-12
| --- fossil/views.py | ||
| +++ fossil/views.py | ||
| @@ -1388,22 +1388,10 @@ | ||
| 1388 | 1388 | ) |
| 1389 | 1389 | |
| 1390 | 1390 | |
| 1391 | 1391 | @login_required |
| 1392 | 1392 | def ticket_edit(request, slug, ticket_uuid): |
| 1393 | - try: | |
| 1394 | - return _ticket_edit_inner(request, slug, ticket_uuid) | |
| 1395 | - except Exception: | |
| 1396 | - import traceback | |
| 1397 | - | |
| 1398 | - with open("/tmp/fossilrepo_ticket_edit_error.log", "a") as f: | |
| 1399 | - f.write(f"\n--- {ticket_uuid} ---\n") | |
| 1400 | - traceback.print_exc(file=f) | |
| 1401 | - raise | |
| 1402 | - | |
| 1403 | - | |
| 1404 | -def _ticket_edit_inner(request, slug, ticket_uuid): | |
| 1405 | 1393 | project, fossil_repo, reader = _get_repo_and_reader(slug, request, "write") |
| 1406 | 1394 | |
| 1407 | 1395 | from fossil.ticket_fields import TicketFieldDefinition |
| 1408 | 1396 | |
| 1409 | 1397 | try: |
| 1410 | 1398 |
| --- fossil/views.py | |
| +++ fossil/views.py | |
| @@ -1388,22 +1388,10 @@ | |
| 1388 | ) |
| 1389 | |
| 1390 | |
| 1391 | @login_required |
| 1392 | def ticket_edit(request, slug, ticket_uuid): |
| 1393 | try: |
| 1394 | return _ticket_edit_inner(request, slug, ticket_uuid) |
| 1395 | except Exception: |
| 1396 | import traceback |
| 1397 | |
| 1398 | with open("/tmp/fossilrepo_ticket_edit_error.log", "a") as f: |
| 1399 | f.write(f"\n--- {ticket_uuid} ---\n") |
| 1400 | traceback.print_exc(file=f) |
| 1401 | raise |
| 1402 | |
| 1403 | |
| 1404 | def _ticket_edit_inner(request, slug, ticket_uuid): |
| 1405 | project, fossil_repo, reader = _get_repo_and_reader(slug, request, "write") |
| 1406 | |
| 1407 | from fossil.ticket_fields import TicketFieldDefinition |
| 1408 | |
| 1409 | try: |
| 1410 |
| --- fossil/views.py | |
| +++ fossil/views.py | |
| @@ -1388,22 +1388,10 @@ | |
| 1388 | ) |
| 1389 | |
| 1390 | |
| 1391 | @login_required |
| 1392 | def ticket_edit(request, slug, ticket_uuid): |
| 1393 | project, fossil_repo, reader = _get_repo_and_reader(slug, request, "write") |
| 1394 | |
| 1395 | from fossil.ticket_fields import TicketFieldDefinition |
| 1396 | |
| 1397 | try: |
| 1398 |
+24
-15
| --- templates/fossil/ticket_edit.html | ||
| +++ templates/fossil/ticket_edit.html | ||
| @@ -23,50 +23,59 @@ | ||
| 23 | 23 | |
| 24 | 24 | <div class="grid grid-cols-2 gap-4"> |
| 25 | 25 | <div> |
| 26 | 26 | <label class="block text-sm font-medium text-gray-300 mb-1">Status</label> |
| 27 | 27 | <select name="status" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 28 | - {% for s in "Open,Fixed,Closed,Review,Deferred".split %} | |
| 29 | - <option value="{{ s }}" {% if s == ticket.status %}selected{% endif %}>{{ s }}</option> | |
| 30 | - {% endfor %} | |
| 28 | + <option value="Open" {% if ticket.status == "Open" %}selected{% endif %}>Open</option> | |
| 29 | + <option value="Fixed" {% if ticket.status == "Fixed" %}selected{% endif %}>Fixed</option> | |
| 30 | + <option value="Closed" {% if ticket.status == "Closed" %}selected{% endif %}>Closed</option> | |
| 31 | + <option value="Review" {% if ticket.status == "Review" %}selected{% endif %}>Review</option> | |
| 32 | + <option value="Deferred" {% if ticket.status == "Deferred" %}selected{% endif %}>Deferred</option> | |
| 31 | 33 | </select> |
| 32 | 34 | </div> |
| 33 | 35 | <div> |
| 34 | 36 | <label class="block text-sm font-medium text-gray-300 mb-1">Type</label> |
| 35 | 37 | <select name="type" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 36 | - {% for t in "Code_Defect,Feature_Request,Documentation,Incident".split %} | |
| 37 | - <option value="{{ t }}" {% if t == ticket.type %}selected{% endif %}>{{ t }}</option> | |
| 38 | - {% endfor %} | |
| 38 | + <option value="Code_Defect" {% if ticket.type == "Code_Defect" %}selected{% endif %}>Code Defect</option> | |
| 39 | + <option value="Feature_Request" {% if ticket.type == "Feature_Request" %}selected{% endif %}>Feature Request</option> | |
| 40 | + <option value="Documentation" {% if ticket.type == "Documentation" %}selected{% endif %}>Documentation</option> | |
| 41 | + <option value="Incident" {% if ticket.type == "Incident" %}selected{% endif %}>Incident</option> | |
| 39 | 42 | </select> |
| 40 | 43 | </div> |
| 41 | 44 | <div> |
| 42 | 45 | <label class="block text-sm font-medium text-gray-300 mb-1">Severity</label> |
| 43 | 46 | <select name="severity" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 44 | 47 | <option value="">—</option> |
| 45 | - {% for s in "Critical,Important,Minor,Cosmetic".split %} | |
| 46 | - <option value="{{ s }}" {% if s == ticket.severity %}selected{% endif %}>{{ s }}</option> | |
| 47 | - {% endfor %} | |
| 48 | + <option value="Critical" {% if ticket.severity == "Critical" %}selected{% endif %}>Critical</option> | |
| 49 | + <option value="Important" {% if ticket.severity == "Important" %}selected{% endif %}>Important</option> | |
| 50 | + <option value="Minor" {% if ticket.severity == "Minor" %}selected{% endif %}>Minor</option> | |
| 51 | + <option value="Cosmetic" {% if ticket.severity == "Cosmetic" %}selected{% endif %}>Cosmetic</option> | |
| 48 | 52 | </select> |
| 49 | 53 | </div> |
| 50 | 54 | <div> |
| 51 | 55 | <label class="block text-sm font-medium text-gray-300 mb-1">Priority</label> |
| 52 | 56 | <select name="priority" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 53 | 57 | <option value="">—</option> |
| 54 | - {% for p in "Critical,Important,Minor,Zero".split %} | |
| 55 | - <option value="{{ p }}" {% if p == ticket.priority %}selected{% endif %}>{{ p }}</option> | |
| 56 | - {% endfor %} | |
| 58 | + <option value="Critical" {% if ticket.priority == "Critical" %}selected{% endif %}>Critical</option> | |
| 59 | + <option value="Important" {% if ticket.priority == "Important" %}selected{% endif %}>Important</option> | |
| 60 | + <option value="Minor" {% if ticket.priority == "Minor" %}selected{% endif %}>Minor</option> | |
| 61 | + <option value="Zero" {% if ticket.priority == "Zero" %}selected{% endif %}>Zero</option> | |
| 57 | 62 | </select> |
| 58 | 63 | </div> |
| 59 | 64 | </div> |
| 60 | 65 | |
| 61 | 66 | <div> |
| 62 | 67 | <label class="block text-sm font-medium text-gray-300 mb-1">Resolution</label> |
| 63 | 68 | <select name="resolution" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 64 | 69 | <option value="">—</option> |
| 65 | - {% for r in "Fixed,Rejected,Overcome_By_Events,Works_As_Designed,Unable_To_Reproduce,Not_A_Bug,Duplicate".split %} | |
| 66 | - <option value="{{ r }}" {% if r == ticket.resolution %}selected{% endif %}>{{ r }}</option> | |
| 67 | - {% endfor %} | |
| 70 | + <option value="Fixed" {% if ticket.resolution == "Fixed" %}selected{% endif %}>Fixed</option> | |
| 71 | + <option value="Rejected" {% if ticket.resolution == "Rejected" %}selected{% endif %}>Rejected</option> | |
| 72 | + <option value="Overcome_By_Events" {% if ticket.resolution == "Overcome_By_Events" %}selected{% endif %}>Overcome By Events</option> | |
| 73 | + <option value="Works_As_Designed" {% if ticket.resolution == "Works_As_Designed" %}selected{% endif %}>Works As Designed</option> | |
| 74 | + <option value="Unable_To_Reproduce" {% if ticket.resolution == "Unable_To_Reproduce" %}selected{% endif %}>Unable To Reproduce</option> | |
| 75 | + <option value="Not_A_Bug" {% if ticket.resolution == "Not_A_Bug" %}selected{% endif %}>Not A Bug</option> | |
| 76 | + <option value="Duplicate" {% if ticket.resolution == "Duplicate" %}selected{% endif %}>Duplicate</option> | |
| 68 | 77 | </select> |
| 69 | 78 | </div> |
| 70 | 79 | |
| 71 | 80 | {% if custom_fields %} |
| 72 | 81 | <div class="border-t border-gray-700 pt-4 mt-4"> |
| 73 | 82 |
| --- templates/fossil/ticket_edit.html | |
| +++ templates/fossil/ticket_edit.html | |
| @@ -23,50 +23,59 @@ | |
| 23 | |
| 24 | <div class="grid grid-cols-2 gap-4"> |
| 25 | <div> |
| 26 | <label class="block text-sm font-medium text-gray-300 mb-1">Status</label> |
| 27 | <select name="status" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 28 | {% for s in "Open,Fixed,Closed,Review,Deferred".split %} |
| 29 | <option value="{{ s }}" {% if s == ticket.status %}selected{% endif %}>{{ s }}</option> |
| 30 | {% endfor %} |
| 31 | </select> |
| 32 | </div> |
| 33 | <div> |
| 34 | <label class="block text-sm font-medium text-gray-300 mb-1">Type</label> |
| 35 | <select name="type" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 36 | {% for t in "Code_Defect,Feature_Request,Documentation,Incident".split %} |
| 37 | <option value="{{ t }}" {% if t == ticket.type %}selected{% endif %}>{{ t }}</option> |
| 38 | {% endfor %} |
| 39 | </select> |
| 40 | </div> |
| 41 | <div> |
| 42 | <label class="block text-sm font-medium text-gray-300 mb-1">Severity</label> |
| 43 | <select name="severity" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 44 | <option value="">—</option> |
| 45 | {% for s in "Critical,Important,Minor,Cosmetic".split %} |
| 46 | <option value="{{ s }}" {% if s == ticket.severity %}selected{% endif %}>{{ s }}</option> |
| 47 | {% endfor %} |
| 48 | </select> |
| 49 | </div> |
| 50 | <div> |
| 51 | <label class="block text-sm font-medium text-gray-300 mb-1">Priority</label> |
| 52 | <select name="priority" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 53 | <option value="">—</option> |
| 54 | {% for p in "Critical,Important,Minor,Zero".split %} |
| 55 | <option value="{{ p }}" {% if p == ticket.priority %}selected{% endif %}>{{ p }}</option> |
| 56 | {% endfor %} |
| 57 | </select> |
| 58 | </div> |
| 59 | </div> |
| 60 | |
| 61 | <div> |
| 62 | <label class="block text-sm font-medium text-gray-300 mb-1">Resolution</label> |
| 63 | <select name="resolution" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 64 | <option value="">—</option> |
| 65 | {% for r in "Fixed,Rejected,Overcome_By_Events,Works_As_Designed,Unable_To_Reproduce,Not_A_Bug,Duplicate".split %} |
| 66 | <option value="{{ r }}" {% if r == ticket.resolution %}selected{% endif %}>{{ r }}</option> |
| 67 | {% endfor %} |
| 68 | </select> |
| 69 | </div> |
| 70 | |
| 71 | {% if custom_fields %} |
| 72 | <div class="border-t border-gray-700 pt-4 mt-4"> |
| 73 |
| --- templates/fossil/ticket_edit.html | |
| +++ templates/fossil/ticket_edit.html | |
| @@ -23,50 +23,59 @@ | |
| 23 | |
| 24 | <div class="grid grid-cols-2 gap-4"> |
| 25 | <div> |
| 26 | <label class="block text-sm font-medium text-gray-300 mb-1">Status</label> |
| 27 | <select name="status" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 28 | <option value="Open" {% if ticket.status == "Open" %}selected{% endif %}>Open</option> |
| 29 | <option value="Fixed" {% if ticket.status == "Fixed" %}selected{% endif %}>Fixed</option> |
| 30 | <option value="Closed" {% if ticket.status == "Closed" %}selected{% endif %}>Closed</option> |
| 31 | <option value="Review" {% if ticket.status == "Review" %}selected{% endif %}>Review</option> |
| 32 | <option value="Deferred" {% if ticket.status == "Deferred" %}selected{% endif %}>Deferred</option> |
| 33 | </select> |
| 34 | </div> |
| 35 | <div> |
| 36 | <label class="block text-sm font-medium text-gray-300 mb-1">Type</label> |
| 37 | <select name="type" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 38 | <option value="Code_Defect" {% if ticket.type == "Code_Defect" %}selected{% endif %}>Code Defect</option> |
| 39 | <option value="Feature_Request" {% if ticket.type == "Feature_Request" %}selected{% endif %}>Feature Request</option> |
| 40 | <option value="Documentation" {% if ticket.type == "Documentation" %}selected{% endif %}>Documentation</option> |
| 41 | <option value="Incident" {% if ticket.type == "Incident" %}selected{% endif %}>Incident</option> |
| 42 | </select> |
| 43 | </div> |
| 44 | <div> |
| 45 | <label class="block text-sm font-medium text-gray-300 mb-1">Severity</label> |
| 46 | <select name="severity" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 47 | <option value="">—</option> |
| 48 | <option value="Critical" {% if ticket.severity == "Critical" %}selected{% endif %}>Critical</option> |
| 49 | <option value="Important" {% if ticket.severity == "Important" %}selected{% endif %}>Important</option> |
| 50 | <option value="Minor" {% if ticket.severity == "Minor" %}selected{% endif %}>Minor</option> |
| 51 | <option value="Cosmetic" {% if ticket.severity == "Cosmetic" %}selected{% endif %}>Cosmetic</option> |
| 52 | </select> |
| 53 | </div> |
| 54 | <div> |
| 55 | <label class="block text-sm font-medium text-gray-300 mb-1">Priority</label> |
| 56 | <select name="priority" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 57 | <option value="">—</option> |
| 58 | <option value="Critical" {% if ticket.priority == "Critical" %}selected{% endif %}>Critical</option> |
| 59 | <option value="Important" {% if ticket.priority == "Important" %}selected{% endif %}>Important</option> |
| 60 | <option value="Minor" {% if ticket.priority == "Minor" %}selected{% endif %}>Minor</option> |
| 61 | <option value="Zero" {% if ticket.priority == "Zero" %}selected{% endif %}>Zero</option> |
| 62 | </select> |
| 63 | </div> |
| 64 | </div> |
| 65 | |
| 66 | <div> |
| 67 | <label class="block text-sm font-medium text-gray-300 mb-1">Resolution</label> |
| 68 | <select name="resolution" class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
| 69 | <option value="">—</option> |
| 70 | <option value="Fixed" {% if ticket.resolution == "Fixed" %}selected{% endif %}>Fixed</option> |
| 71 | <option value="Rejected" {% if ticket.resolution == "Rejected" %}selected{% endif %}>Rejected</option> |
| 72 | <option value="Overcome_By_Events" {% if ticket.resolution == "Overcome_By_Events" %}selected{% endif %}>Overcome By Events</option> |
| 73 | <option value="Works_As_Designed" {% if ticket.resolution == "Works_As_Designed" %}selected{% endif %}>Works As Designed</option> |
| 74 | <option value="Unable_To_Reproduce" {% if ticket.resolution == "Unable_To_Reproduce" %}selected{% endif %}>Unable To Reproduce</option> |
| 75 | <option value="Not_A_Bug" {% if ticket.resolution == "Not_A_Bug" %}selected{% endif %}>Not A Bug</option> |
| 76 | <option value="Duplicate" {% if ticket.resolution == "Duplicate" %}selected{% endif %}>Duplicate</option> |
| 77 | </select> |
| 78 | </div> |
| 79 | |
| 80 | {% if custom_fields %} |
| 81 | <div class="border-t border-gray-700 pt-4 mt-4"> |
| 82 |