uw_canvas/sis_import.py
def _build_archive(self, dir_path):
        """
        Creates a zip archive from files in path.
        """
        zip_path = os.path.join(dir_path, "import.zip")
        archive = zipfile.ZipFile(zip_path, "w")

        for filename in CSV_FILES:
            filepath = os.path.join(dir_path, filename)

            if os.path.exists(filepath):
                archive.write(filepath, filename, zipfile.ZIP_DEFLATED)

        archive.close()

        with open(zip_path, "rb") as f:
            body = f.read()

        return body
def _build_archive(self, dir_path):
        zip_path = os.path.join(dir_path, "import.zip")
        archive = zipfile.ZipFile(zip_path, "w")

        for filename in CSV_FILES:
            filepath = os.path.join(dir_path, filename)

            if os.path.exists(filepath):
                archive.write(filepath, filename, zipfile.ZIP_DEFLATED)

        archive.close()

        with open(zip_path, "rb") as f:
            body = f.read()

        return body
def _build_archive ( self , dir_path ) : zip_path = os . path . join ( dir_path , "import.zip" ) archive = zipfile . ZipFile ( zip_path , "w" ) for filename in CSV_FILES : filepath = os . path . join ( dir_path , filename ) if os . path . exists ( filepath ) : archive . write ( filepath , filename , zipfile . ZIP_DEFLATED ) archive . close ( ) with open ( zip_path , "rb" ) as f : body = f . read ( ) return body
Creates a zip archive from files in path.
Creates a zip archive from files in path .