Comment 0 for bug 1250251

Revision history for this message
andrew plunk (andrew-plunk) wrote :

problem:
When using a number as a param value in a str_replace function within a hot template, an exception is thrown.

expected:
When using a number as a param value in the str_replace function, hot should handle the conversion to a string gracefully.

actual:
If you try to use a number as a parameter value to str_replace the following exception is thrown:

Traceback (most recent call last):
  File "heat/tests/test_hot.py", line 190, in test_str_replace_number
    tmpl.resolve_replace(snippet))
  File "heat/engine/hot.py", line 256, in resolve_replace
    handle_str_replace, s)
  File "heat/engine/template.py", line 485, in _resolve
    return handle(recurse(v))
  File "heat/engine/hot.py", line 251, in handle_str_replace
    text = text.replace(key, value)
TypeError: expected a character buffer object

Template snippet that would cause this bug:

str_replace:
          template: |
            #!/bin/bash -v
            ...
            ./script/rails server -p %http_port% -d
          params:
            "%http_port%": 80