Changes between Version 24 and Version 25 of SearchAttachmentsPlugin


Ignore:
Timestamp:
Aug 28, 2015, 12:05:47 AM (9 years ago)
Author:
Ryan J Ollos
Comment:

Require Trac 0.11.4 and later to simplify installation.

Legend:

Unmodified
Added
Removed
Modified
  • SearchAttachmentsPlugin

    v24 v25  
    1111 * An excerpt of the matching documents is presented in the result page.
    1212 * Any format is supported as long as there is a command line tool for plain text conversion (filter command).
     13
     14**Note:** Trac 0.11.4 or later is required.
    1315
    1416== Bugs/Feature Requests
     
    4446}}}
    4547
    46   * Trac 10.x and 11.x source code must be manually modified for SEAT plugin to work.
    47     The file to modify is '''attachment.py''', on a Linux Fedora system, it is located in
    48     /usr/lib/python2.4/site-packages/trac[[BR]]
    49     '''Comment''': This is already done for Trac 0.11.4.
    50  {{{#!python
    51 162     def insert(self, filename, fileobj, size, t=None, db=None):
    52 ...
    53 ...
    54 184         try:
    55 185             # Note: `path` is an unicode string because `self.path` was one.
    56 186             # As it contains only quoted chars and numbers, we can use `ascii`
    57 187             basename = os.path.basename(path).encode('ascii')
    58 188             filename = unicode_unquote(basename)
    59 189
    60 190             cursor = db.cursor()
    61 191             cursor.execute("INSERT INTO attachment "
    62 192                            "VALUES (%s,%s,%s,%s,%s,%s,%s,%s)",
    63 193                            (self.parent_type, self.parent_id, filename,
    64 194                             self.size, self.time, self.description, self.author,
    65 195                             self.ipnr))
    66 196             shutil.copyfileobj(fileobj, targetfile)
    67 197             self.filename = filename
    68 198
    69 199             self.env.log.info('New attachment: %s by %s', self.title,
    70 200                               self.author)
    71 201
    72 202             if handle_ta:
    73 203                 db.commit()
    74 204
    75 205             targetfile.close() # << Line to add for SEAT plugin
    76 206
    77 207             for listener in AttachmentModule(self.env).change_listeners:
    78 208                 listener.attachment_added(self)
    79 209         finally:
    80 210             targetfile.close()
    81 
    82 }}}
    83 
    84 
    8548  * Use the trac-seat utility to index existing attachments:
    8649 {{{#!sh
     
    9356chown -R apache:apache /path/to.your/env/index
    9457}}}
    95 
    96     '''Comment''': On Trac 0.11.4 that should probably be /path/to/your/env/'''attachments'''/index.
    9758
    9859  * Configure your `trac.ini` file as follows: