summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-03-04 14:31:17 +0100
committerXavier Morel <xmo@openerp.com>2014-03-04 14:31:17 +0100
commit8ab5f3979bf40a953e1febca4c0b359623f9e2bb (patch)
tree3473a06973ee9b699611fc196ac79e72080c9989 /addons/web
parent4641a23d1448ad7536af03accc5e2de3773abbff (diff)
[ADD] deduplication of website images being uploaded
There is a deduplication in ir.attachment, but it's only for FS-stored content *and* it only deduplicates storage not models (as there are access rights issues involved). The goal here is to always return the same attachment when a user uploads the exact same image multiple times (because it's simpler or whatever). Initially tried to use a binary field & digest(), but search() blows up because it tries to utf-8 encode raw binary data. So use char & hexdigest instead. _compute_checksum returns None if the provided attachment data does not look like a website image attachment. Unhandled: multiple existing matches, maybe a UNIQUE constraint on the checksum field would be a good idea just in case. cherrypicked from saas-3's xmo@openerp.com-20140303153855-5f2l8v0jq2mgb26f which had to be backed out (as the patch adds a new stored field) bzr revid: xmo@openerp.com-20140304133117-r88p9zl2tc9tsh75
Diffstat (limited to 'addons/web')
0 files changed, 0 insertions, 0 deletions