Subversion Repositories SmartDukaan

Rev

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

Rev 15300 Rev 15301
Line 1009... Line 1009...
1009
            
1009
            
1010
    def on_post(self, req, resp, agentId, searchType):
1010
    def on_post(self, req, resp, agentId, searchType):
1011
        try:
1011
        try:
1012
            jsonReq = json.loads(req.stream.read(), encoding='utf-8')
1012
            jsonReq = json.loads(req.stream.read(), encoding='utf-8')
1013
            lgr.info( "Request in Search----\n"  + str(jsonReq))
1013
            lgr.info( "Request in Search----\n"  + str(jsonReq))
1014
            contact=jsonReq.get('searchTerm')
1014
            contact=jsonReq.get('searchTer    m')
1015
            if(searchType=="number"):
1015
            if(searchType=="number"):
1016
                anotherCondition = or_(Retailers.contact1==contact,Retailers.contact2==contact)
1016
                anotherCondition = or_(Retailers.contact1==contact,Retailers.contact2==contact)
1017
            elif(searchType=="counter"):    
1017
            elif(searchType=="counter"):    
1018
                contact = contact.lower()
1018
                contact = contact.lower()
1019
                anotherCondition = or_(Retailers.contact1==contact,Retailers.contact2==contact)
1019
                anotherCondition = Retailers.title==contact
1020
            
1020
            
1021
            searchUser = session.query(Retailers).filter(Retailers.modified != None).filter(anotherCondition).all()
1021
            searchUser = session.query(Retailers).filter(Retailers.modified != None).filter(anotherCondition).all()
1022
            if searchUser is None:
1022
            if searchUser is None:
1023
                resp.body = json.dumps("{}")
1023
                resp.body = json.dumps("{}")
1024
            else:    
1024
            else: