Package: python-licosmamo
Version: 1.0-2
Severity: normal

Hi,

I was glad to find that you already wrote some code to parse through a .newsrc
file in Python (saved me the hassle), but I found that it didn't work for some
.newsrc files that tin or slrn (I forget which client exactly) automatically
generated for me.

The problem is when I have a line with a ":" or "!", but no article numbers.

The "self.add(int(item))" line of the NewsrcSet.parse_and_add() function
will try to make an integer out of an empty string, which results in an
exception.  

Here's a quick fix:

    def parse_and_add(self, line):
        """Parse textual output and add the integers to the set"""
        for item in [item.strip() for item in line.split(",")]:
            if "-" in item:
                (a, b) = item.split("-")
                self.add_range(int(a), int(b))
            elif item != "":
                self.add(int(item))

That just changes the "else" to an "elif" clause, but I'll leave it to you to
decide on what's satisfyingly robust.  In the meantime, I'll just subclass
Newsrc and override parse_and_add().

Regards,
Sukant Hajra


-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (90, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-hole
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages python-licosmamo depends on:
ii  python-support                0.5.4      automated rebuilding support for p

python-licosmamo recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to