view AddFeed.py @ 211:1ac0b8e2feae

wrap the individual feed update with an exception handler so that a sinlge broken feed doesn't halt the entire update process
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 12 Nov 2012 08:10:40 +0100
parents 862760b161b4
children bb3c851b18b1
line wrap: on
line source


from PyQt4 import QtGui
from Ui_AddFeed import Ui_AddFeed
import logging

class AddFeed(QtGui.QDialog):
    def __init__(self, backend=None):
        QtGui.QWidget.__init__(self, None)
        self.backend = backend
        self.exception = None
        self.ui = Ui_AddFeed()
        self.ui.setupUi(self)
        self.ui.url.setFocus()

    def accept(self):
        try:
            url = self.getUrl()
            self.backend.createFeed(url)
        except AttributeError as ae:
            logging.getLogger("AddFeed").info(ae)
            self.exception = ae       
        QtGui.QDialog.accept(self)

    def getUrl(self):
        text = self.ui.url.text()
        # the content of a QLineEdit is a QString, convert it to a Python string
        return str(text)