#3869: Setting author name if adding attachment to ticket with an external program
--------------------------+-------------------------------------------------
Reporter: basv@sara.nl | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: general | Version: 0.10
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
With email2trac we add attachments to tickets. I used to do it with SQL
statements but trac provides some functions. My problem is that if i use
this function the author name is not set
{{{
fd = open(path)
att = attachment.Attachment(self.env, 'ticket', ticket['id'])
att.insert(url_filename, fd, filesize)
fd.close()
}}}
I have made a small patch to acomplish this:
{{{
--- attachment.py.org 2006-10-05 15:22:40.659671363 +0200
+++ attachment.py 2006-10-05 13:32:53.154988857 +0200
@@ -34,7 +34,7 @@
class Attachment(object):
- def __init__(self, env, parent_type, parent_id, filename=None,
db=None):
+ def __init__(self, env, parent_type, parent_id, filename=None,
db=None, author=None):
self.env = env
self.parent_type = parent_type
self.parent_id = str(parent_id)
@@ -48,6 +48,10 @@
self.author = None
self.ipnr = None
+ if author:
+ self.author = author
+
+
def _fetch(self, filename, db=None):
if not db:
db = self.env.get_db_cnx()
}}}
Now i can this to set the author name:
{{{{{{
fd = open(path)
att = attachment.Attachment(self.env, 'ticket', ticket['id'], None, None,
self.author)
att.insert(url_filename, fd, filesize)
fd.close()
}}}
--
Ticket URL: <http://trac.edgewall.org/ticket/3869>
The Trac Project <http://trac.edgewall.org/>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Tickets" group.
To post to this group, send email to trac-tickets@googlegroups.com
To unsubscribe from this group, send email to trac-tickets-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.se/group/trac-tickets
-~----------~----~----~----~------~----~------~--~---
--------------------------+-------------------------------------------------
Reporter: basv@sara.nl | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: general | Version: 0.10
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
With email2trac we add attachments to tickets. I used to do it with SQL
statements but trac provides some functions. My problem is that if i use
this function the author name is not set
{{{
fd = open(path)
att = attachment.Attachment(self.env, 'ticket', ticket['id'])
att.insert(url_filename, fd, filesize)
fd.close()
}}}
I have made a small patch to acomplish this:
{{{
--- attachment.py.org 2006-10-05 15:22:40.659671363 +0200
+++ attachment.py 2006-10-05 13:32:53.154988857 +0200
@@ -34,7 +34,7 @@
class Attachment(object):
- def __init__(self, env, parent_type, parent_id, filename=None,
db=None):
+ def __init__(self, env, parent_type, parent_id, filename=None,
db=None, author=None):
self.env = env
self.parent_type = parent_type
self.parent_id = str(parent_id)
@@ -48,6 +48,10 @@
self.author = None
self.ipnr = None
+ if author:
+ self.author = author
+
+
def _fetch(self, filename, db=None):
if not db:
db = self.env.get_db_cnx()
}}}
Now i can this to set the author name:
{{{{{{
fd = open(path)
att = attachment.Attachment(self.env, 'ticket', ticket['id'], None, None,
self.author)
att.insert(url_filename, fd, filesize)
fd.close()
}}}
--
Ticket URL: <http://trac.edgewall.org/ticket/3869>
The Trac Project <http://trac.edgewall.org/>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac Tickets" group.
To post to this group, send email to trac-tickets@googlegroups.com
To unsubscribe from this group, send email to trac-tickets-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.se/group/trac-tickets
-~----------~----~----~----~------~----~------~--~---