Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Getting the number of items or enumerating the items is not supported on this sequence+method #1

Open
timrobertson100 opened this issue Mar 19, 2014 · 3 comments

Comments

@timrobertson100
Copy link

I'd love so much for this to work, but sadly I see the following error. It is way beyond my freemarker expertise though.

SEVERE: Error executing FreeMarker template
FreeMarker template error:
Getting the number of items or enumerating the items is not supported on this sequence+method (wrapper: f.e.b.SimpleMethodModel) value.
(Hint 1: Maybe you wanted to call this method first and then do something with its return value. Hint 2: Getting items by intex possibly works, hence it's a "+sequence".)

The failing instruction (FTL stack trace):
----------
==> #local highestIndex = list?size - 1  [in template "WEB-INF/macros/json.ftl" in macro "printList" at line 48, column 3]
    @printList item, has_next_array  [in template "WEB-INF/macros/json.ftl" in macro "printItem" at line 59, column 24]
    #if item?is_enumerable  [in template "WEB-INF/macros/json.ftl" in macro "printItem" at line 58, column 1]
    @printItem hash[key]?if_exists, has_n...  [in template "WEB-INF/macros/json.ftl" in macro "printHashEx" at line 54, column 53]
    #list hash?keys as key  [in template "WEB-INF/macros/json.ftl" in macro "printHashEx" at line 54, column 8]
    @printHashEx data, []  [in template "WEB-INF/macros/json.ftl" in macro "rawStringify" at line 42, column 5]
    #elseif data?is_hash_ex  [in template "WEB-INF/macros/json.ftl" in macro "rawStringify" at line 41, column 3]
    @rawStringify data  [in template "WEB-INF/macros/json.ftl" in macro "stringify" at line 24, column 27]
    @json.stringify occ  [in template "WEB-INF/pages/occurrence/detail.ftl" at line 19, column 27]
----------
@ratherblue
Copy link

Ran into something similar today. A sequence+method means that both list?is_method and list?is_sequence are true. You would need to change your code to be list()?size - 1, but check in the backend to see what parameters list() takes,

@ratherblue
Copy link

Err, didn't realize this was a library. Need to change item?is_enumerableto item?is_enumerable && !item?is_method.

@stutrek
Copy link
Contributor

stutrek commented Jun 15, 2014

Methods are enumerable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants