Roundup Tracker - Issues

Issue 711501

classification
Files associated with messages not issues
Type: Severity: normal
Components: Mail interface Versions:
process
Status: closed fixed
:
: richard : georgeal, richard, rouilj
Priority: normal :

Created on 2003-03-28 18:38 by georgeal, last changed 2003-04-23 12:05 by richard.

Files
File name Uploaded Description Edit Remove
files.patch georgeal, 2003-03-28 18:39 patch to mailgw.py
Messages
msg741 Author: [hidden] (georgeal) Date: 2003-03-28 18:38
If you attach a file to an email and send it to the
issue tracker, it associates that file with the msg
node, not the current issue node.

I am submitting the following patch, which (I hope)
addresses the issue.
msg742 Author: [hidden] (rouilj) Date: 2003-03-30 06:30
Logged In: YES 
user_id=707416

Hmm, I don't believe Allen's patch is quite right as it assumes that there is 
always a message that is created.

With the current cvs version, it 
is possible to have no body
text and still have an attachment. In which 
case, the file
hyperdb item is created, but there is no link to it 
anywhere
since no message was created.

I think the code in 
mailgw.py that reads:

        # 
        # handle the attachments
        #
        
files = []
        for (name, mime_type, data) in attachments:
            if not 
name:
                name = "unnamed"
            
files.append(self.db.file.create(type=mime_type, name=name,
                
content=data, **file_props))

Needs to have something 
like:

            if nodeid:
                # add the files to the node's list
                fileprop = 
cl.get(nodeid, 'file')
                fileprop.append(files)
                props['files'] = 
fileprop
            else:
                # pre-load the files list
                props['file'] = 
files

appended to it. But I am not quite sure this is right 
either.

In any case with the current cvs code, you can use the 
following shell script to add the files in the linked messages to the issue's 
files link.

 for issue in `roundup-admin -s -i /var/roundup/admin list 
issue`
  do
   echo 'Running over issue $issue'
   files=""
   for 
msg in `roundup-admin -s -i /var/roundup/admin get  messages 
issue$issue`
   do
    echo "Scanning message $msg"
    
files="$files,`roundup-admin -c -i /var/roundup/admin get  files 
msg$msg`"
   done
   [ -z "$files" ] && \
     roundup-admin -s -i 
/var/roundup/admin set issue$issue \
            messages=`echo $files | sed -
e 's/,,//g'`
  done

This will take a while, but it runs over all issues 
making sure to set the files field of the issue to the union of the files fields for 
all the issues messages. Note this will work ONLY with the current cvs 
0.6.0 tracker as it needs my mods to run. 
Also replace the tracker 
/var/roundup/admin with the path to your tracker. 

Sorry for 
putting the script inline, but I can't upload any files to this bug report even 
though I am logged in 8-(.

-- rouilj
msg743 Author: [hidden] (richard) Date: 2003-04-23 12:05
Logged In: YES 
user_id=6405

Thanks for the patches. I changed the fileprop.append(files) to 
fileprop.extend(files), as that adds the contents of the files list to 
the existing fileprop list, rather than appending files as a sublist. 
 
History
Date User Action Args
2003-03-28 18:38:04georgealcreate