Edgewall Software

Opened 17 years ago

Closed 17 years ago

#141 closed defect (wontfix)

A generator cannot be resumed while it is actively running

Reported by: banesiu.sever@… Owned by: cmlenz
Priority: minor Milestone:
Component: General Version: 0.4.2
Keywords: Cc:

Description

There are at least 2 generator errors:

>>> from genshi.builder import Element
>>> e = Element('p')
>>> e(e)
<Element "p">
>>> print e
Traceback (most recent call last):
>>> from genshi.builder import Element
>>> e = Element('p')
>>> s = e.generate()
>>> e(s)
<Element "p">
>>> print e
Traceback (most recent call last):

Change History (4)

comment:1 Changed 17 years ago by cmlenz

Do you have a real-world case where this happens? Looks like wrong use of the API to me.

comment:2 Changed 17 years ago by anonymous

Why is it a wrong use of the API? If you can append a fragment to another one why is it wrong to append the same fragment to itself? If you have a fragment that you want to repeat multiple times, why build the same fragment multiple times when you can build it once and append it to itself?

comment:3 Changed 17 years ago by mgood

Fragments can be repeated, that's not a problem:

>>> d = Element('div')(Element('p'))
>>> print d + d
<div><p/></div><div><p/></div>

Adding an element as a child of itself becomes recursive, so I don't think there's a reasonable way to handle this, nor a good reason to do so.

comment:4 Changed 17 years ago by cmlenz

  • Milestone 0.5 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing this based on previous comments by Matt and myself.

Note: See TracTickets for help on using tickets.