Opened 14 years ago
Closed 14 years ago
#1863 closed defect (wontfix)
substituteParams using dojo.raise when should be using just return match
Reported by: | joose | Owned by: | psowden |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | String | Version: | 0.4 |
Keywords: | substituteParams | Cc: | |
Blocked By: | Blocking: |
Description
Current substituteParams does not like when there are params that does not get substitutes. I think it should just return those as unchanged.
Attachments (2)
Change History (4)
Changed 14 years ago by
Attachment: | string-extras.patch added |
---|
Changed 14 years ago by
Attachment: | string-extras.2.patch added |
---|
Patch to make it to work in strict (default) way or not (patched feature)
comment:1 Changed 14 years ago by
This is for the case where
var str="test %{foo} and %{bar}"; var str2=dojo.string.substituteParams(str, {"foo":"foo"});
Since the value of bar isn't specified you get an error. But I think that's a very unusual case where you want to do something like that, so I don't think it's worth adding a flag (although on the other hand I don't care what we do in that situation). If other people need this functionality then we'll consider adding it.
comment:2 Changed 14 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I did this deliberately, as I figured any time you have a substitution that doesn't match a param, it's almost certainly an error and the output is going to have silly %{} syntax that's not going to be what you intended. If we don't flag this by raising an exception, it's going to make it harder to detect these cases, and I think it will produce lesser quality code.
You're welcome to try to convince me otherwise :-)
Patch to fix substituteParams