Skip to content

The ZODB should create the "tmp" directory for savepoint automatically if the target directory does not exist. #394

Description

@zopyx

A savepoint() call may cause the error

  File "/home/ajung/src/unibo/magazine-plone6/eggs/transaction-3.1.0-py3.11.egg/transaction/_transaction.py", line 627, in __init__
    savepoint = savepoint()
                ^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 984, in savepoint
    self._commit(None)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 544, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 591, in _store_objects
    s = self._storage.storeBlob(oid, serial, p, blobfilename,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1186, in storeBlob
    targetpath = self._getBlobPath()
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1215, in _getBlobPath
    blob_dir = tempfile.mkdtemp(dir=self.temporaryDirectory(),

if the target directory does not exist.
Better: the directory should be created automatically rather than failing implicitly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions