From 297894c1267b50d4a4098e1dd8940a73af78f011 Mon Sep 17 00:00:00 2001 From: asamoukin Date: Thu, 6 Nov 2008 13:55:47 +0000 Subject: [PATCH] git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@376 c91db197-33c1-4113-bf15-f8a5c547ca64 --- pym/cl_profile.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pym/cl_profile.py b/pym/cl_profile.py index 29fc508..dd2f056 100644 --- a/pym/cl_profile.py +++ b/pym/cl_profile.py @@ -2020,20 +2020,22 @@ class profile(_file, _terms): flagForce = False # Если есть указатель на файл профиля (link) if objHeadNew.params.has_key("link"): - #prevOldFile = oldFile profileFile = objHeadNew.params['link'] - FO = self.openNewFile(profileFile) - buff = FO.read() - FO.close() + foundProfileFile = os.path.exists(profileFile) + if foundProfileFile: + FO = self.openNewFile(profileFile) + buff = FO.read() + FO.close() if os.path.exists(oldFile): os.remove(oldFile) - fd = os.open(oldFile, os.O_CREAT) - os.close(fd) - os.chmod(oldFile, self._mode) - os.chown(oldFile, self._uid, self._gid) - FON = open (oldFile, "r+") - FON.write(buff) - FON.close() + if foundProfileFile: + fd = os.open(oldFile, os.O_CREAT) + os.close(fd) + os.chmod(oldFile, self._mode) + os.chown(oldFile, self._uid, self._gid) + FON = open (oldFile, "r+") + FON.write(buff) + FON.close() # Если символическая ссылка if objHeadNew.params.has_key("symbolic"):