Use new TextType

+ fix Property usage in tcp.py

Change-Id: I254ddfe30605298ce419667e9b1985df48ef824a
Reviewed-on: https://forge.frm2.tum.de/review/20952
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
Enrico Faulhaber 2019-07-24 14:29:08 +02:00
parent c7c9403d1f
commit 125f0d83e9
3 changed files with 11 additions and 8 deletions

View File

@ -28,7 +28,7 @@ import time
from collections import OrderedDict from collections import OrderedDict
from secop.datatypes import EnumType, FloatRange, BoolType, IntRange, \ from secop.datatypes import EnumType, FloatRange, BoolType, IntRange, \
StringType, TupleOf, get_datatype, ArrayOf StringType, TupleOf, get_datatype, ArrayOf, TextType
from secop.errors import ConfigError, ProgrammingError from secop.errors import ConfigError, ProgrammingError
from secop.lib import formatException, \ from secop.lib import formatException, \
formatExtendedStack, mkthread, unset_value formatExtendedStack, mkthread, unset_value
@ -70,7 +70,7 @@ class Module(HasProperties):
properties = { properties = {
'export': Property('Flag if this Module is to be exported', BoolType(), default=True, export=False), 'export': Property('Flag if this Module is to be exported', BoolType(), default=True, export=False),
'group': Property('Optional group the Module belongs to', StringType(), default='', extname='group'), 'group': Property('Optional group the Module belongs to', StringType(), default='', extname='group'),
'description': Property('Description of the module', StringType(), extname='description', mandatory=True), 'description': Property('Description of the module', TextType(), extname='description', mandatory=True),
'meaning': Property('Optional Meaning indicator', TupleOf(StringType(),IntRange(0,50)), 'meaning': Property('Optional Meaning indicator', TupleOf(StringType(),IntRange(0,50)),
default=('',0), extname='meaning'), default=('',0), extname='meaning'),
'visibility': Property('Optional visibility hint', EnumType('visibility', user=1, advanced=2, expert=3), 'visibility': Property('Optional visibility hint', EnumType('visibility', user=1, advanced=2, expert=3),

View File

@ -26,7 +26,7 @@ from __future__ import division, print_function
from collections import OrderedDict from collections import OrderedDict
from secop.datatypes import CommandType, DataType, StringType, BoolType, EnumType, DataTypeType, ValueType, OrType, \ from secop.datatypes import CommandType, DataType, StringType, BoolType, EnumType, DataTypeType, ValueType, OrType, \
NoneOr NoneOr, TextType
from secop.errors import ProgrammingError from secop.errors import ProgrammingError
from secop.properties import HasProperties, Property from secop.properties import HasProperties, Property
@ -92,7 +92,7 @@ class Parameter(Accessible):
""" """
properties = { properties = {
u'description': Property('Description of the Parameter', StringType(), u'description': Property('Description of the Parameter', TextType(),
extname=u'description', mandatory=True), extname=u'description', mandatory=True),
u'datatype': Property('Datatype of the Parameter', DataTypeType(), u'datatype': Property('Datatype of the Parameter', DataTypeType(),
extname=u'datatype', mandatory=True), extname=u'datatype', mandatory=True),
@ -251,7 +251,7 @@ class Command(Accessible):
""" """
# datatype is not listed (handled separately) # datatype is not listed (handled separately)
properties = { properties = {
u'description': Property('Description of the Command', StringType(), u'description': Property('Description of the Command', TextType(),
extname=u'description', export=True, mandatory=True), extname=u'description', export=True, mandatory=True),
u'group': Property('Optional command group of the command.', StringType(), u'group': Property('Optional command group of the command.', StringType(),
extname=u'group', export=True, default=''), extname=u'group', export=True, default=''),

View File

@ -187,9 +187,12 @@ class TCPServer(HasProperties, socketserver.ThreadingTCPServer):
allow_reuse_address = True allow_reuse_address = True
properties = { properties = {
'bindto' : Property(StringType(), default='localhost:%d' % DEF_PORT, export=False), 'bindto' : Property('hostname or ip address for binding',StringType(),
'bindport' : Property(IntRange(1,65535), default=DEF_PORT, export=False), default='localhost:%d' % DEF_PORT, export=False),
'detailed_errors': Property(BoolType(), default=False, export=False), 'bindport' : Property('port number to bind',IntRange(1,65535),
default=DEF_PORT, export=False),
'detailed_errors': Property('Flag to enable detailed Errorreporting.', BoolType(),
default=False, export=False),
} }
# XXX: create configurables from Metaclass! # XXX: create configurables from Metaclass!