Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5620 closed defect (wontfix)

erroneous hdfdump output of multiline (heredoc) elements

Reported by: Narcelio Filho <narcelio+filho@…> Owned by: Jonas Borgström
Priority: lowest Milestone:
Component: general Version:
Severity: trivial Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Multi-line HDF elements are being generated wrong for hdfdump. HDFWrapper generates this:

foo {
 bar = << EOM
line1
line2
EOM
}

when should generate this:

foo {
 bar << EOM
line1
line2
EOM
}

(without the equal sign)

Clearsilver tool chokes when feed with first example:

$ cs -h test.hdf
Traceback (innermost last):
  File "neo_hdf.c", line 1840, in hdf_read_file()
  File "neo_hdf.c", line 1678, in _hdf_read_string()
    In file test.hdf:3
  File "neo_hdf.c", line 1739, in _hdf_read_string()
ParseError: [test.hdf:3] Unable to parse line line1

Reference: ClearSilver HDF Dataset

Working patch (with doctest testcase):

  • trac/web/clearsilver.py

     
    259259        add_value(name, value)
    260260
    261261    def __str__(self):
     262        """
     263        Returns the HDF dataset
     264
     265        >>> hdf = HDFWrapper()
     266        >>> hdf['test.multiline'] = '''line1
     267        ... line2'''
     268        >>> print hdf
     269        test {
     270          multiline << EOM
     271        line1
     272        line2
     273        EOM
     274        }
     275        """
    262276        from StringIO import StringIO
    263277        buf = StringIO()
    264278        def hdf_tree_walk(node, prefix=''):
     
    270284                    if value.find('\n') == -1:
    271285                        buf.write(' = %s' % value)
    272286                    else:
    273                         buf.write(' = << EOM\n%s\nEOM' % value)
     287                        buf.write(' << EOM\n%s\nEOM' % value)
    274288                if node.child():
    275289                    buf.write(' {\n')
    276290                    hdf_tree_walk(node.child(), prefix + '  ')

Attachments (0)

Change History (1)

comment:1 by Christian Boos, 17 years ago

Milestone: 0.10.5
Resolution: wontfix
Status: newclosed

We're dropping support for ClearSilver, so there's no real need for that anymore. However, if someone else feels like committing the patch, please do.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.