예제 #1
0
 def is_default(cls):
     return (    SimpleModel.is_default(cls)
             and cls.Attributes.gt == Decimal.Attributes.gt
             and cls.Attributes.ge == Decimal.Attributes.ge
             and cls.Attributes.lt == Decimal.Attributes.lt
             and cls.Attributes.le == Decimal.Attributes.le
         )
예제 #2
0
 def validate_native(cls, value):
     return (    SimpleModel.validate_native(cls, value) and
             value is None or (
                 value >  cls.Attributes.gt and
                 value >= cls.Attributes.ge and
                 value <  cls.Attributes.lt and
                 value <= cls.Attributes.le
         ))
예제 #3
0
 def validate_string(cls, value):
     return (     SimpleModel.validate_string(cls, value)
             and (value is None or (
                     len(value) >= cls.Attributes.min_len and
                     len(value) <= cls.Attributes.max_len))
             and (cls.Attributes.pattern is None or
                         re.match(cls.Attributes.pattern, value) is not None)
         )
예제 #4
0
    def __new__(cls, *args, **kwargs):
        assert len(args) <= 1

        if len(args) == 1:
            kwargs['max_len'] = args[0]

        retval = SimpleModel.__new__(cls,  ** kwargs)

        return retval
예제 #5
0
파일: primitive.py 프로젝트: rch/rpclib
    def __new__(cls, *args, **kwargs):
        assert len(args) <= 1

        if len(args) == 1:
            kwargs['max_len'] = args[0]

        retval = SimpleModel.__new__(cls, **kwargs)

        return retval
예제 #6
0
 def is_default(cls):
     return (    SimpleModel.is_default(cls)
             and cls.Attributes.min_len == Unicode.Attributes.min_len
             and cls.Attributes.max_len == Unicode.Attributes.max_len
             and cls.Attributes.pattern == Unicode.Attributes.pattern)
예제 #7
0
    def to_parent_element(cls, value, tns, parent_elt, name='retval'):
        if name is None:
            name = cls.get_type_name()

        SimpleModel.to_parent_element(str(value), tns, parent_elt, name)
예제 #8
0
파일: primitive.py 프로젝트: isbaran/rpclib
 def to_parent_element(cls, value, tns, parent_elt, name='retval'):
     duration = XmlDuration.parse(value)
     SimpleModel.to_parent_element(str(duration), tns, parent_elt, name)
예제 #9
0
 def validate_string(cls, value):
     return (    SimpleModel.validate_string(cls, value)
             and value in cls.__values__
         )
예제 #10
0
파일: primitive.py 프로젝트: rch/rpclib
 def validate_native(cls, value):
     return (SimpleModel.validate_native(cls, value) and value is None or
             (value > cls.Attributes.gt and value >= cls.Attributes.ge
              and value < cls.Attributes.lt and value <= cls.Attributes.le))
예제 #11
0
파일: primitive.py 프로젝트: rch/rpclib
 def is_default(cls):
     return (SimpleModel.is_default(cls)
             and cls.Attributes.gt == Decimal.Attributes.gt
             and cls.Attributes.ge == Decimal.Attributes.ge
             and cls.Attributes.lt == Decimal.Attributes.lt
             and cls.Attributes.le == Decimal.Attributes.le)
예제 #12
0
파일: primitive.py 프로젝트: rch/rpclib
 def validate_string(cls, value):
     return (SimpleModel.validate_string(cls, value) and
             (value is None or (len(value) >= cls.Attributes.min_len
                                and len(value) <= cls.Attributes.max_len))
             and (cls.Attributes.pattern is None
                  or re.match(cls.Attributes.pattern, value) is not None))
예제 #13
0
파일: primitive.py 프로젝트: rch/rpclib
 def is_default(cls):
     return (SimpleModel.is_default(cls)
             and cls.Attributes.min_len == String.Attributes.min_len
             and cls.Attributes.max_len == String.Attributes.max_len
             and cls.Attributes.pattern == String.Attributes.pattern)
예제 #14
0
파일: enum.py 프로젝트: rch/rpclib
 def validate_string(cls, value):
     return (    SimpleModel.validate_string(cls, value)
             and value in cls.__values__
         )