repoze / repoze.filesafe Goto Github PK
View Code? Open in Web Editor NEWTransaction-aware file creation
Home Page: http://pypi.python.org/pypi/repoze.filesafe
License: Other
Transaction-aware file creation
Home Page: http://pypi.python.org/pypi/repoze.filesafe
License: Other
``repoze.filesafe`` README ========================== repoze.filesafe provides utilities methods to handle creation of files on the filesystem safely by integrating with the ZODB package's transaction manager. It can be used in combination with repoze.tm (or repoze.tm2) for use in WSGI environments. See ``docs/index.rst`` for documentation.
This is probably me not knowing how to use filesafe but I have been unable to google a good answer and the problem seems easily reproducible:
using Pyramid:
$ paster pshell test.ini -p python
Python 2.7.2 (default, Oct 14 2011, 23:34:02)
[GCC 4.5.2] on linux2
Type "help" for more information.
Environment:
app The WSGI application.
registry Active Pyramid registry.
request Active request object.
root Root of the default resource tree.
root_factory Default root factory used to create `root`.
Custom Variables:
mod smd.models
s smd.models.S
t transaction
>>> from repoze.filesafe import create_file
>>> f = create_file('hello_world', 'wb')
>>> f.write('hola mundo, esto es una prueba')
>>> f.close()
>>> t.commit()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/mariano/Code/SmD/env/lib/python2.7/site-packages/transaction/_manager.py", line 89, in commit
return self.get().commit()
File "/home/mariano/Code/SmD/env/lib/python2.7/site-packages/transaction/_transaction.py", line 329, in commit
self._commitResources()
File "/home/mariano/Code/SmD/env/lib/python2.7/site-packages/transaction/_transaction.py", line 443, in _commitResources
rm.commit(self)
File "/home/mariano/Code/SmD/env/lib/python2.7/site-packages/repoze/filesafe/manager.py", line 90, in commit
os.rename(info["tempfile"], target)
OSError: [Errno 18] Invalid cross-device link
At 9fd41ca, looks like ready to release,
but not uploaded to pypi (https://pypi.python.org/pypi/repoze.filesafe).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.