praekeltfoundation / molo

Molo is a set of tools for publishing low end mobi sites with a community focus.
http://molo.rtfd.org
BSD 2-Clause "Simplified" License
27 stars 5 forks source link

remove values method call from fake qs causing attr errors #698

Closed moh-moola closed 4 years ago

moh-moola commented 4 years ago

Remove values method call from fake queryset causing attribute errors

https://sentry.io/organizations/praekeltorg-gem/issues/1532850131/?project=161240&query=is%3Aunresolved

moh-moola commented 4 years ago

@KaitCrawford Values does not return a flat list of values instead a key, val dict and values_list can be flexible

KaitCrawford commented 4 years ago

@moh-moola ah ok, so values_list doesn't throw an error if it comes across an object that doesn't have the attr? but values does? It's odd that they'd make such similar methods behave so differently.

moh-moola commented 4 years ago

The query set passed to the template tags varies, it could be a Queryset or a FakeQueryset, and the FakeQueryset class does not implement the methods... there is a check for this in the case page previews are being served