Subject: [xml2rfc] #190: Exception thrown

From: "xml2rfc issue tracker" <[email-masked]>
Date: Fri, 19 Jul 2013 16:22:30 -0000

#190: Exception thrown

 I'm trying to generate a txt file from of my XML. I'm using the on-line
 version from xml.resource.org. It is 2.4.2. I get an empty txt file. To
 see the error, I used "Use frames to show warnings & errors".

 The errors list ends up with the following:
 Traceback (most recent call last):
   File "/usr/local/bin/xml2rfc", line 224, in <module>
     main()
   File "/usr/local/bin/xml2rfc", line 209, in main
     pagedwriter.write(filename)
   File "/usr/local/lib/python2.7/dist-packages/xml2rfc/writers/base.py",
 line 1088, in write
     self.post_rendering()
   File "/usr/local/lib/python2.7/dist-
 packages/xml2rfc/writers/paginated_txt.py", line 286, in post_rendering
     self.emit([''] * remainder)
   File "/usr/local/lib/python2.7/dist-
 packages/xml2rfc/writers/paginated_txt.py", line 164, in emit
     if self.page_length == 1 and text.strip() == '':
 AttributeError: 'list' object has no attribute 'strip'

 XML that causes that issue is attached. It generates on the old xml2rfc.

-- 
----------------------------------------+----------------------------------
 Reporter:  [email-masked]  |      Owner:  [email-masked]
     Type:  defect                      |     Status:  new
 Priority:  medium                      |  Milestone:
Component:  Version 2 cli               |    Version:  2.4.x
 Keywords:                              |
----------------------------------------+----------------------------------

Ticket URL: <http://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/190>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Fri, 19 Jul 2013 16:23:16 -0000

#190: Exception thrown when generating txt from xml

-- 
-----------------------------------------+---------------------------------
  Reporter:  [email-masked]  |      Owner:
      Type:  defect                      |  [email-masked]
  Priority:  medium                      |     Status:  new
 Component:  Version 2 cli               |  Milestone:
Resolution:                              |    Version:  2.4.x
                                         |   Keywords:
-----------------------------------------+---------------------------------

Ticket URL: <http://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/190#comment:1>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Fri, 19 Jul 2013 16:24:27 -0000

Comment (by [email-masked]):

 Minor correction: "It generates on the old xml2rfc." => "It generates ok
 on the old xml2rfc (http://xml.resource.org/old.html)."

Ticket URL: <http://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/190#comment:2>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Fri, 19 Jul 2013 18:17:18 -0000

Comment (by [email-masked]):

 Not held back with actually domain specific knowledge, the following patch
 does seems to fix your problem:

 {{{
 --- /usr/lib/python2.7/dist-packages/xml2rfc/writers/paginated_txt.py
 2013-07-19 19:14:19.515681204 +0100
 +++ /tmp/paginated_txt.py       2013-07-19 19:14:15.247681168 +0100
 @@ -161,7 +161,7 @@
      def emit(self, text):
          """Write text to the output buffer if it's not just a blank
             line at the top of the page"""
 -        if self.page_length == 1 and text.strip() == '':
 +        if self.page_length == 1 and not isinstance(text, list) and
 text.strip() == '':
              return
          if isinstance(text, basestring):
              self.output.append(text)
 }}}

Ticket URL: <http://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/190#comment:3>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: Elwyn Davies <[email-masked]>
Date: Fri, 19 Jul 2013 20:33:32 +0100

Hi, Henrik.

I suspect this will also fix #187 which barfed at the same place.

/Elwyn

---

From: Henrik Levkowetz <[email-masked]>
Date: Sat, 20 Jul 2013 01:45:03 +0200

Hi Elwyn,

> I suspect this will also fix #187 which barfed at the same place.

Yes, I had the same thought.  I hope to have time to take care of this
and a number of other bugs during next week.

Best regards,

	Henrik