Subversion Repositories SmartDukaan

Rev

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

Rev 1422 Rev 1610
Line 138... Line 138...
138
     - username
138
     - username
139
     - password
139
     - password
140
    """
140
    """
141
    pass
141
    pass
142
 
142
 
-
 
143
  def authenticateStatisticsUser(self, username, password):
-
 
144
    """
-
 
145
    Returns the StatisticsUser struct associated with the given username and password if they match.
-
 
146
    Throws an exception otherwise.
-
 
147
    
-
 
148
    Parameters:
-
 
149
     - username
-
 
150
     - password
-
 
151
    """
-
 
152
    pass
-
 
153
 
143
 
154
 
144
class Client(Iface):
155
class Client(Iface):
145
  def __init__(self, iprot, oprot=None):
156
  def __init__(self, iprot, oprot=None):
146
    self._iprot = self._oprot = iprot
157
    self._iprot = self._oprot = iprot
147
    if oprot != None:
158
    if oprot != None:
Line 641... Line 652...
641
      return result.success
652
      return result.success
642
    if result.hse != None:
653
    if result.hse != None:
643
      raise result.hse
654
      raise result.hse
644
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateLogisticsUser failed: unknown result");
655
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateLogisticsUser failed: unknown result");
645
 
656
 
-
 
657
  def authenticateStatisticsUser(self, username, password):
-
 
658
    """
-
 
659
    Returns the StatisticsUser struct associated with the given username and password if they match.
-
 
660
    Throws an exception otherwise.
-
 
661
    
-
 
662
    Parameters:
-
 
663
     - username
-
 
664
     - password
-
 
665
    """
-
 
666
    self.send_authenticateStatisticsUser(username, password)
-
 
667
    return self.recv_authenticateStatisticsUser()
-
 
668
 
-
 
669
  def send_authenticateStatisticsUser(self, username, password):
-
 
670
    self._oprot.writeMessageBegin('authenticateStatisticsUser', TMessageType.CALL, self._seqid)
-
 
671
    args = authenticateStatisticsUser_args()
-
 
672
    args.username = username
-
 
673
    args.password = password
-
 
674
    args.write(self._oprot)
-
 
675
    self._oprot.writeMessageEnd()
-
 
676
    self._oprot.trans.flush()
-
 
677
 
-
 
678
  def recv_authenticateStatisticsUser(self, ):
-
 
679
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
680
    if mtype == TMessageType.EXCEPTION:
-
 
681
      x = TApplicationException()
-
 
682
      x.read(self._iprot)
-
 
683
      self._iprot.readMessageEnd()
-
 
684
      raise x
-
 
685
    result = authenticateStatisticsUser_result()
-
 
686
    result.read(self._iprot)
-
 
687
    self._iprot.readMessageEnd()
-
 
688
    if result.success != None:
-
 
689
      return result.success
-
 
690
    if result.hse != None:
-
 
691
      raise result.hse
-
 
692
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateStatisticsUser failed: unknown result");
-
 
693
 
646
 
694
 
647
class Processor(Iface, TProcessor):
695
class Processor(Iface, TProcessor):
648
  def __init__(self, handler):
696
  def __init__(self, handler):
649
    self._handler = handler
697
    self._handler = handler
650
    self._processMap = {}
698
    self._processMap = {}
Line 661... Line 709...
661
    self._processMap["addUser"] = Processor.process_addUser
709
    self._processMap["addUser"] = Processor.process_addUser
662
    self._processMap["deleteUser"] = Processor.process_deleteUser
710
    self._processMap["deleteUser"] = Processor.process_deleteUser
663
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
711
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
664
    self._processMap["updatePassword"] = Processor.process_updatePassword
712
    self._processMap["updatePassword"] = Processor.process_updatePassword
665
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
713
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
-
 
714
    self._processMap["authenticateStatisticsUser"] = Processor.process_authenticateStatisticsUser
666
 
715
 
667
  def process(self, iprot, oprot):
716
  def process(self, iprot, oprot):
668
    (name, type, seqid) = iprot.readMessageBegin()
