#58 raw directive, url option - requires file option

closed-invalid
None
5
2006-03-07
2006-02-24
No

Came across this using an older version of docutils
with Zope 2.7, but still appears in latest snapshot.
url option for raw directive cannot have file option,
but this is then required under the url processing
block.

in docutils/parsers/rst/directives/misc.py, line 108
appears to be at fault. The elif block (lines 97 - 108
):

elif options.has_key('url'):
try:
raw_file = urlopen(options['url'])
except (URLError, IOError, OSError), error:
severe = state_machine.reporter.severe(
'Problems with "%s" directive URL "%
s":\n%s.'
% (name, options['url'], error),
nodes.literal_block(block_text,
block_text), line=lineno)
return [severe]
text = raw_file.read()
raw_file.close()
attributes['source'] = options['file']

the last line here presumes a file option, where I
think it should presume the url option. changing this
line to

attributes['source'] = options['url']

works for me (limited test, using raw:: html)! I note
that this option doesn't get tested in the test suite,
other than to test that using the file and url options
together is an error - presumably because no connection
to a specified URL can be relied on. Can't think of a
way round that though.

First bug report - apols if bad format. Cheers, Craig

Discussion

  • David Goodger

    David Goodger - 2006-03-07

    Logged In: YES
    user_id=7733

    The excerpt you provide doesn't match the code in the trunk
    (0.5) or the docutils-0.4 branch. The latest code looks OK
    to me. What Docutils version are you referring to?

     
  • David Goodger

    David Goodger - 2006-03-07
    • assigned_to: nobody --> goodger
    • status: open --> pending-invalid
     
  • Craig Burton

    Craig Burton - 2006-03-07
    • status: pending-invalid --> open-invalid
     
  • Craig Burton

    Craig Burton - 2006-03-07

    Logged In: YES
    user_id=1460496

    Many apologies - bad housekeeping on my part confusing old
    and new versions. New looks grand - as is docutils.

    Sorry for the timewaster...
    Cheers, Craig

     
  • David Goodger

    David Goodger - 2006-03-07
    • status: open-invalid --> closed-invalid
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks