You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
distros-overlay/sys-apps/calculate-core/files/calculate-core-3.2.0_alpha5...

134 lines
5.4 KiB

diff --git core/depricated.py core/depricated.py
new file mode 100644
index 0000000..f5d7b4e
--- /dev/null
+++ core/depricated.py
@@ -0,0 +1,17 @@
+#-*- coding: utf-8 -*-
+
+# Copyright 2011-2013 Calculate Ltd. http://www.calculate-linux.org
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+safetyWrapper = lambda *args, **kw: lambda f:f
diff --git core/server/clean.py core/server/clean.py
index 25cb323..44f7406 100644
--- core/server/clean.py
+++ core/server/clean.py
@@ -21,23 +21,19 @@ from calculate.core.datavars import DataVarsCore
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_core3',sys.modules[__name__])
-# clear server files after restart
-def clean (SID_FILE, PID_FILE, SID_PID, SIDS_DIR, PIDS_DIR):
- if os.path.exists(SID_FILE):
- os.unlink(SID_FILE)
- if os.path.exists(PID_FILE):
- os.unlink(PID_FILE)
- if os.path.exists(SID_PID):
- os.unlink(SID_PID)
- if os.path.isdir(SIDS_DIR):
- for filename in glob.glob(os.path.join(SIDS_DIR, "*.sid")):
- os.unlink (filename)
- if os.path.exists(filename):
- print 'Not deleted file %s!!!' %filename
- if os.path.isdir(PIDS_DIR):
- for filename in glob.glob(os.path.join(PIDS_DIR, "*.pid")):
- os.unlink (filename)
+def clean(sid_file, pid_file, sid_pid, sids_dir, pids_dir):
+ """
+ Удалить все файлы сервера после перезапуска
+ """
+ for fn in (sid_file, pid_file, sid_pid):
+ if os.path.exists(fn):
+ os.unlink(fn)
+
+ for dn in (sids_dir, pids_dir):
+ if os.path.isdir(dn):
+ for filename in glob.glob(os.path.join(dn, "*.sid")):
+ os.unlink(filename)
class CoreWsdl:
# watch for process
diff --git core/server/func.py core/server/func.py
index 9fdee9b..3bde6e4 100644
--- core/server/func.py
+++ core/server/func.py
@@ -17,6 +17,7 @@
import pickle, random
import threading
import sys, os, re
+from os import path
import traceback
from traceback import print_exc
from api_types import ReturnProgress,ViewParams,Integer,ViewInfo
@@ -38,6 +39,7 @@ from calculate.core.server.api_types import ChoiceValue, Table, Option, Field, \
GroupField, ViewInfo, ViewParams
from calculate.lib.datavars import DataVars
from decorators import Dec
+from calculate.core.depricated import safetyWrapper
class CommonMethods:
def dispatchConf(self,filesApply=None):
diff --git core/server/replace_class.py core/server/replace_class.py
index aa83294..6e0da47 100644
--- core/server/replace_class.py
+++ core/server/replace_class.py
@@ -352,7 +352,7 @@ class replaceClass():
def _printOK(self):
self.terminal_print('\r')
- self.terminal_print.right(self.color_print.getconsolewidth()-7)
+ self.terminal_print.right(self.color_print.getconsolewidth()-6)
self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ")
self.terminal_print.bold.foreground(TextState.Colors.GREEN)("ok")
self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]")
@@ -360,7 +360,7 @@ class replaceClass():
def _printBAD(self):
self.terminal_print('\r')
- self.terminal_print.right(self.color_print.getconsolewidth()-7)
+ self.terminal_print.right(self.color_print.getconsolewidth()-6)
self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ")
self.terminal_print.bold.foreground(TextState.Colors.RED)("!!")
self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]")
@@ -368,7 +368,7 @@ class replaceClass():
def _printSkip(self):
self.terminal_print('\r')
- self.terminal_print.right(self.color_print.getconsolewidth()-9)
+ self.terminal_print.right(self.color_print.getconsolewidth()-8)
self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ")
self.terminal_print.bold.foreground(TextState.Colors.YELLOW)("skip")
self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]")
@@ -379,13 +379,12 @@ class replaceClass():
self.spinner.stop()
self.spinner = None
self.setProgress(100, progress_message)
- if self.progressbar and self.progressbar.finished:
- self.terminal_print.up(1).clear_line("")
- self.terminal_print.up(1)("")
- self.progressbar = None
-
- # если result - сообщение
if self.currentTaskMessage:
+ if self.progressbar and self.progressbar.finished:
+ self.terminal_print.up(1).clear_line("")
+ self.terminal_print.up(1)("")
+ self.progressbar = None
+
self.displayResult(result)
self.currentTaskMessage = ""