Project

General

Profile

Defect #3254 ยป migrate_from_trac.diff

Yuki Sonoda, 2009-04-28 12:48

View differences:

lib/tasks/migrate_from_trac.rake (working copy)
135 135
          File.file? trac_fullpath
136 136
        end
137 137

  
138
        def read
139
          File.open("#{trac_fullpath}", 'rb').read
138
        def open
139
          File.open("#{trac_fullpath}", 'rb') {|f|
140
            @file = f
141
            yield self
142
          }
140 143
        end
141 144

  
145
        def read(*args)
146
          @file.read(*args)
147
        end
148

  
142 149
        def description
143 150
          read_attribute(:description).to_s.slice(0,255)
144 151
        end
......
506 513
          # Attachments
507 514
          ticket.attachments.each do |attachment|
508 515
            next unless attachment.exist?
509
              a = Attachment.new :created_on => attachment.time
510
              a.file = attachment
511
              a.author = find_or_create_user(attachment.author)
512
              a.container = i
513
              a.description = attachment.description
514
              migrated_ticket_attachments += 1 if a.save
516
              attachment.open {
517
                a = Attachment.new :created_on => attachment.time
518
                a.file = attachment
519
                a.author = find_or_create_user(attachment.author)
520
                a.container = i
521
                a.description = attachment.description
522
                migrated_ticket_attachments += 1 if a.save
523
              }
515 524
          end
516 525

  
517 526
          # Custom fields
    (1-1/1)