moto icon indicating copy to clipboard operation
moto copied to clipboard

error when template contains Iteration of list

Open uwevil opened this issue 3 years ago • 1 comments

Error existe in lastest version moto 4.0.8

Having this template : {{#each items}} <a href="{{itemName}}">{{itemDesc}}</a> {{/each}}

And our input :

{"items": [{"itemName": "item1", "itemDesc": "description 1"}]}

Moto will not find out "items" from input because moto search for "#each items".

def are_all_variables_present(template, template_data):

https://github.com/spulec/moto/blob/80ab997010f9f8a2c26272671e6216ad12fac5c3/moto/ses/models.py#L115

In addition, moto can not find itemName and itemDesc from a lower level dict inside a list.

uwevil avatar Oct 24 '22 09:10 uwevil

Thanks for raising this @uwevil - marking it as an enhancement to improve the template parsing.

Do you want to raise a PR for this yourself?

bblommers avatar Oct 25 '22 21:10 bblommers

Hi, I would like to work on this issue

mahi072 avatar Dec 07 '22 13:12 mahi072

Sounds good @mahi072! I haven't looked really into this issue yet, so I don't know the best way to implement this, but let me know if you need any help or pointers.

bblommers avatar Dec 08 '22 00:12 bblommers