def clone(self): copy = Image() copy.namespace = self.namespace copy.name = self.name copy.info = self.info.clone() copy.rawdata = self.rawdata[:] return copy
def test_rename(self): source = self._get_test_file('sample.png') thumbs = dict(small=(100, 100)) Image.set_sizes(thumbs=thumbs) image = Image(source=source, name="original.png", session=self.session) self.session.commit() image.name = 'updated.png' self.assertIn('updated.png', image.path) self.assertIn('updated_small.png', image.thumbnails['small'].path)