Re: [Zim-wiki] Multi user?

2012-03-01 Thread Svenn Bjerkem
On Thu, 2012-03-01 at 09:17 +, João Santos wrote:
 Either way, ideally,  zim should support simultaneous access to the
 files, for example in a NFS or SMB shared filesystem.

Yupp, that what it all boils down to.

-- 
Svenn


___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-03-01 Thread João Santos
I've made a simple lock mechanism. I believe this lock mechanism should
work both on Windows and Linux (I've only tested on Linux and only on a
local filesystem). I'll test it in windows and shared filesystems later.


2012/3/1 Jaap Karssenberg jaap.karssenb...@gmail.com

 On Thu, Mar 1, 2012 at 11:01 AM, João Santos j...@jsantos.eu wrote:

 Wouldn't this module: http://packages.python.org/lockfile/lockfile.htmldo 
 the job?


 Afraid not. This module will do locking between multiple processes on the
 same system, but it is not suitable for .e.g. multiple systems accessing
 the same share drive.

 I think the most important use case for this multi-user sharing is each
 user having his or her own computer, but sharing a share drive.

 So locking needs to be platform independent, and can only use the (shared)
 file system.

 Regards,

 Jaap


import os
import uuid
import shutil


class LockFailedError(Exception):
pass


class NotMyLockError(Exception):
pass


class CrossLock(object):

def __init__(self, name):
Represents a lockfile with a name
self.lock = .{0}.lock.format(name)
#We will have a unique id to assure that the lock
#belongs to the instance
self.id = uuid.uuid1()
self.filename = {0}/{1}.format(self.lock, self.id)

def _create_lockfile(self):
Creates the lock dir and file
#mkdir is atomic on windows and linux
#and will fail if dir already exists
os.mkdir(self.lock)
os.mknod(self.filename)

def acquire(self):
Tries to acquire lock.
try:
self._create_lockfile()
except:
raise LockFailedError

def break_lock(self):
Removes the lock directory
shutil.rmtree(self.lock)

def is_locked(self):
Tests if the file is locked
return os.access(self.lock, os.F_OK)

def is_my_lock(self):
Tests if the lock belongs to the instance
return os.access(self.filename, os.F_OK)

def release(self):
Removes the lock but only if owned by the instance
if not self.is_my_lock():
raise NotMyLockError
else:
self.break_lock()

if __name__ == '__main__':
lock = CrossLock(teste)
lock2 = CrossLock(teste)

print Trying to get get lock
try:
lock.acquire()
print Correct (Succeeded)
except:
print Incorrect (Failed)

print Trying to get a lock again
try:
lock.acquire()
print Incorrect (Succeeded)
except:
print Correct (Failed)

print Trying to release the lock with the wrong instance
try:
lock2.release()
print Incorrect (Succeeded)
except:
print Correct (Failed)

print Tryng to release the lock with the correct instance
try:
lock.release()
print Correct (Succeeded)
except:
print Incorrect (Failed)
raise

print Testing if it's locked
if lock.is_locked():
print Incorrect (True)
else:
print Correct (False)

print Trying to get get lock again
try:
lock.acquire()
print Correct (Succeeded)
except:
print Incorrect (Failed)

print Testing if it's locked
if lock.is_locked():
print Correct (True)
else:
print Incorrect (False)

print Trying to break the lock
try:
lock2.break_lock()
print Correct (Succeeded)
except:
print Incorrect (Failed)
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


[Zim-wiki] Multi user?

2012-02-29 Thread Ulf Bro
Is it possible to leave all files on a server, for example on a samba
server in Linux, and have more people working with it at the same time?
One person can read what another has written just like in Wikipedia?

Those who have a Windows client have their Zim running there and those
who have a Linux client use the Linux Zim.

Or is that not possible?

Ulf

-- 
Ulf Bro ulf@web.de

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-02-29 Thread Damien Accorsi
I believe the use of DVCS is the best way to use zim as a long-term 
wiki. Maybe we should define how it would work; I'm interested in 
upgrading the DVCS plugin in this direction.


Damien

On 02/29/2012 05:57 PM, Greg Warner wrote:

Or maybe something like a shared dropbox folder would work.  I'm not
sure how it does conflict resolution, but it's probably better than
nothing and might be more user friendly than a VCS.

On Wed, Feb 29, 2012 at 9:55 AM, Jaap Karssenberg
jaap.karssenb...@gmail.com mailto:jaap.karssenb...@gmail.com wrote:

On Wed, Feb 29, 2012 at 5:32 PM, Ulf Bro ulf@web.de
mailto:ulf@web.de wrote:

Is it possible to leave all files on a server, for example on a
samba
server in Linux, and have more people working with it at the
same time?
One person can read what another has written just like in Wikipedia?

Those who have a Windows client have their Zim running there and
those
who have a Linux client use the Linux Zim.

Or is that not possible?


Yes and no. Yes you can do it. Make sure to set the shared
notebook toggle in the properties, so each user uses their own
cache folder.

No it won't work well. Zim does not lock files etc. so you will get
constant conflicts when users edit the same page at the same time.

Also you might get performance issues - never tested for this use case.

Current recommendation for multi-user access is to sync with version
control, e.g. Bazaar. This is also available for all platforms,
let's each user change their local copy and then merge  push their
changes. This way you also can deal with tracking who changed what etc.

To make it really user friendly you might need to configure a custom
tool with a script that does the syncing.

Regards,

Jaap


___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
mailto:zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp




___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-02-29 Thread Jaap Karssenberg
Btw. just so you guys are aware, there is a 100,- euro bounty open on
resolving conflicts. This draft is targetting a generic mechanism to show
and resolve conflicts in zim - regardless of the backend (dropbox, bazaar,
...). So far nobody has notified me that they are working on this, so open
for the taking ;)

-- Jaap
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-02-29 Thread Frank Van Geirt
Alright, I'm gonna strike when the iron is hot. Both my Python knowledge 
and my time is limited to do this myself, but I definitely want this 
feature. As a project manager and an open source believer, I see many 
opportunities for Zim to become a main tool for small project teams.


So, I want to raise the bounty with another 100,- euro. Jaap, do you 
want me to send the money on beforehand to you or do you contact me 
after the implementation?


Regards,
Frank

On 02/29/2012 06:24 PM, Jaap Karssenberg wrote:
Btw. just so you guys are aware, there is a 100,- euro bounty open on 
resolving conflicts. This draft is targetting a generic mechanism to 
show and resolve conflicts in zim - regardless of the backend 
(dropbox, bazaar, ...). So far nobody has notified me that they are 
working on this, so open for the taking ;)


-- Jaap


___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-02-29 Thread Svenn Are Bjerkem
SparkleShare is nice with zim. I notice that due to the frequent
saving in zim, there is a rush of updates being pushed to the git
server. The problem is, as Jaap notes, that if a page changes behind
the scene while somebody is editing a page, there will be a conflict.

-- 
Svenn

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Multi user?

2012-02-29 Thread hansbkk
I am of the opinion that just like version control, Zim is best served by
hooking into third-party best of breed tools for specialized functions like
this. DokuWiki for example tries to do this, but I would turn it off if I
could, as I keep my DW source files in VCS. If the bzr hook functionality
were extended to work with other DVCS, and simply allowed the user to point
to his preferred diff/merge tools, I think that would be better than trying
to code this functionality into the program itself.

I have used Unison for over a dozen years to allow for n-way sync'ing of
folder trees, from small branches to whole filesystems.

It is cross-platform open-source, virtually bulletproof, rides on SSH for
security, allows for hub-and-spoke or mesh topologies, and regards to the
specific topic here, allows the user to specify what diff/merge tools s/he
wants to use to resolve conflicts.

Regarding such tools, my choice in mswin is Winmerge, better than anything
I've worked with on other platforms. Highly recommended for those looking
to share between users or just for users sharing between multiple computers
and/or drives if they don't need the version control aspect, just the
sync'ing and don't trust third-party-controlled cloud services.

The Unison documentation is quite extensive and points to the options
needed to account for the
differenceshttp://www.cis.upenn.edu/%7Ebcpierce/unison/download/releases/stable/unison-manual.html#mergebetween
how diff/merge tools handle their temp files. IMO those sponsoring
the bounty should discuss such an approach.
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp