On Thu, May 03, 2007 at 02:53:14PM -0400, Jean-Paul Calderone wrote: > The indentation looks wrong, at least.
Oops, thanks! Attempt #2... --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,15 +115,18 @@ # overlapping update, just release the lock self.store.commit() return - 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]: - for path, packages in items: - s.write('%d\t%d\n' % (self.trove.getid(path), len(packages))) - s.seek(0) - self.cursor.copy_from(s, 'browse_tally') - self.cursor.execute("update timestamps set value=now() where name='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]: + for path, packages in items: + s.write('%d\t%d\n' % (self.trove.getid(path), len(packages))) + 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=[]): _______________________________________________ Catalog-sig mailing list Catalog-sig@python.org http://mail.python.org/mailman/listinfo/catalog-sig