Changeset 7251


Ignore:
Timestamp:
Dec 14, 2009, 10:12:16 AM (7 years ago)
Author:
Xavier Pechoultres
Message:

Fix #6323: best multi-line description support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icalviewplugin/0.11/icalview/icalview.py

    r7250 r7251  
    2020from cStringIO import StringIO
    2121from trac.resource import Resource, get_resource_url
     22from trac.util.text import CRLF
    2223
    2324class iCalViewPlugin(QueryModule):
     
    156157                    priority_map[k[0]] = int(k[1])
    157158
     159        def write_prop(name, value, params={}):
     160            propname = ';'.join([name] + [k + '=' + v for k, v in params.items()])
     161            propvalue = value.replace('\n','\n ').replace('\r\n \r\n','\r\n')
     162            content.write("%s:%s\r\n" % (propname,propvalue))
    158163        for result in results:
    159164            ticket = Resource('ticket', result['id'])
     
    203208                for key in attr_map:
    204209                   if key in cols:
    205                        content.write("%s:%s\r\n" % (attr_map[key], unicode(result[key]).encode('utf-8')))
     210                       write_prop(attr_map[key], unicode(result[key]).encode('utf-8'),{})
    206211                content.write("END:%s\r\n" % kind)
    207212        content.write('END:VCALENDAR\r\n')
Note: See TracChangeset for help on using the changeset viewer.