def post_csv(self,bg=0,br=1): user = self.request.user POST = self.request.POST if 'dat' in POST: a = array.array(UNSIGNED_ITEM_TYPES[1]) dat = map(int,POST['dat'].split(',')) a.fromlist([bg,br]) a.fromlist(dat) astring = a.tostring() cl = Classification("%s:%s"%(user.username,hashlib.md5(astring).hexdigest())) cl.tileset = self.ts.key_name cl.dat = zlib.compress(astring) cl.N = len(a) assert (cl.N-2) == self.ts.numregions cl.n = max(a)+1 cl.owner = user.username cl.public = True cl.expires = False cl.date = time.mktime(time.gmtime()) return cl.put()