On Fri, 2011-02-04 at 11:35 -0500, James Antill wrote: > On Fri, 2011-02-04 at 11:31 -0500, seth vidal wrote: > > On Fri, 2011-02-04 at 11:24 -0500, James Antill wrote: > > > > + > > > +def safe_iterparse(filename): > > > + """ Works like iterparse, but hides XML errors (prints a warning). > > > """ > > > + try: > > > + for event, elem in safe_iterparse(infile): > > > + yield event, elem > > > + except SyntaxError: # Bad XML > > > + print >> sys.stderr, "File is not valid XML:", filename > > > + > > > class UpdateNoticeException(Exception): > > > > maybe worth putting the safe_iterparse in misc and using it in comps.py, > > repoMDObject.py? > > Yeh, I thought about it ... but comps does it's own handling of syntax > errors: > > parser = iterparse(infile) > try: > ... > except SyntaxError, e: > raise CompsException, "comps file is empty/damaged" > > ...I can still put it in there, for other users, if you want. >
then that's a better question - do we want updateinfo garbage to be swallowed? In the case of the gui managers? -sv _______________________________________________ Yum-devel mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum-devel
