Merge remote-tracking branch 'origin/master3.4'

master-3.5
commit 2d19ed1063

@ -1,4 +1,4 @@
#!/sbin/runscript
#!/sbin/openrc-run
# Copyright 2015-2016 Mir Calculate. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");

@ -15,8 +15,10 @@
# limitations under the License.
from calculate.core.server.loaded_methods import LoadedMethods
from soaplib.serializers.primitive import String, Integer, Boolean
from soaplib.serializers.primitive import String, Integer, Boolean, string_encoding
from soaplib.serializers.clazz import Array, ClassSerializer
from soaplib.serializers import nillable_value, nillable_element
from soaplib.serializers import string_to_xml
from soaplib.service import rpc
import sys
import pickle
@ -47,6 +49,23 @@ class CommonInfo(ClassSerializer):
Default = Array(String)
CheckAll = Boolean
class LazyString(object):
pass
def lazyable(cl):
def to_xml(cls, value, tns, parent_elt, name='retval'):
if isinstance(value, LazyString):
value = str(value)
if not isinstance(value, unicode):
value = unicode(value, string_encoding)
string_to_xml(cls, value, tns, parent_elt, name)
cl.to_xml = classmethod(nillable_value(to_xml))
return cl
String = lazyable(String)
class DataVarsSerializer(ClassSerializer):
"""Serializer for datavars types"""
@ -73,7 +92,7 @@ class DataVarsSerializer(ClassSerializer):
if type(value) in (list, tuple):
return [""] + map(lambda x: (",".join(x)
if type(x) in (list, tuple)
else str(x)),
else x),
value)
else:
return value

@ -47,7 +47,7 @@ class Variables(MethodsInterface):
section, op, varname = varname.rpartition('.')
if not location:
for env_location in dv.Get('main.cl_env_location'):
if not dv.Delete(varname, location, header=section):
if not dv.Delete(varname, env_location, header=section):
self.printWARNING(
_("Failed to delete variable {var} from "
"{location}").format(

@ -18,6 +18,7 @@ import re
from os import path
from calculate.lib.datavars import (Variable, ReadonlyVariable, VariableError,
TableVariable)
from calculate.core.server.api_types import LazyString
from calculate.lib.cl_lang import setLocalTranslate
@ -168,7 +169,7 @@ class VariableClVariableValue(VarHelper, Variable):
"""
type = "list"
class LazyVal:
class LazyVal(LazyString):
"""
Lazy value return string value only before using
"""

Loading…
Cancel
Save