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

Slicing for lists are broken #12

Open
xni opened this issue Feb 15, 2016 · 0 comments
Open

Slicing for lists are broken #12

xni opened this issue Feb 15, 2016 · 0 comments

Comments

@xni
Copy link

xni commented Feb 15, 2016

Hey!

Thank you for your great project, we use it in a very extensive way and really like it. But recently we faced with a problem I want to complain about.

Snippet for the problem: https://gist.github.com/xni/312880df3ec52d10a80d
Idea is: when you are trying to get some items from a ListMap, you receive not DictMaps but native dicts. Seems that the problem is in https://github.com/shakefu/humbledb/blob/master/humbledb/maps.py#L235 - when the result is not a dict, but list, no conversion is performed.

I suggest that kind of a solution:

    def __getitem__(self, index):
        value = super(ListMap, self).__getitem__(index)
        # Only create a new DictMap if we actually map into this list
        if isinstance(value, dict) and not self._name_map.empty():
            value = DictMap(value, self._name_map, self, None,
                    self._reverse_name_map)
        elif isinstance(value, list) and not self._name_map.empty():
            value = (DictMap(obj, self._name_map, self, None,
                             self._reverse_name_map)
                     for obj in value)
        return value

but I am not confident, because I don't have a deep understanding of a project.

We need your help very much! Thank you!

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

1 participant