First patch implements notifying users of ticket changes (I did not
want to patch the False->True as I felt it might send duplicate
notifications when tickets are created from the web)
Second patch implements i_links handling (this is a hack)

Index: agilo/csv_import/web_ui.py
===================================================================
--- agilo/csv_import/web_ui.py  (revision 578)
+++ agilo/csv_import/web_ui.py  (working copy)
@@ -30,6 +30,8 @@
 from trac.web import IRequestHandler
 from trac.web.chrome import add_notice, add_warning
 from trac.wiki.formatter import wiki_to_html
+from trac.util.datefmt import to_datetime
+from trac.ticket.notification import TicketNotifyEmail

 from agilo_lib import chardet

@@ -221,6 +223,17 @@
         return html_changes


+    def _notify_ticket_changes(self, req, changed_tickets):
+        """Notify about ticket changes"""
+        for ct in changed_tickets:
+            now = to_datetime(t=None)
+            try:
+                tn = TicketNotifyEmail(self.env)
+                tn.notify(ct, newticket=True, modtime=now)
+            except Exception, e:
+                add_warning(req, "Failure sending notification on
change to " \
+                            "ticket #%s: %s" % (ct.id, e))
+
     def process_request(self, req):
         (action, performer) =
self._get_action_and_performer_from_request(req)
         upload_fp = self._get_uploaded_file(req)
@@ -248,6 +261,9 @@
                     html_changes=html_changes)
         if show_preview:
             self._update_template_data_for_preview(performer,
upload_fp, data)
+
+        self._notify_ticket_changes(req, changed_tickets)
+
         return IMPORT_TEMPLATE, data, None


Index: agilo/csv_import/import_performer.py
===================================================================
--- agilo/csv_import/import_performer.py        (revision 578)
+++ agilo/csv_import/import_performer.py        (working copy)
@@ -20,6 +20,7 @@
 from trac.util.translation import _
 from trac.web.chrome import add_warning
 from trac.util import parse_date
+from trac.ticket.notification import TicketNotifyEmail

 from agilo.ticket.api import AgiloTicketSystem
 from agilo.ticket.model import AgiloTicket
@@ -147,6 +148,16 @@
                     else:
                         ticket.id = ticket.insert()

+                    if 'i_links' in fields:
+                        try:
+                            id2 = int(fields['i_links'])
+                            ticket2 = AgiloTicket(self.env,
tkt_id=id2)
+                            ticket.link_from(ticket2)
+                        except ValueError:
+                            pass
+                        except Exception, e:
+                            add_warning(req, str(e))
+
                     tickets.append(ticket)
                 except RuleValidationException, e:
                     raise TracError(str(e))


On Apr 29, 2:47 am, Andrea Tomasini <[email protected]>
wrote:
> On 29 Apr, 2009, at 24:38 , cybernytrix wrote:
>
> > Hello,
>
> Hi Cybernytrix,
>
> > In my trac.ini, I have:
>
> > [notification]
> > always_notify_owner = true
> > always_notify_reporter = true
> > always_notify_updater = false
> > smtp_enabled = true
>
> > Notifications work for me, but it is not sent when I import via CSV.
> > Does anyone know if this can be fixed? Any hints on which part of the
> > code to look?
>
> Notification are not connected to the import... yet ;-) If you want to  
> do that, just have a look at the agilo/scrum/backlog.py:556 at the  
> method _save_ticket_changes() there is a piece of code which sends  
> notifications:
>
>                  try:
>                      debug(self, "Sending changed notification for " \
>                            "ticket %s" % bi.ticket)
>                      tn = TicketNotifyEmail(self.env)
>                      tn.notify(bi.ticket, newticket=False, modtime=now)
>                  except Exception, e:
>                      error(self, "Failure sending notification for " \
>                                  "ticket #%s: %s" % (bi.id, e))
>
> That's the API, you can use newticket=True when you create new  
> tickets... the first parameter must be a valida ticket object, let me  
> know if you need more help ;-)
>
> > Thanks,
>
> YAW
>
> > Ashwin
>
> ANdreaT
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Agilo for Scrum" group. This group is moderated by agile42 GmbH 
http://www.agile42.com and is focused in supporting Agilo for Scrum users.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/agilo?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to