Changeset 1665


Ignore:
Timestamp:
31 Mar 2007, 12:16:46 (18 years ago)
Author:
joachim
Message:

add getCallbacksFromLog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1647 r1665  
    531531    ###)
    532532
     533    security.declareProtected(ModifyPortalContent,"getInvalidCallbackTransactions")###(
     534    def getCallbacksFromLog(self,filename):
     535        """fix Online Payment Transactions from Z2.log entries"""
     536        import transaction
     537        import random
     538        from cgi import parse_qs
     539        from urlparse import urlparse
     540        #from pdb import set_trace
     541        wftool = self.portal_workflow
     542        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
     543        students_folder = self.portal_url.getPortalObject().campus.students
     544        s = r'(?P<client_ip>\S+) - (?P<member_id>\S+) \['
     545        s += r'(?P<date>.*)\] "(?P<get>.*)" (?P<codes>\d+ \d+) "'
     546        s += r'(?P<intersw>.*)" "(?P<agent>.*)"'
     547        data = re.compile(s)
     548        start = True
     549        tr_count = 1
     550        total = 0
     551        #name = 'pume_results'
     552        #name = 'epaymentsuccessful_z2log2'
     553        name = filename
     554        no_import = []
     555        imported = []
     556        logger = logging.getLogger('WAeUPTool.getFailedTransactions')
     557        try:
     558            transactions = open("%s/import/%s" % (i_home,name),"rb").readlines()
     559        except:
     560            logger.error('Error reading %s' % name)
     561            return
     562        tas = []
     563        for line in transactions:
     564            dict = {}
     565            items = data.search(line)
     566            dict['idict'] = idict = items.groupdict()
     567            #print idict
     568            #from pdb import set_trace;set_trace()
     569            urlparsed = urlparse(idict['get'][4:])
     570            #print urlparsed
     571            path = urlparsed[2].split('/')
     572            dict['student_id'] = student_id = path[8]
     573            dict['payment_id'] = payment_id = path[10]
     574            dict['qs_dict'] = qs_dict = parse_qs(urlparsed[4])
     575            tas.append(dict)
     576            tr_count += 1
     577        return tas
     578    ###)
     579
    533580    security.declareProtected(ModifyPortalContent,"importOnlinePaymentTransactions")###(
    534581    def importOnlinePaymentTransactions(self):
Note: See TracChangeset for help on using the changeset viewer.