Closed aleksandra-kim closed 8 years ago
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
The whole way of choosing the current project is pretty crap. How was this not a function from the beginning?
What do you think about the following:
#!python
class ProjectManager:
@property
def current(self):
return self._project
def set_current(self, name, writable=True):
self._project = project
if writable:
self._lock = InterProcessLock(os.path.join(self.dir, "write-lock"))
self.read_only = not self._lock.acquire(timeout = 0.05)
else:
self.read_only = True
I don't know if .set_current()
is better than .set()
... but I am totally OK with making choosing a project an explicit function, and then being able to pass writable=False
.
Original comment by Tomas Navarrete Gutierrez (Bitbucket: tomas_navarrete, ).
I vote for set_current()
For the rest, it looks good to me.
Original report by Tomas Navarrete Gutierrez (Bitbucket: tomas_navarrete, ).
It would be useful to have a way to specify that we want to access a project in "read only" mode, so that a write lock does not get created automatically.