On Friday 20 January 2006 21:44, Bas van der Vlies wrote:
> There is an new version 0.4.4(previous versions do not work):
>      * Fixed run_email2trac.c, did not work
>      * Added TRAC_SCRIPT_NAME to Makefile.in to
>        solve run_email2trac problem
>
>      Both errors reported by: [EMAIL PROTECTED]

Thanks a lot for your quick fixes! I installed and configured email2trac, and 
I 
feel it's a major feature which deserve mainline integration. 

However, I think some nice features can be added to make this totally 
essential.

First, I missed mail notification of the newly created ticket. I tried to add
that feature to email2trac.py, by inserting the following two lines at the
end of the parse function :

        tn = TicketNotifyEmail(self.env)
        tn.notify(tkt, newticket=True)

but unfortunately, I got the following error, which seems to indicate that the
EmailNotification functions have to be called from a web context. I'm not
sure how to handle this.

Traceback (most recent call last):   
 File "/var/lib/trac/iadmin/email2trac/bin/email2trac", line 554, in  ? 
  tktparser.parse(sys.stdin)   
 File "/var/lib/trac/iadmin/email2trac/bin/email2trac", line 348, in parse      
        
  tn = TicketNotifyEmail(self.env)   
 File "/usr/lib/python2.3/site-packages/trac/Notify.py", line 161, in __init__
  NotifyEmail.__init__(self, env)   
 File "/usr/lib/python2.3/site-packages/trac/Notify.py", line 79, in __init__
  Notify.__init__(self, env)   
 File "/usr/lib/python2.3/site-packages/trac/Notify.py", line 41, in __init__
  populate_hdf(self.hdf, env)
 File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 155, in 
populate_hdf
 hdf['trac.href'] = {   
 File "/usr/lib/python2.3/site-packages/trac/core.py", line 165, in 
__getattr__
  raise AttributeError, "'%s' object has no attribute '%s'" % (cls, name)
  AttributeError: 'trac.env.Environment' object has no attribute 'href'


And, second, I'd like to see the newly submitted ticket description 
UTF8-encoded. 
Currently, only the subject is translated, and I believe that transcoding the 
body 
wouldn't hurt. I added a hard-coded translation, but it's probably possible to 
do this 
a more generic way.

--- email2trac-0.4.4/email2trac.py      2006-01-21 15:19:04.000000000 +0100
+++ email2trac/bin/email2trac   2006-01-22 17:52:49.000000000 +0100
@@ -302,6 +303,10 @@
                                if not body_text:                               
        
# decode failed
                                        body_text = part.get_payload(decode=0)  
        
# do not decode

+                               # Ugly hardcoded way to transform european 
messages to UTF8
+                               body_text = unicode(body_text, 
'iso-8859-15').encode('utf-8')
+
                                tkt['description'] = '\n{{{\n\n%s\n}}}\n' % 
body_text

                        elif part.get_content_type() == 'text/html':



Thanks in advance for any hint you could provide,
Best regards,

-- 
Kilian CAVALOTTI                      Administrateur réseaux et systèmes
UPMC / CNRS - LIP6 (C870)
8, rue du Capitaine Scott                          Tel. : 01 44 27 88 54
75015 Paris - France                               Fax. : 01 44 27 70 00
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to