Subversion Repositories SmartDukaan

Rev

Rev 353 | Rev 494 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 353 Rev 472
Line 14... Line 14...
14
except:
14
except:
15
  fastbinary = None
15
  fastbinary = None
16
 
16
 
17
 
17
 
18
class Iface:
18
class Iface:
19
  def getLogisticsEstimation(self, itemId, location):
-
 
20
    """
-
 
21
    Parameters:
-
 
22
     - itemId
-
 
23
     - location
-
 
24
    """
-
 
25
    pass
-
 
26
 
-
 
27
  def sendMail(self, mail):
19
  def sendMail(self, mail):
28
    """
20
    """
29
    Parameters:
21
    Parameters:
30
     - mail
22
     - mail
31
    """
23
    """
Line 74... Line 66...
74
    self._iprot = self._oprot = iprot
66
    self._iprot = self._oprot = iprot
75
    if oprot != None:
67
    if oprot != None:
76
      self._oprot = oprot
68
      self._oprot = oprot
77
    self._seqid = 0
69
    self._seqid = 0
78
 
70
 
79
  def getLogisticsEstimation(self, itemId, location):
-
 
80
    """
-
 
81
    Parameters:
-
 
82
     - itemId
-
 
83
     - location
-
 
84
    """
-
 
85
    self.send_getLogisticsEstimation(itemId, location)
-
 
86
    return self.recv_getLogisticsEstimation()
-
 
87
 
-
 
88
  def send_getLogisticsEstimation(self, itemId, location):
-
 
89
    self._oprot.writeMessageBegin('getLogisticsEstimation', TMessageType.CALL, self._seqid)
-
 
90
    args = getLogisticsEstimation_args()
-
 
91
    args.itemId = itemId
-
 
92
    args.location = location
-
 
93
    args.write(self._oprot)
-
 
94
    self._oprot.writeMessageEnd()
-
 
95
    self._oprot.trans.flush()
-
 
96
 
-
 
97
  def recv_getLogisticsEstimation(self, ):
-
 
98
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
99
    if mtype == TMessageType.EXCEPTION:
-
 
100
      x = TApplicationException()
-
 
101
      x.read(self._iprot)
-
 
102
      self._iprot.readMessageEnd()
-
 
103
      raise x
-
 
104
    result = getLogisticsEstimation_result()
-
 
105
    result.read(self._iprot)
-
 
106
    self._iprot.readMessageEnd()
-
 
107
    if result.success != None:
-
 
108
      return result.success
-
 
109
    if result.se != None:
-
 
110
      raise result.se
-
 
111
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLogisticsEstimation failed: unknown result");
-
 
112
 
-
 
113
  def sendMail(self, mail):
71
  def sendMail(self, mail):
114
    """
72
    """
115
    Parameters:
73
    Parameters:
116
     - mail
74
     - mail
117
    """
75
    """
Line 301... Line 259...
301
 
259
 
302
class Processor(Iface, TProcessor):
260
class Processor(Iface, TProcessor):
303
  def __init__(self, handler):
261
  def __init__(self, handler):
304
    self._handler = handler
262
    self._handler = handler
305
    self._processMap = {}
263
    self._processMap = {}
306
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
-
 
307
    self._processMap["sendMail"] = Processor.process_sendMail
264
    self._processMap["sendMail"] = Processor.process_sendMail
308
    self._processMap["sendText"] = Processor.process_sendText
265
    self._processMap["sendText"] = Processor.process_sendText
309
    self._processMap["addMessage"] = Processor.process_addMessage
266
    self._processMap["addMessage"] = Processor.process_addMessage
310
    self._processMap["updateMessage"] = Processor.process_updateMessage
267
    self._processMap["updateMessage"] = Processor.process_updateMessage
311
    self._processMap["getMessage"] = Processor.process_getMessage
268
    self._processMap["getMessage"] = Processor.process_getMessage
Line 324... Line 281...
324
      return
281
      return
325
    else:
282
    else:
326
      self._processMap[name](self, seqid, iprot, oprot)
283
      self._processMap[name](self, seqid, iprot, oprot)
327
    return True
284
    return True
328
 
285
 
329
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
-
 
330
    args = getLogisticsEstimation_args()
-
 
331
    args.read(iprot)
-
 
332
    iprot.readMessageEnd()
-
 
333
    result = getLogisticsEstimation_result()
-
 
334
    try:
-
 
335
      result.success = self._handler.getLogisticsEstimation(args.itemId, args.location)
-
 
336
    except HelperServiceException, se:
-
 
337
      result.se = se
-
 
338
    oprot.writeMessageBegin("getLogisticsEstimation", TMessageType.REPLY, seqid)
-
 
339
    result.write(oprot)
-
 
340
    oprot.writeMessageEnd()
-
 
341
    oprot.trans.flush()
-
 
342
 
-
 
343
  def process_sendMail(self, seqid, iprot, oprot):
286
  def process_sendMail(self, seqid, iprot, oprot):
344
    args = sendMail_args()
287
    args = sendMail_args()
345
    args.read(iprot)
288
    args.read(iprot)
346
    iprot.readMessageEnd()
289
    iprot.readMessageEnd()
347
    result = sendMail_result()
290
    result = sendMail_result()
Line 425... Line 368...
425
    oprot.trans.flush()
368
    oprot.trans.flush()
426
 
369
 
427
 
370
 
428
# HELPER FUNCTIONS AND STRUCTURES
371
# HELPER FUNCTIONS AND STRUCTURES
429
 
372
 
430
class getLogisticsEstimation_args:
-
 
431
  """
-
 
432
  Attributes:
-
 
433
   - itemId
-
 
434
   - location
-
 
435
  """
-
 
436
 
-
 
437
  thrift_spec = (
-
 
438
    None, # 0
-
 
439
    (1, TType.I64, 'itemId', None, None, ), # 1
-
 
440
    (2, TType.MAP, 'location', (TType.STRING,None,TType.STRING,None), None, ), # 2
-
 
441
  )
-
 
442
 
-
 
443
  def __init__(self, itemId=None, location=None,):
-
 
444
    self.itemId = itemId
-
 
445
    self.location = location
-
 
446
 
-
 
447
  def read(self, iprot):
-
 
448
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
449
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
450
      return
-
 
451
    iprot.readStructBegin()
-
 
452
    while True:
-
 
453
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
454
      if ftype == TType.STOP:
-
 
455
        break
-
 
456
      if fid == 1:
-
 
457
        if ftype == TType.I64:
-
 
458
          self.itemId = iprot.readI64();
-
 
459
        else:
-
 
460
          iprot.skip(ftype)
-
 
461
      elif fid == 2:
-
 
462
        if ftype == TType.MAP:
-
 
463
          self.location = {}
-
 
464
          (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin() 
-
 
465
          for _i18 in xrange(_size14):
-
 
466
            _key19 = iprot.readString();
-
 
467
            _val20 = iprot.readString();
-
 
468
            self.location[_key19] = _val20
-
 
469
          iprot.readMapEnd()
-
 
470
        else:
-
 
471
          iprot.skip(ftype)
-
 
472
      else:
-
 
473
        iprot.skip(ftype)
-
 
474
      iprot.readFieldEnd()
-
 
475
    iprot.readStructEnd()
-
 
476
 
-
 
477
  def write(self, oprot):
-
 
478
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
479
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
480
      return
-
 
481
    oprot.writeStructBegin('getLogisticsEstimation_args')
-
 
482
    if self.itemId != None:
-
 
483
      oprot.writeFieldBegin('itemId', TType.I64, 1)
-
 
484
      oprot.writeI64(self.itemId)
-
 
485
      oprot.writeFieldEnd()
-
 
486
    if self.location != None:
-
 
487
      oprot.writeFieldBegin('location', TType.MAP, 2)
-
 
488
      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.location))
-
 
489
      for kiter21,viter22 in self.location.items():
-
 
490
        oprot.writeString(kiter21)
-
 
491
        oprot.writeString(viter22)
-
 
492
      oprot.writeMapEnd()
-
 
493
      oprot.writeFieldEnd()
-
 
494
    oprot.writeFieldStop()
-
 
495
    oprot.writeStructEnd()
-
 
496
 
-
 
497
  def __repr__(self):
-
 
498
    L = ['%s=%r' % (key, value)
-
 
499
      for key, value in self.__dict__.iteritems()]
-
 
500
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
501
 
-
 
502
  def __eq__(self, other):
-
 
503
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
504
 
-
 
505
  def __ne__(self, other):
-
 
506
    return not (self == other)
-
 
507
 
-
 
508
class getLogisticsEstimation_result:
-
 
509
  """
-
 
510
  Attributes:
-
 
511
   - success
-
 
512
   - se
-
 
513
  """
-
 
514
 
-
 
515
  thrift_spec = (
-
 
516
    (0, TType.LIST, 'success', (TType.STRUCT,(ItemLogistics, ItemLogistics.thrift_spec)), None, ), # 0
-
 
517
    (1, TType.STRUCT, 'se', (HelperServiceException, HelperServiceException.thrift_spec), None, ), # 1
-
 
518
  )
-
 
519
 
-
 
520
  def __init__(self, success=None, se=None,):
-
 
521
    self.success = success
-
 
522
    self.se = se
-
 
523
 
-
 
524
  def read(self, iprot):
-
 
525
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
526
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
527
      return
-
 
528
    iprot.readStructBegin()
-
 
529
    while True:
-
 
530
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
531
      if ftype == TType.STOP:
-
 
532
        break
-
 
533
      if fid == 0:
-
 
534
        if ftype == TType.LIST:
-
 
535
          self.success = []
-
 
536
          (_etype26, _size23) = iprot.readListBegin()
-
 
537
          for _i27 in xrange(_size23):
-
 
538
            _elem28 = ItemLogistics()
-
 
539
            _elem28.read(iprot)
-
 
540
            self.success.append(_elem28)
-
 
541
          iprot.readListEnd()
-
 
542
        else:
-
 
543
          iprot.skip(ftype)
-
 
544
      elif fid == 1:
-
 
545
        if ftype == TType.STRUCT:
-
 
546
          self.se = HelperServiceException()
-
 
547
          self.se.read(iprot)
-
 
548
        else:
-
 
549
          iprot.skip(ftype)
-
 
550
      else:
-
 
551
        iprot.skip(ftype)
-
 
552
      iprot.readFieldEnd()
-
 
553
    iprot.readStructEnd()
-
 
554
 
-
 
555
  def write(self, oprot):
-
 
556
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
557
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
558
      return
-
 
559
    oprot.writeStructBegin('getLogisticsEstimation_result')
-
 
560
    if self.success != None:
-
 
561
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
562
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
563
      for iter29 in self.success:
-
 
564
        iter29.write(oprot)
-
 
565
      oprot.writeListEnd()
-
 
566
      oprot.writeFieldEnd()
-
 
567
    if self.se != None:
-
 
568
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
-
 
569
      self.se.write(oprot)
-
 
570
      oprot.writeFieldEnd()
-
 
571
    oprot.writeFieldStop()
-
 
572
    oprot.writeStructEnd()
-
 
573
 
-
 
574
  def __repr__(self):
-
 
575
    L = ['%s=%r' % (key, value)
-
 
576
      for key, value in self.__dict__.iteritems()]
-
 
577
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
578
 
-
 
579
  def __eq__(self, other):
-
 
580
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
581
 
-
 
582
  def __ne__(self, other):
-
 
583
    return not (self == other)
-
 
584
 
-
 
585
class sendMail_args:
373
class sendMail_args:
586
  """
374
  """
587
  Attributes:
375
  Attributes:
588
   - mail
376
   - mail
589
  """
377
  """
Line 1206... Line 994...
1206
        else:
994
        else:
1207
          iprot.skip(ftype)
995
          iprot.skip(ftype)
1208
      elif fid == 2:
996
      elif fid == 2:
1209
        if ftype == TType.MAP:
997
        if ftype == TType.MAP:
1210
          self.params = {}
998
          self.params = {}
1211
          (_ktype31, _vtype32, _size30 ) = iprot.readMapBegin() 
999
          (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin() 
1212
          for _i34 in xrange(_size30):
1000
          for _i18 in xrange(_size14):
1213
            _key35 = iprot.readString();
1001
            _key19 = iprot.readString();
1214
            _val36 = iprot.readString();
1002
            _val20 = iprot.readString();
1215
            self.params[_key35] = _val36
1003
            self.params[_key19] = _val20
1216
          iprot.readMapEnd()
1004
          iprot.readMapEnd()
1217
        else:
1005
        else:
1218
          iprot.skip(ftype)
1006
          iprot.skip(ftype)
1219
      else:
1007
      else:
1220
        iprot.skip(ftype)
1008
        iprot.skip(ftype)
Line 1231... Line 1019...
1231
      oprot.writeI64(self.id)
1019
      oprot.writeI64(self.id)
1232
      oprot.writeFieldEnd()
1020
      oprot.writeFieldEnd()
1233
    if self.params != None:
1021
    if self.params != None:
1234
      oprot.writeFieldBegin('params', TType.MAP, 2)
1022
      oprot.writeFieldBegin('params', TType.MAP, 2)
1235
      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.params))
1023
      oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.params))
1236
      for kiter37,viter38 in self.params.items():
1024
      for kiter21,viter22 in self.params.items():
1237
        oprot.writeString(kiter37)
1025
        oprot.writeString(kiter21)
1238
        oprot.writeString(viter38)
1026
        oprot.writeString(viter22)
1239
      oprot.writeMapEnd()
1027
      oprot.writeMapEnd()
1240
      oprot.writeFieldEnd()
1028
      oprot.writeFieldEnd()
1241
    oprot.writeFieldStop()
1029
    oprot.writeFieldStop()
1242
    oprot.writeStructEnd()
1030
    oprot.writeStructEnd()
1243
 
1031