Changeset 68
- Timestamp:
- 05/16/06 11:13:13 (18 years ago)
- Location:
- emailtotracscript/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/ChangeLog
r64 r68 1 2006-0 4-??1 2006-05-16 2 2 - Fixed a bug when there was no plain text body. 3 3 Reported by: Greg Deakyne 4 4 - Fixed a small bug if default component owner is unknown. 5 5 Just fill in some bogus info. 6 - Use the short options for the install command. S it works for6 - Use the short options for the install command. So it works for 7 7 MacOSx 8 8 Reported by: Nathaniel Irons 9 - Messages that has X-Virus-found in header are marked as SPAM 10 Implemented by: Walter de Jong 11 - Some modules are changed for version 0.10, Added and made some 12 minor changes: Patch supplied by: Markus Tacker 9 13 10 14 -
emailtotracscript/trunk/email2trac.py.in
r67 r68 52 52 spam_level : 4 # OPTIONAL, if set check for SPAM mail 53 53 reply_address: 1 # OPTIONAL, if set then fill in ticket CC field 54 54 umask : 022 # OPTIONAL, if set then use this umask for creation of the attachments 55 55 mailto_link : 1 # OPTIONAL, if set then [mailto:<CC>] in description 56 56 trac_version : 0.8 # OPTIONAL, default is 0.9 … … 100 100 101 101 self.VERSION = version 102 if self.VERSION > 0.8: 102 if self.VERSION == 0.8: 103 self.get_config = self.env.get_config 104 else: 103 105 self.get_config = self.env.config.get 104 else:105 self.get_config = self.env.get_config106 106 107 107 if parameters.has_key('umask'): … … 256 256 # Look for email address in registered trac users 257 257 # 258 if self.VERSION > 0.8: 258 if self.VERSION == 0.8: 259 users = [] 260 else: 259 261 users = [ u for (u, n, e) in self.env.get_known_users(self.db) 260 262 if e == email_addr ] 261 else:262 users = []263 263 264 264 if len(users) == 1: … … 363 363 # Insert ticket in database 364 364 # 365 if self.VERSION > 0.8: 365 if self.VERSION == 0.8: 366 tkt['id'] = tkt.insert(self.db) 367 else: 366 368 tkt['id'] = tkt.insert() 367 else:368 tkt['id'] = tkt.insert(self.db)369 369 370 370 # … … 509 509 510 510 url_filename = urllib.quote(filename) 511 if self.VERSION > 0.8: 512 dir = '/tmp' 513 else: 511 if self.VERSION == 0.8: 514 512 dir = os.path.join(self.env.get_attachments_dir(), 'ticket', 515 513 urllib.quote(str(ticket['id']))) 516 514 if not os.path.exists(dir): 517 515 mkdir_p(dir, 0755) 516 else: 517 dir = '/tmp' 518 518 519 519 path, fd = util.create_unique_file(os.path.join(dir, url_filename)) … … 531 531 # Insert the attachment it differs for the different TRAC versions 532 532 # 533 if self.VERSION > 0.8: 534 fd = open(path) 535 att = attachment.Attachment(self.env, 'ticket', ticket['id']) 536 att.insert(url_filename, fd, filesize) 537 fd.close() 538 else: 533 if self.VERSION == 0.8: 539 534 cursor = self.db.cursor() 540 535 cursor.execute('INSERT INTO attachment VALUES("%s","%s","%s",%d,%d,"%s","%s","%s")' … … 542 537 int(time.time()),'', user, 'e-mail') ) 543 538 self.db.commit() 539 else: 540 fd = open(path) 541 att = attachment.Attachment(self.env, 'ticket', ticket['id']) 542 att.insert(url_filename, fd, filesize) 543 fd.close() 544 544 545 545 … … 634 634 #print settings 635 635 636 if version > 0.8: 637 from trac import attachment 638 from trac.env import Environment 639 from trac.ticket import Ticket 640 from trac.Notify import TicketNotifyEmail 641 from trac.web.href import Href 642 from trac import util 643 else: 636 if version == 0.8: 644 637 from trac.Environment import Environment 645 638 from trac.Ticket import Ticket … … 647 640 from trac.Href import Href 648 641 from trac import util 642 elif version == 0.9: 643 from trac import attachment 644 from trac.env import Environment 645 from trac.ticket import Ticket 646 from trac.web.href import Href 647 from trac import util 648 from trac.Notify import TicketNotifyEmail 649 elif version == 0.10: 650 from trac import attachment 651 from trac.env import Environment 652 from trac.ticket import Ticket 653 from trac.web.href import Href 654 from trac import util 655 # see http://projects.edgewall.com/trac/changeset/2799 656 from trac.ticket.notification import TicketNotifyEmail 649 657 650 658 env = Environment(settings['project'], create=0)
Note: See TracChangeset
for help on using the changeset viewer.