Исправлена обработка choice параметров

develop 3.4.3.1
Mike Hiretsky 9 years ago
parent ba64d79eeb
commit bc91d72884

@ -508,7 +508,8 @@ class Variable(VariableInterface):
"{vartype}")
self.raiseWrongChoice(name, tipChoice, val, error)
if "choice" in self.type and not "choiceedit" in self.type:
if (choiceVal and val and val not in choiceVal or
if (choiceVal and (val or val == "") and
val not in choiceVal or
val is None):
if not choiceVal:
self.raiseNothingValue()

@ -15,6 +15,8 @@
# limitations under the License.
import hashlib
import select
import random
import string
import os
from os import path
@ -583,6 +585,27 @@ def removeDir(rmDir):
return True
def check_rw(dn):
"""
Проверить досупена ли указанная директория на запись
:param dn:
:return:
"""
def _random_string(l=10):
return "".join(
random.choice(string.ascii_letters) for i in xrange(0, l))
mark_file = None
while mark_file is None or path.exists(mark_file):
mark_file = path.join(dn, "_mark_%s" % _random_string())
try:
open(mark_file, 'w')
os.unlink(mark_file)
return True
except (OSError, IOError):
return False
def removeFileWithEmptyDirectory(rmName, stopDirectory="/"):
"""
Удалить файл и все пустые родительские директории
@ -870,6 +893,7 @@ def getCmdLineParam(paramName):
from device import getUUIDDict
import device
class MountHelper(object):
"""Data reader for fstab"""
data_file = '/etc/fstab'
@ -930,11 +954,13 @@ class MountHelper(object):
filterfunc = lambda x: x[what] != noteq
return bool(filter(filterfunc, self.cache))
class FStab(MountHelper):
"""Data reader for fstab"""
__metaclass__ = SingletonParam
data_file = '/etc/fstab'
class Mounts(MountHelper):
"""Data reader for fstab"""
data_file = '/etc/mtab'

Loading…
Cancel
Save