Custom Query (332 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (145 - 147 of 332)

Ticket Resolution Summary Owner Reporter
#178 fixed Notification of sender independent from trac.ini bas hju@…
Description

Looking at a solution for our problems in #176 I traced down to the real cause.

Normaly we don't want to inform the updater with any notification. Also the reporter should get infos only if the ticket is closed (we don't want to bother him with all the steps towards this)

There is only one difference: if the reporter has sent an email and the ticket is created by email2trac, he should get a confirmation with the ticket number.

So the question was: how to separate notifications for "normal tickets" from notifications for tickets via email2trac.

I took the easy way. Separate it at the root - in email2trac itself.

I wrote some lines of code to achive a notification triggered by email2trac regardeless the configuration of trac.ini (see attachment)
(This might be enhanced with options for email2trac.conf, if necessary)
It's a "quick hack" and perhaps not in high sophisticated python, but is works. I let trac do the whole work and insert the email of the sender just before mailing the ticket...

--- email2trac_1.0.0	2009-09-02 10:57:42.000000000 +0200
+++ email2trac_1_0_0_new	2010-02-12 20:08:43.000000000 +0100
@@ -85,11 +85,13 @@
 
 from datetime import tzinfo, timedelta, datetime
 from trac import config as trac_config
+import trac.notification as TracNotification
 
 # Some global variables
 #
 trac_default_version = '0.11'
 m = None 
+sender_email = ''
 
 # A UTC class needed for trac version 0.11, added by
 # tbaschak at ktc dot mb dot ca
@@ -435,6 +437,7 @@
 		"""
 		Get the default author name and email address from the message
 		""" 
+		global sender_email
 
 		self.email_to = self.email_to_unicode(message['to']) 
 		self.to_name, self.to_email_addr = email.Utils.parseaddr (self.email_to) 
@@ -445,6 +448,7 @@
 		# Trac can not handle author's name that contains spaces
 		#
 		self.author = self.email_addr
+		sender_email = self.email_addr
 
 		if self.IGNORE_TRAC_USER_SETTINGS:
 			return

This following block is not really part of the patch, but it removes unecessary changelog-entrys for new tickets (i used them as workaround). (may be skipped)

@@ -824,7 +828,6 @@
 		#
 		if self.notify_template:
 			tkt['id'] = self.id
-			changed = True
 
 		# Rewrite the description if we have mailto enabled
 		#
@@ -1451,8 +1454,9 @@
 			fd.close()
 			os.unlink(path)
 
-		# Return how many attachments
+		# Return how many attachments if > 0 or problems with attachment size
 		#
+		if status or count > 0:
 			status = 'This message has %d attachment(s)\n%s' %(count, status)
 		return status

here comes the little wrapper:

@@ -1499,6 +1503,22 @@
 
 	return project
 
+def WrapNotify(self, resid):
+	"""
+	Copy of def notify() to manipulate recipents 
+	"""
+	(torcpts, ccrcpts) = self.get_recipients(resid)
+	
+	# additionally append sender (regardeless of settings in trac.ini)
+	#
+	torcpts.append(sender_email)
+
+	self.begin_send()
+	self.send(torcpts, ccrcpts)
+	self.finish_send()
+
+TracNotification.Notify.notify = WrapNotify
+
 
 if __name__ == '__main__':
 	# Default config file
#184 fixed Deadlock with "UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6'" bas hju@…
Description

The Ticket is created and the attachments are added as "none", "none-1".

The screenshots are embedded in the ticket as image either.

At the bottom of the description, the Attachments are listet with their former names

Attachments:

so far so good. But execution crashes! (and the ticket is created again and again calling run_email2trac)

our getmail

2010-03-11 13:56:05 Delivery error (command run_email2trac 24820 error (1, Traceback (most recent call last):
  File "/usr/local/bin/email2trac", line 1772, in <module>
    tktparser.save_email_for_debug(m, True)
  File "/usr/local/bin/email2trac", line 578, in save_email_for_debug
    self.debug_attachments(message_parts)
  File "/usr/local/bin/email2trac", line 544, in debug_attachments
    print 'TD: writing part%d (%s)' % (n,part_file)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 26: ordinal not in range(128)))

syslog:

Mar 11 13:56:05 stock email2trac: Traceback (most recent call last):
Mar 11 13:56:05 stock email2trac:   File "/usr/local/bin/email2trac", line 1754, in <module>#012    tktparser.parse(sys.stdin)
Mar 11 13:56:05 stock email2trac:   File "/usr/local/bin/email2trac", line 1109, in parse#012    self.new_ticket(m, subject, spam_msg)
Mar 11 13:56:05 stock email2trac:   File "/usr/local/bin/email2trac", line 938, in new_ticket#012    error_with_attachments =  self.attachments(message_parts)
Mar 11 13:56:05 stock email2trac:   File "/usr/local/bin/email2trac", line 1534, in attachments#012    path, fd =  util.create_unique_file(os.path.join(self.TMPDIR, filename))
Mar 11 13:56:05 stock email2trac:   File "/usr/lib/python2.5/site-packages/trac/util/__init__.py", line 227, in create_unique_file#012    return path, os.fdopen(os.open(path, flags, 0666), 'w')
Mar 11 13:56:05 stock email2trac: UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 7: ordinal not in range(128)

version is 1.2.0

#207 fixed Problems with unicode-attachments in 1.4.5 bas hju@…
Description

Emails with attachments containing unicode-charcters in filename are not handled in a usable way.

(see attached screenshots)

the attachments could not be opened

No handler matched request to /attachment/ticket/451/=?utf-8?Q?Budget_2010_-_Ger=C3=A4teliste_-_Danz?= =?utf-8?Q?ig.xls?=

Excample-Filename:

Budget 2010 - Geräteliste - Warschau.xls
Note: See TracQuery for help on using queries.