Changeset 1154

Show
Ignore:
Timestamp:
08/19/06 00:27:47 (2 years ago)
Author:
athomas
Message:

XmlRpcPlugin:

Added patch by steffenp@gmx.de making ticket attachments a bit more useful. Closes #598.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • xmlrpcplugin/0.10/tracrpc/ticket.py

    r1070 r1154  
    2828        yield ('TICKET_VIEW', ((xmlrpclib.Binary, int, str),), self.getAttachment) 
    2929        yield ('TICKET_APPEND', 
    30                ((str, int, str, xmlrpclib.Binary, bool), 
    31                 (str, int, str, xmlrpclib.Binary)), 
     30               ((str, int, str, str, xmlrpclib.Binary, bool), 
     31                (str, int, str, str, xmlrpclib.Binary)), 
    3232               self.putAttachment) 
    3333        yield ('TICKET_ADMIN', ((bool, int, str),), self.deleteAttachment) 
     
    7979 
    8080    def listAttachments(self, req, ticket): 
    81         """ Lists attachments for a given ticket. """ 
    82         return [a.filename for a in Attachment.select(self.env, 'ticket', ticket)] 
     81        """ Lists attachments for a given ticket. Returns (filename, 
     82        description, size, time, author) for each attachment.""" 
     83        for t in Attachment.select(self.env, 'ticket', ticket): 
     84            yield (t.filename, t.description or '', t.size, t.time, t.author) 
    8385 
    8486    def getAttachment(self, req, ticket, filename): 
     
    8789        return xmlrpclib.Binary(attachment.open().read()) 
    8890 
    89     def putAttachment(self, req, ticket, filename, data, replace=True): 
     91    def putAttachment(self, req, ticket, filename, description, data, replace=True): 
    9092        """ Add an attachment, optionally (and defaulting to) overwriting an 
    9193        existing one. Returns filename.""" 
     
    100102        attachment = Attachment(self.env, 'ticket', ticket) 
    101103        attachment.author = req.authname or 'anonymous' 
     104        attachment.description = description 
    102105        attachment.insert(filename, StringIO(data.data), len(data.data)) 
    103106        return attachment.filename