From: <ke...@us...> - 2006-04-18 15:28:55
|
Revision: 2923 Author: kevca Date: 2006-04-18 08:28:43 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/mailmanager/?rev=2923&view=rev Log Message: ----------- Changes for deviations between 2.0 and 2.1 for the fix for - Archive and Restore functionality broken (#1452514) Modified Paths: -------------- MailManager/branches/RELENG_2_1/MMImportHandler.py MailManager/branches/RELENG_2_1/MailManager.py MailManager/branches/RELENG_2_1/tests/testAPI.py MailManager/branches/RELENG_2_1/tests/testExporting.py Modified: MailManager/branches/RELENG_2_1/MMImportHandler.py =================================================================== --- MailManager/branches/RELENG_2_1/MMImportHandler.py 2006-04-18 15:27:33 UTC (rev 2922) +++ MailManager/branches/RELENG_2_1/MMImportHandler.py 2006-04-18 15:28:43 UTC (rev 2923) @@ -51,6 +51,11 @@ raise NotImplementedError("Error - No current support for attachments with MS SQL") else: raise NotImplementedError("Error - Support for attachments does not exist on this database platform") + + # Name mangle the row, before it gets passed to the sql methods + for key in self.row.keys(): + self.row['sqv_%s' % key] = self.row[key] + if name == 'ticket': self.sql.addTicket(self.row) zLOG.LOG(subsystem='MailManager', Modified: MailManager/branches/RELENG_2_1/MailManager.py =================================================================== --- MailManager/branches/RELENG_2_1/MailManager.py 2006-04-18 15:27:33 UTC (rev 2922) +++ MailManager/branches/RELENG_2_1/MailManager.py 2006-04-18 15:28:43 UTC (rev 2923) @@ -2831,11 +2831,11 @@ security.declareProtected('MailManager Settings', 'http_deleteTickets') def http_deleteTickets(self, to_date, account_id, section, REQUEST, RESPONSE, - status='', category0='', category1='', + state='', category0='', category1='', category2='', archive=False): """Delete selected tickets.""" if section == 'delete': - if status is None: + if state is None: REQUEST.set('error', 'You must select at least one state.') REQUEST.set('section', 'delete') else: @@ -2844,19 +2844,10 @@ if archive: f = self.archiveTickets(to_date = to_date, - account_id = account_id, status = status, + account_id = account_id, state = state, category0 = category0, category1 = category1, category2 = category2) - # In all cases we need to delete the tickets - self.sql.deleteTickets(sqv_to_date=to_date, - sqv_account_id=account_id, - sqv_state=state, - sqv_category0=category0, - sqv_category1=category1, - sqv_category2=category2) - - if archive: # Return the archive file RESPONSE.setHeader('Content-Type', 'text/xml') RESPONSE.setHeader('Content-Disposition', @@ -2868,7 +2859,7 @@ # In all cases we need to delete the tickets self.deleteTickets(to_date=to_date, account_id=account_id, - status=status, + state=state, category0=category0, category1=category1, category2=category2) @@ -2879,20 +2870,35 @@ security.declareProtected('MailManager Settings', 'deleteTickets') - def deleteTickets(self, to_date, account_id, status='', + def deleteTickets(self, to_date, account_id, state='', category0='', category1='', category2=''): """ Delete selected tickets. """ - # In all cases we need to delete the tickets - self.sql.deleteTickets(to_date=to_date.ISO8601(), - account_id=account_id, - status=status, - category0=category0, - category1=category1, - category2=category2) + # First find the affected tickets + res = self.sql.listTickets(sqv_to_date=to_date.ISO8601(), + sqv_account_id=account_id, + sqv_state=state, + sqv_category0=category0, + sqv_category1=category1, + sqv_category2=category2) + + # Remove the queued time events + for ticket in res: + self.sql.deleteRulesetTimeEvents( + sqv_tid = ticket.id + ) + + # Now remove the tickets + self.sql.deleteTickets(sqv_to_date=to_date.ISO8601(), + sqv_account_id=account_id, + sqv_state=state, + sqv_category0=category0, + sqv_category1=category1, + sqv_category2=category2) + security.declareProtected('MailManager Settings', 'archiveTickets') - def archiveTickets(self, to_date, account_id, status='', + def archiveTickets(self, to_date, account_id, state='', category0='', category1='', category2=''): """ Archive selected tickets. @@ -2902,22 +2908,22 @@ exp = XMLGenerator(f, 'utf-8') exp.startDocument() exp.startElement('mailmanager', {}) - tickets=self.sql.listTickets(to_date=to_date.ISO8601(), - account_id=account_id, - status=status, - category0=category0, - category1=category1, - category2=category2) + tickets=self.sql.listTickets(sqv_to_date=to_date.ISO8601(), + sqv_account_id=account_id, + sqv_state=state, + sqv_category0=category0, + sqv_category1=category1, + sqv_category2=category2) for ticket in tickets: self.row2xml(exp, 'ticket', tickets.names(), ticket) - messages = self.sql.listMessages(ticket_id=ticket.id) + messages = self.sql.listMessages(sqv_ticket_id=ticket.id) for message in messages: self.row2xml(exp, 'message', messages.names(), message) - attach = self.sql.listAttachments(message_id=message.id, - include_body=True) + attach = self.sql.listAttachments(sqv_message_id=message.id, + sqv_include_body=True) for att in attach: self.row2xml(exp, 'attachment', attach.names(), att) - history = self.sql.listHistory(ticket_id=ticket.id) + history = self.sql.listHistory(sqv_ticket_id=ticket.id) for hist in history: self.row2xml(exp, 'history', history.names(), hist) exp.endElement('mailmanager') Modified: MailManager/branches/RELENG_2_1/tests/testAPI.py =================================================================== --- MailManager/branches/RELENG_2_1/tests/testAPI.py 2006-04-18 15:27:33 UTC (rev 2922) +++ MailManager/branches/RELENG_2_1/tests/testAPI.py 2006-04-18 15:28:43 UTC (rev 2923) @@ -181,18 +181,21 @@ # method: createTicket self.mmobj.createTicket( + account_name = 'enquiries@acmewidgets.example', + title = 'This is a test', + body = 'This is a test', + body_is_html = False, + from_name = 'Test Person', + from_email = 'test@test.example', assigned = 'kev', priority = 1, response_target = 3600, - account_name = 'enquiries@acmewidgets.example', - from_name = 'Test Person', - from_email = 'test@test.example', - title = 'This is a test', - body = 'This is a test', - category0=None, - category1=None, - category2=None, - support_of=None, + category0 = None, + category1 = None, + category2 = None, + support_of = None, + ticket_type = 'incoming', + user_signature = None, attach = {}, remote_addr = None ) Modified: MailManager/branches/RELENG_2_1/tests/testExporting.py =================================================================== --- MailManager/branches/RELENG_2_1/tests/testExporting.py 2006-04-18 15:27:33 UTC (rev 2922) +++ MailManager/branches/RELENG_2_1/tests/testExporting.py 2006-04-18 15:28:43 UTC (rev 2923) @@ -78,7 +78,7 @@ self.mmobj.wipeDataset('acmestatic') self.mmobj.populateAccounts('acmestatic') - print self.mmobj.sql.listTickets(count=1)[0].count + print self.mmobj.sql.listTickets(sqv_count=1)[0].count self.importTest() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |