Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/2c0625529015
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:59:54 2012
Кодировка:
allpy: 2c0625529015

allpy

changeset 884:2c0625529015

CachedDownloadPdb: fix a bug causing most of downloaded pdb files not to save File was saved only if cache_dir did not exist before. Currently it is saved if it itself did not exist before. close #117
author Boris Nagaev <bnagaev@gmail.com>
date Sun, 18 Sep 2011 12:32:38 +0400
parents 41ab3b95c103
children 4d553f96efe2
files allpy/structure.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/allpy/structure.py	Sun Sep 18 12:23:57 2011 +0400
     1.2 +++ b/allpy/structure.py	Sun Sep 18 12:32:38 2011 +0400
     1.3 @@ -70,9 +70,10 @@
     1.4          if os.path.exists(path):
     1.5              return open(path)
     1.6          in_file = self.download_pdb(code)
     1.7 -        if self.save and not os.path.exists(self.cache_dir):
     1.8 +        if self.save and not os.path.exists(path):
     1.9              try:
    1.10 -                os.mkdir(self.cache_dir)
    1.11 +                if not os.path.exists(self.cache_dir):
    1.12 +                    os.mkdir(self.cache_dir)
    1.13                  with open(path, 'w') as out_file:
    1.14                      s = in_file.read()
    1.15                      out_file.write(s)