Converting my non-concurrent code to instead use a persistent
store coordinated through ZEO is pretty easy once I’d grokked the
documentation. In fact most of the work consisted of deleting
some of the routines for just-in-time reading back of the
metadata, since that is now taken care of for me by ZODB.
Had a bug in the Picky Picky Game where
uploaded pictures might have backslashes left in their names
(the picture name being derived from the file name supplied by
the client computer). Technically it is OK to have backslashes
in a
URL, and they should
be treated like any other character. Some web browsers
second-guess you, however, and replace backslashes with slashes
(http://foo/bar\baz
is treated as
http://foo/bar/baz
), with the result that these
pictures failed to appear.
The solution is, of course, to (a) change the code for
translating file names in to picture names so that it removes
backslashes, and (b) fix the existing databases.
ZODB makes the second part pretty easy; having acquired a
Game
instance from the databse, you just run a
script like
for rn, r in game.rounds.items():
for pic in r.pictures:
s = r.sanitizedName(pic.name, pic)
if s != pic.name:
pic.name = s
pic.dataUri = s + picky.mediaTypeSuffix(pic.mediaType)
The function sanitizedName
is the one that has to
be fixed for part (a).