diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-07-18 02:49:44 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-07-18 02:49:44 +0000 |
commit | 356c8842c52a8ad184b268adc9ac4676032e0317 (patch) | |
tree | 62231dfc9911386d47c21f880bc4621ef7c7e866 | |
parent | ec5153357b4d7eb74960710ce2f353e14ac011e1 (diff) | |
download | paste-git-356c8842c52a8ad184b268adc9ac4676032e0317.tar.gz |
Removed py.path-isms
-rw-r--r-- | examples/filebrowser/web/copybin.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/filebrowser/web/copybin.py b/examples/filebrowser/web/copybin.py index b17153f..e2a9696 100644 --- a/examples/filebrowser/web/copybin.py +++ b/examples/filebrowser/web/copybin.py @@ -1,6 +1,5 @@ +import shutil from filebrowser.sitepage import * -from py.path import local -import py class copybin(SitePage): @@ -25,20 +24,21 @@ class copybin(SitePage): self.message.write('No items to paste') self.redirect(self.fields.back) return - dest = self.root.join(self.fields.paste) + dest = self.pathcontext.path(self.fields.paste) copied = 0 moved = 0 for filename, copytype in self.copybin.items(): - path = self.root.join(filename) + path = self.pathcontext.path(filename) + dest_path = dest.join(path.basename) if copytype == 'copy': copied += 1 - path.copy(dest) + shutil.copyfile(path.filename, dest_path.filename) elif copytype == 'cut': try: - path.move(dest) - except py.error.ENOTEMPTY, e: + shutil.movefile(path.filename, dest_path.filename) + except Exception, e: self.message.write( - 'Cannot move %s (file by the same name exists' % dest) + 'Cannot move to %s (%s)' % (dest, e)) else: moved += 1 msg = [] |