コード例 #1
0
ファイル: myshares.py プロジェクト: lebauce/tsumufs
  def makeDir(self, path, mode, uid, gid):
    if self.levels[path.count("/") - 1] != "buddy":
      View.mkdir(self, path, mode)

    try:
      if self.statFile(path):
        raise OSError(errno.EEXIST, os.strerror(errno.EEXIST))

    except OSError, e:
      if e.errno != errno.ENOENT:
        raise
コード例 #2
0
ファイル: myshares.py プロジェクト: lebauce/tsumufs
  def statFile(self, path):
    if (path.count(os.sep) == 1
        and self._fullnameBindings.has_key(os.path.basename(path))):
      listpath = path.split(os.sep)
      listpath[1] = self._fullnameBindings[os.path.basename(path)]
      path = os.sep.join(listpath)

    return View.statFile(self, path)
コード例 #3
0
ファイル: staredbytag.py プロジェクト: vienin/tsumufs
    def makeDir(self, path, mode, uid, gid):
        """
    Create a tag if path is at 'tag' level.
    """
        if self.isFileLevel(path):
            View.makeDir(self, path, mode)

        tag = os.path.basename(path)
        try:
            self._syncDocs.by_tag(key=tag, pk=True)
            raise OSError(errno.EEXIST, os.strerror(errno.EEXIST))

        except tsumufs.DocumentException, e:
            if tag in self._pendingTags:
                raise OSError(errno.EEXIST, os.strerror(errno.EEXIST))

            self._pendingTags.append(tag)
コード例 #4
0
ファイル: staredbytag.py プロジェクト: vienin/tsumufs
    def rename(self, old, new):
        """
    Assign a tag to a file.
    """

        if not self.isFileLevel(new):
            View.rename(self, old, new)

        tag = os.path.basename(os.path.dirname(new))
        overlaypath = self.overlayPath(old)

        if tag in tsumufs.fsOverlay[overlaypath].tags:
            raise OSError(errno.EEXIST, "File already tagged with this tag.")

        tsumufs.fsOverlay.tag(overlaypath, tag)

        self._debug('Add "tags" metadata change for %s' % overlaypath)
        tsumufs.syncLog.addMetadataChange(overlaypath)
コード例 #5
0
ファイル: myshares.py プロジェクト: lebauce/tsumufs
  def getDirents(self, path):
    returned = []
    for dirent in View.getDirents(self, path):
      returned.append(dirent.filename)
      yield dirent

    if not path.count(os.sep):
      for friend in self._pendingFriends:
        if friend['fullname'] not in returned:
          yield self.docClass(filename=friend['fullname'], mode=0555 | stat.S_IFDIR,
                              uid=friend['uid'], gid=friend['gid'])
        else:
          returned.remove(friend['fullname'])
コード例 #6
0
ファイル: staredbytag.py プロジェクト: vienin/tsumufs
    def getDirents(self, path):
        """
    Add to the result of getDirent on the parent call View,
    and add the pending tags dir to the dirents if path is at 'tag' level.
    """

        returned = []
        for dirent in View.getDirents(self, path):
            yield dirent
            returned.append(dirent.filename)

        if not path.count(os.sep):
            for tag in self._pendingTags:
                if tag not in returned:
                    yield self.docClass(filename=tag, mode=0555 | stat.S_IFDIR)
                else:
                    returned.remove(tag)
コード例 #7
0
ファイル: myshares.py プロジェクト: lebauce/tsumufs
  def __init__(self):
    self._syncDocs = DocumentHelper(tsumufs.SyncDocument, tsumufs.dbName)

    View.__init__(self)
コード例 #8
0
ファイル: buddyshares.py プロジェクト: lebauce/tsumufs
 def __init__(self):
   View.__init__(self)