pgcontents/pgmanager.py
def rename_file(self, old_path, path):
        """
        Rename object from old_path to path.

        NOTE: This method is unfortunately named on the base class.  It
        actually moves a file or a directory.
        """
        with self.engine.begin() as db:
            try:
                if self.file_exists(old_path):
                    rename_file(db, self.user_id, old_path, path)
                elif self.dir_exists(old_path):
                    rename_directory(db, self.user_id, old_path, path)
                else:
                    self.no_such_entity(path)
            except (FileExists, DirectoryExists):
                self.already_exists(path)
            except RenameRoot as e:
                self.do_409(str(e))
def rename_file(self, old_path, path):
        """
        Rename object from old_path to path.

        NOTE: This method is unfortunately named on the base class.  It
        actually moves a file or a directory.
        """
        with self.engine.begin() as db:
            try:
                if self.file_exists(old_path):
                    rename_file(db, self.user_id, old_path, path)
                elif self.dir_exists(old_path):
                    rename_directory(db, self.user_id, old_path, path)
                else:
                    self.no_such_entity(path)
            except (FileExists, DirectoryExists):
                self.already_exists(path)
            except RenameRoot as e:
                self.do_409(str(e))
Rename object from old_path to path.

        NOTE: This method is unfortunately named on the base class.  It
        actually moves a file or a directory.