[Catalog-sig] Untested patch for PyPI exceptions
A.M. Kuchling
amk at amk.ca
Thu May 3 20:08:04 CEST 2007
The completely untested patch below should remedy the occasional
exceptions that PyPI is occasionally raising. Can someone provide a
sanity check for this patch? (I'm not going to deploy it -- not
familiar enough with the setup on the live site.)
--amk
Index: flamenco.py
===================================================================
--- flamenco.py (revision 452)
+++ flamenco.py (working copy)
@@ -1,6 +1,7 @@
#!/usr/bin/python
import sys, pprint, cgi, urllib, os, time, cStringIO
+import psycopg
def flatten(d):
l = d[1]
@@ -114,7 +115,8 @@
# overlapping update, just release the lock
self.store.commit()
return
- self.cursor.execute("delete from browse_tally")
+ try:
+ self.cursor.execute("delete from browse_tally")
# Using PostgreSQL COPY here, instead of a series of INSERT statements
s = cStringIO.StringIO()
for _, _, items in self.list_choices()[1]:
@@ -123,6 +125,8 @@
s.seek(0)
self.cursor.copy_from(s, 'browse_tally')
self.cursor.execute("update timestamps set value=now() where name='browse_tally'")
+ except psycopg.ProgrammingError:
+ pass
self.store.commit()
def get_matches(self, addl_fields=[]):
More information about the Catalog-sig
mailing list