How to use the spyne.model.primitive.Integer function in spyne

To help you get started, we’ve selected a few spyne examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nexedi / erp5 / bt5 / erp5_interfaces / TestTemplateItem / testSOAPBinding.py View on Github external
    @srpc(Unicode, Integer, _returns=Iterable(Unicode))
    def say_hello(name, times):
        '''
        Docstrings for service methods appear as documentation in the wsdl
        <b>what fun</b>
        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''

        for i in range(times):
            yield u'Hello, %s' % name
github BillBarry / pyqwc / pyqwc / pyqwc.py View on Github external
    @srpc(Unicode,Unicode,Unicode,Unicode,  _returns=Integer)
    def receiveResponseXML( ticket, response, hresult, message ):
        """ contains data requested from Quickbooks
        @param ticket session token sent from this service to web connector
        @param response qbXML response from QuickBooks
        @param hresult The HRESULT (in HEX) from any exception 
        @param message error message
        @return string integer returned 100 means done anything less means there is more to come.
              where can we best get that information?
        """
        logging.debug('receiveResponseXML %s %s %s',ticket,hresult,message)
        logging.log(DEBUG2,'receiveResponseXML %s',response)
        percent_done = session_manager.process_response(ticket,response)
        return percent_done
github arskom / spyne / spyne / util / dictdoc.py View on Github external
ignore_wrappers=True,
                                        complex_as=dict,
                                        ordered=False):

        super(_UtilProtocol, self).__init__(app, validator, mime_type, ignore_uncap,
                                           ignore_wrappers, complex_as, ordered)

        self._from_unicode_handlers[Double] = lambda cls, val: val
        self._from_unicode_handlers[Boolean] = lambda cls, val: val
        self._from_unicode_handlers[Decimal] = lambda cls, val: val
        self._from_unicode_handlers[Integer] = lambda cls, val: val

        self._to_unicode_handlers[Double] = lambda cls, val: val
        self._to_unicode_handlers[Boolean] = lambda cls, val: val
        self._to_unicode_handlers[Decimal] = lambda cls, val: val
        self._to_unicode_handlers[Integer] = lambda cls, val: val
github BillBarry / pyqwc / pyqwc / pyqwc.py View on Github external
    @srpc(Unicode,Unicode,Unicode,Unicode,Integer,Integer,  _returns=Unicode)
    def sendRequestXML( ticket, strHCPResponse, strCompanyFileName, qbXMLCountry, qbXMLMajorVers, qbXMLMinorVers ):
        #?maybe we could hang here, wait for some xml and send it to qwc, that way shortening the wait
        """ send request via web connector to Quickbooks
        @param ticket session token sent from this service to web connector
        @param strHCPResponse qbXML response from QuickBooks
        @param strCompanyFileName The Quickbooks file to get the data from
        @param qbXMLCountry the country version of QuickBooks
        @param qbXMLMajorVers Major version number of the request processor qbXML 
        @param qbXMLMinorVers Minor version number of the request processor qbXML 
        @return string containing the request if there is one or a NoOp
        """
        reqXML = session_manager.get_reqXML(ticket)
        logging.debug('sendRequestXML')
        logging.log(DEBUG2,'sendRequestXML reqXML %s ',reqXML)
        logging.log(DEBUG2,'sendRequestXML strHCPResponse %s ',strHCPResponse)
        return reqXML
github arskom / spyne / spyne / model / primitive.py View on Github external
def TBoundedInteger(num_bits, type_name):
    _min_b = -(0x8&lt;&lt;(num_bits-4))     # 0x8 is 4 bits.
    _max_b =  (0x8&lt;&lt;(num_bits-4)) - 1 # -1? c'est la vie

    class _BoundedInteger(Integer):
        __type_name__ = type_name

        class Attributes(Integer.Attributes):
            max_str_len = math.ceil(math.log(2**num_bits, 10))
            min_bound = _min_b
            max_bound = _max_b

        @staticmethod
        def validate_native(cls, value):
            return (
                    Integer.validate_native(cls, value)
                and (value is None or (_min_b &lt;= value &lt;= _max_b))
            )

    return _BoundedInteger
github Nexedi / erp5 / product / ERP5 / Document / SOAPBinding.py View on Github external
    @rpc(Unicode, Integer, _returns=Iterable(Unicode))
    def say_hello(ctx, name, times):
      '''
      Docstrings for service methods appear as documentation in the wsdl
      <b>what fun</b>
      @param name the name to say hello to
      @param the number of times to say hello
      @return the completed array
      '''
      return [u'Hello, %s' % name] * times
github arskom / spyne / spyne / model / primitive.py View on Github external
def validate_native(cls, value):
            return (
                    Integer.validate_native(cls, value)
                and (value is None or (_min_b &lt;= value &lt;= _max_b))
            )
github arskom / spyne / examples / xml / utils.py View on Github external
class Punk(ComplexModel):
    __namespace__ = 'some_namespace'

    a = String
    b = Integer
    c = Decimal
    d = DateTime


class Foo(ComplexModel):
    __namespace__ = 'some_other_namespace'

    a = String
    b = Integer
    c = Decimal
    d = DateTime
    e = XmlAttribute(Integer)
    f = XmlAttribute(Unicode, attribute_of='d')


class ProductEdition(ComplexModel):
    __namespace__ = 'kickass_namespace'

    id = XmlAttribute(Uuid)
    name = XmlData(Unicode)


class Product(ComplexModel):
    __namespace__ = 'kickass_namespace'
github arskom / spyne / spyne / model / primitive.py View on Github external
AnyDict = AnyDict(type_name="MandatoryDict", min_occurs=1, nillable=False)
    AnyUri = AnyUri(type_name="MandatoryUri", min_occurs=1, nillable=False, min_len=1)
    ImageUri = ImageUri(type_name="MandatoryImageUri", min_occurs=1, nillable=False, min_len=1)

    Boolean = Boolean(type_name="MandatoryBoolean", min_occurs=1, nillable=False)

    Date = Date(type_name="MandatoryDate", min_occurs=1, nillable=False)
    Time = Time(type_name="MandatoryTime", min_occurs=1, nillable=False)
    DateTime = DateTime(type_name="MandatoryDateTime", min_occurs=1, nillable=False)
    Duration = Duration(type_name="MandatoryDuration", min_occurs=1, nillable=False)

    Decimal = Decimal(type_name="MandatoryDecimal", min_occurs=1, nillable=False)
    Double = Double(type_name="MandatoryDouble", min_occurs=1, nillable=False)
    Float = Float(type_name="MandatoryFloat", min_occurs=1, nillable=False)

    Integer = Integer(type_name="MandatoryInteger", min_occurs=1, nillable=False)
    Integer64 = Integer64(type_name="MandatoryLong", min_occurs=1, nillable=False)
    Integer32 = Integer32(type_name="MandatoryInt", min_occurs=1, nillable=False)
    Integer16 = Integer16(type_name="MandatoryShort", min_occurs=1, nillable=False)
    Integer8 = Integer8(type_name="MandatoryByte", min_occurs=1, nillable=False)

    Long = Integer64
    Int = Integer32
    Short = Integer16
    Byte = Integer8

    UnsignedInteger = UnsignedInteger(type_name="MandatoryUnsignedInteger", min_occurs=1, nillable=False)
    UnsignedInteger64 = UnsignedInteger64(type_name="MandatoryUnsignedLong", min_occurs=1, nillable=False)
    UnsignedInteger32 = UnsignedInteger32(type_name="MandatoryUnsignedInt", min_occurs=1, nillable=False)
    UnsignedInteger16 = UnsignedInteger16(type_name="MandatoryUnsignedShort", min_occurs=1, nillable=False)
    UnsignedInteger8 = UnsignedInteger8(type_name="MandatoryUnsignedByte", min_occurs=1, nillable=False)
github arskom / spyne / examples / xml / utils.py View on Github external
__namespace__ = 'some_namespace'

    a = String
    b = Integer
    c = Decimal
    d = DateTime


class Foo(ComplexModel):
    __namespace__ = 'some_other_namespace'

    a = String
    b = Integer
    c = Decimal
    d = DateTime
    e = XmlAttribute(Integer)
    f = XmlAttribute(Unicode, attribute_of='d')


class ProductEdition(ComplexModel):
    __namespace__ = 'kickass_namespace'

    id = XmlAttribute(Uuid)
    name = XmlData(Unicode)


class Product(ComplexModel):
    __namespace__ = 'kickass_namespace'

    id = XmlAttribute(Uuid)
    edition = ProductEdition