Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@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
@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
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
@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
def TBoundedInteger(num_bits, type_name):
_min_b = -(0x8<<(num_bits-4)) # 0x8 is 4 bits.
_max_b = (0x8<<(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 <= value <= _max_b))
)
return _BoundedInteger
@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
def validate_native(cls, value):
return (
Integer.validate_native(cls, value)
and (value is None or (_min_b <= value <= _max_b))
)
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'
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)
__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