Re: weblogsping.py error handling patch
Ryan Barrett <pyblosxom-6sb6M7qyT/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 29 Aug 2006, will guaraldi wrote: > Regardless, that's not my main issue with the change. My main issue with > the change is that I'd rather have things fail immediately when something > unexpected happens rather than at some unspecified point down the road > because the system was in a funky state. understood. it's a fair point. i still don't entirely agree, but it's a design philosophy question, so i don't mind disagreeing. you all get to make the final call on design stuff anyway. :P given that, i'll fall back to submitting the original weblogsping.py patch for inclusion. it's attached. we might want to look at more plugins to see if they need similar patches. i'd bet that many of them can fail during normal usage, not just because of bugs. in those cases, the plugin can and should recover so that it doesn't kill pyblosxom unnecessarily. i'll submit more patches for other plugins when i notice ones that need it. > On another note, where'd you get that email address for Wari? it's in the weblogsping.py docstring. i also tried [email protected], but that bounces too. meh. -Ryan -- http://snarfed.org/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Pyblosxom-devel mailing list Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
weblogsping_error_handling.patch
(text/plain, 2.6 KB)
*** /usr/home/ryanb/archive/contrib.1.3.0/plugins/weblogsping.py Tue May 30 20:01:35 2006 --- /usr/home/ryanb/archive/contrib_patched/plugins/weblogsping.py Tue Aug 29 15:08:42 2006 *************** *** 42,49 **** __author__ = "Wari Wahab [email protected]" __version__ = "$Id: weblogsping.py 883 2006-03-24 03:43:42Z willhelm $" ! import xmlrpclib, os, time import cPickle as pickle class WeblogsPing: def __init__(self, request): --- 42,50 ---- __author__ = "Wari Wahab [email protected]" __version__ = "$Id: weblogsping.py 883 2006-03-24 03:43:42Z willhelm $" ! import xmlrpclib, os, sys, time import cPickle as pickle + from Pyblosxom import tools class WeblogsPing: def __init__(self, request): *************** *** 89,102 **** # Save this data first else we'll go crazy with looping if not self.__saveResults(pingTime, 'buffer', 'buffer'): return # Ping both servers now. ! rpc = xmlrpclib.Server('http://ping.blo.gs/') ! response = rpc.weblogUpdates.extendedPing(self._title, ! self._site, self._xml, self._xml) ! rpc = xmlrpclib.Server('http://rpc.weblogs.com/RPC2') ! response1 = rpc.weblogUpdates.ping(self._title, self._site) ! # save result of ping in self._file, note, no output is done ! self.__saveResults(pingTime, response, response1) def __saveResults(self, pingTime, response, response1): latest = (pingTime == 0 and 1 or self._latest) --- 90,111 ---- # Save this data first else we'll go crazy with looping if not self.__saveResults(pingTime, 'buffer', 'buffer'): return + # Ping both servers now. ! logger = tools.getLogger() ! try: ! rpc = xmlrpclib.Server('http://ping.blo.gs/') ! response = rpc.weblogUpdates.extendedPing( ! self._title, self._site, self._xml, self._xml) ! rpc = xmlrpclib.Server('http://rpc.weblogs.com/RPC2') ! response1 = rpc.weblogUpdates.ping(self._title, self._site) ! ! # save result of ping in self._file, note, no output is done ! self.__saveResults(pingTime, response, response1) ! except: ! logger.error("Error during ping: %s, %s" % (str(sys.exc_type), ! str(sys.exc_value))) ! def __saveResults(self, pingTime, response, response1): latest = (pingTime == 0 and 1 or self._latest)