~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

  • Committer: Martin Pool
  • Date: 2007-06-28 04:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2559.
  • Revision ID: mbp@sourcefrog.net-20070628043955-24gmbiw7luul0d6y
[BUG 119330] Fix tempfile permissions error in smart server tar bundling (under windows) (Martin_)

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
    def _tarfile_response(self, tmp_dirname, compression):
214
214
        temp = tempfile.NamedTemporaryFile()
215
215
        try:
216
 
            self._tarball_of_dir(tmp_dirname, compression, temp.name)
 
216
            self._tarball_of_dir(tmp_dirname, compression, temp.file)
217
217
            # all finished; write the tempfile out to the network
218
218
            temp.seek(0)
219
219
            return SuccessfulSmartServerResponse(('ok',), temp.read())
222
222
        finally:
223
223
            temp.close()
224
224
 
225
 
    def _tarball_of_dir(self, dirname, compression, tarfile_name):
226
 
        tarball = tarfile.open(tarfile_name, mode='w:' + compression)
 
225
    def _tarball_of_dir(self, dirname, compression, ofile):
 
226
        tarball = tarfile.open(fileobj=ofile, mode='w|' + compression)
227
227
        try:
228
228
            # The tarball module only accepts ascii names, and (i guess)
229
229
            # packs them with their 8bit names.  We know all the files