collective / experimental.gracefulblobmissing

Gracefully handle missing BLOBs in Plone
https://pypi.org/project/experimental.gracefulblobmissing/
2 stars 1 forks source link

auto create images #6

Closed thet closed 2 years ago

thet commented 2 years ago

rebased on master of this branch by @ale-rt: https://github.com/collective/experimental.gracefulblobmissing/tree/auto-create-images

mauritsvanrees commented 2 years ago

BTW, I had lots of old (and some new) dummy txt files in my blobstorage. Others may have too. To find them:

find var/blobstorage/0x00/ -type f -size 1

To remove them:

find var/blobstorage/0x00/ -type f -size 1 | xargs rm

Note that when you do not include 0x00 in the path, you will also remove var/blobstorage/.layout. On restart, this file will be recreated and the ZODB picks the lawn layout, which will make your current blobs invisible. Been there, done that. To fix:

echo "bushy" > var/blobstorage/.layout

Note that you probably should not use a text editor for this, as it might add a newline at the end, which might break it again.

thet commented 2 years ago

@mauritsvanrees If you have the changes locally, feel free to push them here.

mauritsvanrees commented 2 years ago

@mauritsvanrees If you have the changes locally, feel free to push them here.

Done.

I actually saw what the real problem was with the directory permissions it had nothing to do with os.umask but with decimals versions octals. You changed the permission from 0700 to 700 to fix a SyntaxError on Python 3. But this should have been 0o700 which works in both versions:

>>> os.makedirs("one", 700)
>>> os.makedirs("two", 0o700)
>>> 
$ ls -ld one two
d-w-r-xr--  2 maurits  staff  64 10 Nov 09:38 one
drwx------  2 maurits  staff  64 10 Nov 09:39 two

So I kept the directory permissions, although the ZODB does not use them anymore as far as I saw.

mauritsvanrees commented 2 years ago

For good measure, I tested in Plone 4.3 Archetypes, and it still seems to work there.