Edgewall Software

Ticket #254 (assigned defect)

Opened 11 months ago

Last modified 6 weeks ago

Genshi since 0.5.1 produces duplicated items in py:match

Reported by: felix.schwarz@… Owned by: cmlenz
Priority: critical Milestone: 0.5.2
Component: Template processing Version: 0.5.1
Keywords: Cc:

Description

Since the update to Genshi 0.5.1 the content from most of our py:match directives appears twice in the output. This happens on all platforms (Linux, Windows). I verified that this is still a problem in the current 0.5 stable branch (r908).

Attachments

test_duplicated_item.py Download (1.1 KB) - added by felix.schwarz@… 11 months ago.
This is a test case for the described problem (can reproduce it with the current 0.6 trunk, too)
test_no_match_with_single_slash.py Download (1.3 KB) - added by felix.schwarz@… 11 months ago.
Actually, I found another problem in our code which was caused by the mentioned commits. However, for this second problem there is a workaround by using //h1 as match expression (see the second testcase)
duplicated_item.JPG Download (11.0 KB) - added by didley@… 9 months ago.
Screenshot

Change History

Changed 11 months ago by felix.schwarz@…

This is a test case for the described problem (can reproduce it with the current 0.6 trunk, too)

  Changed 11 months ago by felix.schwarz@…

The change of behavior was introduced in r884, r885.

Changed 11 months ago by felix.schwarz@…

Actually, I found another problem in our code which was caused by the mentioned commits. However, for this second problem there is a workaround by using //h1 as match expression (see the second testcase)

  Changed 11 months ago by felix.schwarz@…

Ok, I found a workaround for us now: The duplication test case does pass if the first py:match (which is essentially '<div py:match="div">') is modified to use '<div py:match="body//div">'.

So it's essentially the same workaround as for the "no match" test case.

  Changed 11 months ago by felix.schwarz@…

Sometimes I had to resort to something like '*/div'. For now this is okay with us but it seems to be very fragile so we are eager to see a real fix for this.

  Changed 11 months ago by cmlenz

  • status changed from new to assigned

I'm too tired for grokking the details of what's going on here, but here two simple options for fixing the first example you posted:

  • The once="true" attribute can only be used when py:match is used as an element. In your example, it's simply ignored and passed on through into the output. If you make that match template a <py:match> example, the duplication goes away.
  • Moving the first match template after the other two match templates also gets rid of the duplication.

  Changed 11 months ago by felix.schwarz@…

Thanks for looking at this. Unfortunately, we can't change the order of the py:match directives as we're re-using some trac templates and all these py:matches originate from trac. Only the last one with the wrong 'py:match' is ours.

  Changed 9 months ago by didley@…

I'm using 0.5.2dev and I got this in my admin panel

Screenshot

Could be it's the same reason.

didley

Changed 9 months ago by didley@…

Screenshot

follow-up: ↓ 8   Changed 2 months ago by stromnov@…

Is it fixed in 0.6dev branch?

in reply to: ↑ 7   Changed 6 weeks ago by Felix Schwarz <felix.schwarz@…>

No, both tests still fail for trunk (as of r1059).

Add/Change #254 (Genshi since 0.5.1 produces duplicated items in py:match)

Author


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


Change Properties
<Author field>
Action
as assigned
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.