717
    (name, type, seqid) = iprot.readMessageBegin()
669
    if name not in self._processMap:
718
    if name not in self._processMap:
670
      iprot.skip(TType.STRUCT)
719
      iprot.skip(TType.STRUCT)
Line 884... Line 933...
884
    oprot.writeMessageBegin("authenticateLogisticsUser", TMessageType.REPLY, seqid)
933
    oprot.writeMessageBegin("authenticateLogisticsUser", TMessageType.REPLY, seqid)
885
    result.write(oprot)
934
    result.write(oprot)
886
    oprot.writeMessageEnd()
935
    oprot.writeMessageEnd()
887
    oprot.trans.flush()
936
    oprot.trans.flush()
888
 
937
 
-
 
938
  def process_authenticateStatisticsUser(self, seqid, iprot, oprot):
-
 
939
    args = authenticateStatisticsUser_args()
-
 
940
    args.read(iprot)
-
 
941
    iprot.readMessageEnd()
-
 
942
    result = authenticateStatisticsUser_result()
-
 
943
    try:
-
 
944
      result.success = self._handler.authenticateStatisticsUser(args.username, args.password)
-
 
945
    except HelperServiceException, hse:
-
 
946
      result.hse = hse
-
 
947
    oprot.writeMessageBegin("authenticateStatisticsUser", TMessageType.REPLY, seqid)
-
 
948
    result.write(oprot)
-
 
949
    oprot.writeMessageEnd()
-
 
950
    oprot.trans.flush()
-
 
951
 
889
 
952
 
890
# HELPER FUNCTIONS AND STRUCTURES
953
# HELPER FUNCTIONS AND STRUCTURES
891
 
954
 
892
class closeSession_args:
955
class closeSession_args:
893
 
956
 
Line 2797... Line 2860...
2797
    if self.success != None:
2860
    if self.success != None:
2798
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
2861
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
2799
      self.success.write(oprot)
2862
      self.success.write(oprot)
2800
      oprot.writeFieldEnd()
2863
      oprot.writeFieldEnd()
2801
    if self.hse != None:
2864
    if self.hse != None:
-
 
2865
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
-
 
2866
      self.hse.write(oprot)
-
 
2867
      oprot.writeFieldEnd()
-
 
2868
    oprot.writeFieldStop()
-
 
2869
    oprot.writeStructEnd()
-
 
2870
 
-
 
2871
  def __repr__(self):
-
 
2872
    L = ['%s=%r' % (key, value)
-
 
2873
      for key, value in self.__dict__.iteritems()]
-
 
2874
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2875
 
-
 
2876
  def __eq__(self, other):
-
 
2877
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2878
 
-
 
2879
  def __ne__(self, other):
-
 
2880
    return not (self == other)
-
 
2881
 
-
 
2882
class authenticateStatisticsUser_args:
-
 
2883
  """
-
 
2884
  Attributes:
-
 
2885
   - username
-
 
2886
   - password
-
 
2887
  """
-
 
2888
 
-
 
2889
  thrift_spec = (
-
 
2890
    None, # 0
-
 
2891
    (1, TType.STRING, 'username', None, None, ), # 1
-
 
2892
    (2, TType.STRING, 'password', None, None, ), # 2
-
 
2893
  )
-
 
2894
 
-
 
2895
  def __init__(self, username=None, password=None,):
-
 
2896
    self.username = username
-
 
2897
    self.password = password
-
 
2898
 
-
 
2899
  def read(self, iprot):
-
 
2900
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2901
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2902
      return
-
 
2903
    iprot.readStructBegin()
-
 
2904
    while True:
-
 
2905
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2906
      if ftype == TType.STOP:
-
 
2907
        break
-
 
2908
      if fid == 1:
-
 
2909
        if ftype == TType.STRING:
-
 
2910
          self.username = iprot.readString();
-
 
2911
        else:
-
 
2912
          iprot.skip(ftype)
-
 
2913
      elif fid == 2:
-
 
2914
        if ftype == TType.STRING:
-
 
2915
          self.password = iprot.readString();
-
 
2916
        else:
-
 
2917
          iprot.skip(ftype)
-
 
2918
      else:
-
 
2919
        iprot.skip(ftype)
-
 
2920
      iprot.readFieldEnd()
-
 
2921
    iprot.readStructEnd()
-
 
2922
 
-
 
2923
  def write(self, oprot):
-
 
2924
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2925
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2926
      return
-
 
2927
    oprot.writeStructBegin('authenticateStatisticsUser_args')
-
 
2928
    if self.username != None:
-
 
2929
      oprot.writeFieldBegin('username', TType.STRING, 1)
-
 
2930
      oprot.writeString(self.username)
-
 
2931
      oprot.writeFieldEnd()
-
 
2932
    if self.password != None:
-
 
2933
      oprot.writeFieldBegin('password', TType.STRING, 2)
-
 
2934
      oprot.writeString(self.password)
-
 
2935
      oprot.writeFieldEnd()
-
 
2936
    oprot.writeFieldStop()
-
 
2937
    oprot.writeStructEnd()
-
 
2938
 
-
 
2939
  def __repr__(self):
-
 
2940
    L = ['%s=%r' % (key, value)
-
 
2941
      for key, value in self.__dict__.iteritems()]
-
 
2942
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2943
 
-
 
2944
  def __eq__(self, other):
-
 
2945
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2946
 
-
 
2947
  def __ne__(self, other):
-
 
2948
    return not (self == other)
-
 
2949
 
-
 
2950
class authenticateStatisticsUser_result:
-
 
2951
  """
-
 
2952
  Attributes:
-
 
2953
   - success
-
 
2954
   - hse
-
 
2955
  """
-
 
2956
 
-
 
2957
  thrift_spec = (
-
 
2958
    (0, TType.STRUCT, 'success', (StatisticsUser, StatisticsUser.thrift_spec), None, ), # 0
-
 
2959
    (1, TType.STRUCT, 'hse', (HelperServiceException, HelperServiceException.thrift_spec), None, ), # 1
-
 
2960
  )
-
 
2961
 
-
 
2962
  def __init__(self, success=None, hse=None,):
-
 
2963
    self.success = success
-
 
2964
    self.hse = hse
-
 
2965
 
-
 
2966
  def read(self, iprot):
-
 
2967
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2968
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2969
      return
-
 
2970
    iprot.readStructBegin()
-
 
2971
    while True:
-
 
2972
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2973
      if ftype == TType.STOP:
-
 
2974
        break
-
 
2975
      if fid == 0:
-
 
2976
        if ftype == TType.STRUCT:
-
 
2977
          self.success = StatisticsUser()
-
 
2978
          self.success.read(iprot)
-
 
2979
        else:
-
 
2980
          iprot.skip(ftype)
-
 
2981
      elif fid == 1:
-
 
2982
        if ftype == TType.STRUCT:
-
 
2983
          self.hse = HelperServiceException()
-
 
2984
          self.hse.read(iprot)
-
 
2985
        else:
-
 
2986
          iprot.skip(ftype)
-
 
2987
      else:
-
 
2988
        iprot.skip(ftype)
-
 
2989
      iprot.readFieldEnd()
-
 
2990
    iprot.readStructEnd()
-
 
2991
 
-
 
2992
  def write(self, oprot):
-
 
2993
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2994
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2995
      return
-
 
2996
    oprot.writeStructBegin('authenticateStatisticsUser_result')
-
 
2997
    if self.success != None:
-
 
2998
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
2999
      self.success.write(oprot)
-
 
3000
      oprot.writeFieldEnd()
-
 
3001
    if self.hse != None:
2802
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
3002
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
2803
      self.hse.write(oprot)
3003
      self.hse.write(oprot)
2804
      oprot.writeFieldEnd()
3004
      oprot.writeFieldEnd()
2805
    oprot.writeFieldStop()
3005
    oprot.writeFieldStop()
2806
    oprot.writeStructEnd()
3006
    oprot.writeStructEnd()