This site is an archive; learn more about 8 years of OpenHatch.

[Devel] Recent spate of errors

Asheesh Laroia asheesh at openhatch.org
Wed Jun 16 01:19:54 UTC 2010


Excerpts from Raphael Krut-Landau's message of Sun Jun 13 21:36:33 +0000 2010:
> Devs,
> 
> Here's a report on today's flurry of error emails. The code path that
> generated the errors was roughly this:
> 
> * Citation.get_url_or_guess was trying to urlencode a project name,
> * and the project name when retrieved from the database was coming out
> as a string, not as unicode.
> * Our urlencode wrapper was wired to set a pdb trace when it receives
> a non-unicode string as an argument.
> * We can't set a pdb trace on the live site, and the consequence was a
> sort of IOError.
> 
> I've added two fixes. First, encode the project name as unicode before
> passing it to urlencode. This is the "correct way".

I thought I pushed a fix for this, too. Glad to see you saw it too!

> But just to be safe, I've also implemented a second fix, i.e., a bit
> of graceful degradation:
> * Don't set a pdb trace when urlencode receives a non-unicode string,
> but just throw a ProgrammingError (for a lack of a better error
> class-- I was writing this pretty quickly since the site was
> exploding.)
> * Citation.get_url_or_guess is now configured so that if *any*
> exception (ProgrammingError or otherwise) is thrown while urlencoding,
> we don't use our kinky urlencode wrapper, but instead just attempt to
> encode the project name using the vanilla urllib.urlencode function.
> When this degradation happens, we print a message using logging.warn,
> which I believe appears in one of the error logs.

ProgrammingError is basically only for SQL...

> A question for Asheesh: Why wasn't this failing before? That is, was
> citation.portfolio_entry.project.name really giving us unicode before,
> but now giving us a string?

Because we're now on Python 2.6! Yay!

Only, random things are different and I don't know why! Boo!

But yay generall.

-- Asheesh.

-- 
Don't get stuck in a closet -- wear yourself out.


More information about the Devel mailing list