On Wednesday 15 Jun 2011 11:44:32 AM Bala wrote:
> def write(self, params):
>
> if 'id' in params:
> ticket = self.dao.FindByID(Ticket, params['id'][0])
> ticket.modified = datetime.datetime.now()
> else:
> ticket = Ticket()
>
> # Mark ticket open
> ticket.statusId = 1 # TODO: Make this line more
> robust in case
> status indexes change
>
> if 'deptId' in params:
>
> ticket.deptId = params['deptId'][0]
> if 'cityId' in params:
> ticket.cityId = params['cityId'][0]
> if 'creatorId' in params:
> ticket.creatorId = params['creatorId'][0]
> if 'title' in params:
> ticket.title = cgi.escape(params['title'][0])
> if 'body' in params:
> ticket.body = cgi.escape(params['body'][0])
> if 'severityId' in params:
> ticket.severityId = params['severityId'][0]
> if 'priorityId' in params:
> ticket.priorityId = params['priorityId'][0]
> if 'statusId' in params:
> ticket.statusId = params['statusId'][0]
>
>
> if 'project_id' in params:
> ticket.project_id =
> params['project_id'][0]
>
>
> if 'workstation_ip' in params:
> ticket.workstation_ip =
> params['workstation_ip'][0]
>
>
> if 'stateId' in params:
> stateId = params['stateId'][0]
> ticket.stateId = None if stateId == "-1" else stateId
>
> if 'ownerId' in params:
> #ownerId = int(params['ownerId'][0])
> ownerId = params['ownerId'][0]
> ticket.ownerId = None if ownerId == "-1" else ownerId
>
>
> if 'interested[]' in params:
> self.clearInterested(ticket)
>
> for email in params['interested[]']:
> interested = InterestedParty(cgi.escape(email))
> ticket.interested.append(interested)
>
>
> if 'interested' in params:
> self.clearInterested(ticket)
>
> for email in (params['interested'][0]).split(","):
> email = cgi.escape(email.strip())
>
> # EMail might be blank, so check for that
> if email:
> email = InterestedParty(email)
> ticket.interested.append(email)
>
>
> self.dao.Update(ticket)
> self.dao.CommitSession()
>
> strModifications = Messages.messageHeader(ticket, params)
> strMessage = strModifications
> strMessage += Messages.ticketChanges(ticket, params)
>
> message = Message()
> message.ticket = ticket
> message.body = strMessage
> message.userId = params['userId'][0]
>
> # Save our addition/changes
> self.dao.Update(message)
> self.dao.CommitSession()
>
>
> userModifierName = message.user.name
>
> if ticket.owner == None:
> # Notify the mailing list since there is no owner
> sendTo = collectAllEMails(ticket)
> else:
> # If there's an owner, we don't need to tell everyone
> # what's happening
> sendTo = collectCreatorOwnerEMails(ticket)
>
> sender = "[email protected]"
> subject = Messages.getEMailSubject(ticket, params)
> body = Messages.getTicketEMailBody(ticket, params,
> userModifierName)
> Mailer.SendMail(subject, body, sender, sendTo)
>
>
>
> return ticketI believe you forgot to write a question? ;-) -- Fayaz Yusuf Khan Cloud developer and designer Dexetra SS, Kochi, India fayaz.yusuf.khan_AT_gmail_DOT_com fayaz_AT_dexetra_DOT_com +91-9746-830-823
signature.asc
Description: This is a digitally signed message part.
