Changeset 3023
- Timestamp:
- 01/10/08 19:01:15 (1 year ago)
- Files:
-
- tagsplugin/trunk/tractags/ticket.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tagsplugin/trunk/tractags/ticket.py
r2954 r3023 13 13 from trac.util.text import to_unicode 14 14 from trac.util.compat import set, sorted 15 from trac.config import ListOption15 from trac.config import * 16 16 from trac.resource import Resource 17 17 … … 26 26 fields = ListOption('tags', 'ticket_fields', 'keywords', 27 27 doc='List of ticket fields to expose as tags.') 28 29 ignore_closed_tickets = BoolOption('tags', 'ignore_closed_tickets', True, 30 'Do not collect tags from closed tickets.') 28 31 29 32 # custom_fields = ListOption('tags', 'custom_ticket_fields', … … 42 45 cursor = db.cursor() 43 46 args = [] 44 sql = "SELECT * FROM (SELECT id, %s, %s AS fields FROM ticket) s" % (','.join(self.fields), 45 '||'.join(["COALESCE(%s, '')" % f for f in self.fields])) 47 fields = self.fields 48 ignore = '' 49 if self.ignore_closed_tickets: 50 ignore = " WHERE status != 'closed'" 51 sql = "SELECT * FROM (SELECT id, %s, %s AS fields FROM ticket%s) s" % ( 52 ','.join(self.fields), 53 '||'.join(["COALESCE(%s, '')" % f for f in self.fields]), 54 ignore) 46 55 constraints = [] 47 56 if tags: … … 55 64 sql += " WHERE " + " AND ".join(constraints) 56 65 sql += " ORDER BY id" 66 self.env.log.debug(sql) 57 67 cursor.execute(sql, args) 58 68 for row in cursor:
