~ubuntu-branches/ubuntu/vivid/python-docutils/vivid

« back to all changes in this revision

Viewing changes to docutils/parsers/rst/directives/__init__.py

  • Committer: Package Import Robot
  • Author(s): Michael Schutte, Michael Schutte, Dmitry Shachnev
  • Date: 2013-09-09 22:58:50 UTC
  • mfrom: (11.1.9 experimental)
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: package-import@ubuntu.com-20130909225850-61mgyuamzo0zb6pj
[ Michael Schutte ]
* Upload to unstable.
* Document in the patch header that #714313 is also taken care of by
  odt-writer-ascii-filenames.diff.

[ Dmitry Shachnev ]
* Updated rst2odt_prepstyles-elementtree.diff to make it not cause
  SyntaxErrors with Python 3.
* Fix autopkgtest failures:
  - Copy HISTORY.txt to the testing directory.
  - Disable test_html4css1_misc as it does not work with our location
    of html4css1.css.
* docutils.xml: fix codes of Chinese languages (thanks Jakub Wilk),
  and add Hungarian language.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: __init__.py 7486 2012-07-11 12:25:14Z milde $
 
1
# $Id: __init__.py 7621 2013-03-04 13:20:49Z milde $
2
2
# Author: David Goodger <goodger@python.org>
3
3
# Copyright: This module has been placed in the public domain.
4
4
 
232
232
    """
233
233
    match = re.match(r'^([0-9.]+) *(%s)$' % '|'.join(units), argument)
234
234
    try:
235
 
        assert match is not None
236
235
        float(match.group(1))
237
 
    except (AssertionError, ValueError):
 
236
    except (AttributeError, ValueError):
238
237
        raise ValueError(
239
238
            'not a positive measure of one of the following units:\n%s'
240
239
            % ' '.join(['"%s"' % i for i in units]))
262
261
    try:
263
262
        return get_measure(argument, length_units + ['%'])
264
263
    except ValueError:
265
 
        return get_measure(argument, ['']) + default
 
264
        try:
 
265
            return get_measure(argument, ['']) + default
 
266
        except ValueError:
 
267
            # raise ValueError with list of valid units:
 
268
            return get_measure(argument, length_units + ['%'])
266
269
 
267
270
def class_option(argument):
268
271
    """