Code to upload

def _new(self, src_path, dry_run=False, remove_uploaded=False):
            'Code to upload'
            # are we getting a symbolic link?
            if os.path.islink(src_path):
                sourcefile = os.path.normpath(os.path.join(self.topdir, os.readlink(src_path)))
                if not os.path.exists(sourcefile): # broken symlink
                    log.error("broken symlink %s->%s", src_path, sourcefile)
                    raise IOError("broken symliknk %s->%s", src_path, sourcefile)
                jottapath = self.get_jottapath(src_path, filename=os.path.basename(sourcefile))
            elif os.path.splitext(src_path)[1].lower() == '.lnk':
                # windows .lnk
                sourcefile = os.path.normpath(readlnk(src_path))
                if not os.path.exists(sourcefile): # broken symlink
                    log.error("broken fat32lnk %s->%s", src_path, sourcefile)
                    raise IOError("broken fat32lnk %s->%s", src_path, sourcefile)
                jottapath = self.get_jottapath(src_path, filename=os.path.basename(sourcefile))
            else:
                sourcefile = src_path
                if not os.path.exists(sourcefile): # file not exis
                    log.error("file does not exist: %s", sourcefile)
                    raise IOError("file does not exist: %s", sourcefile)
                jottapath = self.get_jottapath(src_path)

            log.info('Uploading file %s to %s', sourcefile, jottapath)
            if not dry_run:
                if not jottacloud.new(sourcefile, jottapath, self.jfs):
                    log.error('Uploading file %s failed', sourcefile)
                    raise
            if remove_uploaded:
                log.info('Removing file after upload: %s', src_path)
                if not dry_run:
                    os.remove(src_path)