Edgewall Software
Modify

Ticket #5099 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Remaining issues with Genshi post-509

Reported by: eblot Owned by: jonas
Priority: high Milestone: 0.11
Component: general Version: devel
Severity: normal Keywords: genshi
Cc: trac@…
Release Notes:
API Changes:

Description

I'm not sure this is the right way to proceed (feel free to close this ticket if it isn't), but there are some remaining issues with the current trunk and Genshi, so rather than opening one ticket per encountered issue, I'll post the description of several of them within the same ticket.

Attachments

Change History

comment:1 follow-ups: Changed 5 years ago by eblot

with [5187], Genshi 532

File "/local/engine/trac/trac/templates/diff_div.html", line 91, in <Expression u'longcol'>
  <th title="$longcol $item.old.rev">

This error occurs while attempting to review a wiki change.

comment:2 Changed 5 years ago by eblot

Another issue while previewing a wiki page: NameError with 'diff'.

The following patch seems to fix up the issue (although I'm not confident in it and won't commit it…):

  • wiki/templates/wiki_edit.html

     
    4646            </tbody> 
    4747          </table> 
    4848          <fieldset id="preview" py:choose=""> 
    49             <legend>${diff and 'Review Changes' or 'Preview'} (<a href="#edit">skip</a>)</legend> 
    50             <div py:when="diff" class="diff"> 
     49            <legend>${'diff' in req.args and 'Review Changes' or 'Preview'} (<a href="#edit">skip</a>)</legend> 
     50            <div py:when="'diff' in req.args" class="diff"> 
    5151              <xi:include href="diff_div.html" py:with="no_id=True" /> 
    5252            </div> 
    5353            <div py:otherwise="" class="wikipage">${wiki_to_html(context, page.text)}</div> 

comment:3 Changed 5 years ago by eblot

When an attachment cannot be previewed

  • trac/templates/macros.html

     
    128128  - 
    129129  --> 
    130130  <py:def function="preview_file(preview)"> 
     131    <py:if test="'rendered' in preview"> 
    131132    ${preview.rendered} 
     133    </py:if> 
    132134    <py:choose> 
    133       <p py:when="not preview.rendered"> 
     135      <p py:when="'rendered' not in preview"> 
    134136        <strong>HTML preview not available</strong>, 
    135137        <py:choose> 
    136138          <py:when test="preview.max_file_size_reached"> 

comment:4 in reply to: ↑ 1 ; follow-up: Changed 5 years ago by eblot

Replying to eblot:

Another diff rendering issue occurs while viewing changeset changes.

data['no_id'] = ...

is not defined in changeset.py

comment:5 Changed 5 years ago by eblot

Another small issue when attempting to add a new milestone (milestones is not defined)

  • trac/ticket/templates/milestone_edit.html

     
    6666                     value="${format_date(milestone.completed) or format_date}" /> 
    6767              <em>Format: ${datetime_hint}</em> 
    6868            </label> 
    69             <py:if test="milestones"> 
     69            <py:if test="defined('milestones')"> 
    7070              <br/> 
    7171              <input type="checkbox" id="retarget" name="retarget" checked="checked" /> 
    7272              <label>Retarget associated open tickets to milestone: 

comment:6 Changed 5 years ago by anonymous

  • Cc trac@… added

comment:7 in reply to: ↑ 1 Changed 5 years ago by cboos

Replying to eblot:

This error occurs while attempting to review a wiki change.

Fixed in r5192.

comment:8 in reply to: ↑ 4 Changed 5 years ago by cboos

Replying to eblot:

Another diff rendering issue occurs while viewing changeset changes.

Also fixed in r5192.

comment:9 follow-up: Changed 5 years ago by cboos

  • Keywords genshi added

Remaining issues fixed in r5193. Not closing the ticket though, as there are likely more issues with this.

In general for the fixes, we shouldn't use defined(), as it was only defined itself since [Genshi 510] and we want to retain compatibility with [Genshi 509].
I also tend to favor setting up the correct default values in the model, rather than making the templates look ugly (i.e. using the .get('...') calls).

comment:10 in reply to: ↑ 9 Changed 5 years ago by eblot

Replying to cboos:

In general for the fixes, we shouldn't use defined(), as it was only defined itself since [Genshi 510] and we want to retain compatibility with [Genshi 509].

Ok, I did not know that and I'll look at your changes to understand how to write clean fixes.

comment:11 follow-up: Changed 5 years ago by eblot

  • Error when some fields have been changed but no comment has been added to a ticket
    • ticket.html

       
      216216                    </py:choose> 
      217217                  </li> 
      218218                </ul> 
      219                 <div py:if="change.comment" class="comment searchable"> 
       219                <div py:if="'comment' in change" class="comment searchable"> 
      220220                  ${wiki_to_html(context, change.comment)} 
      221221                </div> 
      222222              </div> 

comment:12 follow-up: Changed 5 years ago by eblot

Error with any ticket that does not contain a value for a custom field.
This is the case for tickets that have not been edited after new custom field is added to the configuration file.

UndefinedError is triggered on source:trunk/trac/ticket/templates/ticket.html@5178#L119

   <py:if test="field">${ticket[field.name]}</py:if>

comment:13 follow-up: Changed 5 years ago by eblot

I'm not sure about how to reproduce this one, anyway:

UndefinedError is triggered on source:trunk/trac/ticket/templates/ticket.html@5178#L164

 <span class="threading" py:if="replies and 'cnum' in change"
  py:with="change_replies = replies[str(change.cnum)]">

It seems that the replies array contains unicode keys, as a typical error is

UndefinedError: {u'2': [3]} has no member named "1"

comment:14 Changed 5 years ago by eblot

When a new ticket is created then updated with the following actions:

  1. status is changed
  2. a file is attached

next rendering of the ticket triggers a UndefinedError on source:trunk/trac/ticket/templates/ticket.html@5178#L191

  <ul py:if="change.fields" class="changes">
    <li py:for="field_name, field in change.fields.items()"
        py:with="filed_type = field_types[field_name]">
      <strong>${field_name}</strong>
UndefinedError: {'status': 'radio', [...]} has no member named "attachment"

comment:15 in reply to: ↑ 12 Changed 5 years ago by cboos

Replying to eblot:

Error with any ticket that does not contain a value for a custom field.
This is the case for tickets that have not been edited after new custom field is added to the configuration file.

Fixed in r5197.

comment:16 in reply to: ↑ 13 Changed 5 years ago by cboos

Replying to eblot:

I'm not sure about how to reproduce this one

comment threading issues fixed in r5198.

comment:17 in reply to: ↑ 11 Changed 5 years ago by cboos

  • Priority changed from normal to high

Replying to eblot:

  • Error when some fields have been changed but no comment has been added to a ticket

Replying to such changes also triggered an error, fixed by r5212.

comment:18 Changed 5 years ago by cboos

  • Resolution set to fixed
  • Status changed from new to closed

Looks like we're done with all those little issues.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.