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

Filtering on list fails with the Memory backend. #304

Closed
Natim opened this issue Nov 30, 2015 · 4 comments
Closed

Filtering on list fails with the Memory backend. #304

Natim opened this issue Nov 30, 2015 · 4 comments
Labels

Comments

@Natim
Copy link
Member

Natim commented Nov 30, 2015

2015-11-29 12:07:27,383 ERROR [venusian][waitress] "GET   /v1/buckets/ideascube/collections/playlists/records?in_tags=burundi," ? (? ms) unhashable type: 'list' lang=None; exception=Traceback (most recent call last):
  File "~/pyramid/tweens.py", line 21, in excview_tween
    response = handler(request)
  File "~/pyramid_tm/__init__.py", line 99, in tm_tween
    reraise(*exc_info)
  File "~/pyramid_tm/__init__.py", line 80, in tm_tween
    response = handler(request)
  File "~/pyramid/router.py", line 163, in handle_request
    response = view_callable(context, request)
  File "~/pyramid/config/views.py", line 596, in __call__
    return view(context, request)
  File "~/pyramid/config/views.py", line 329, in attr_view
    return view(context, request)
  File "~/pyramid/config/views.py", line 305, in predicate_wrapper
    return view(context, request)
  File "~/pyramid/config/views.py", line 245, in _secured_view
    return view(context, request)
  File "~/pyramid/config/views.py", line 355, in rendered_view
    result = view(context, request)
  File "~/pyramid/config/views.py", line 501, in _requestonly_view
    response = view(request)
  File "~/cornice/service.py", line 571, in wrapper
    response = view_()
  File "~/mozilla/kinto/kinto/views/records.py", line 75, in collection_get
    result = super(Record, self).collection_get()
  File "~/mozilla/cliquet/cliquet/resource/__init__.py", line 233, in collection_get
    include_deleted=include_deleted)
  File "~/mozilla/cliquet/cliquet/resource/model.py", line 104, in get_records
    auth=self.auth)
  File "~/mozilla/cliquet/cliquet/storage/memory.py", line 282, in get_all
    pagination_rules, limit)
  File "~/mozilla/cliquet/cliquet/storage/memory.py", line 125, in extract_record_set
    filtered = list(self.apply_filters(records, filters or []))
  File "~/mozilla/cliquet/cliquet/storage/memory.py", line 109, in apply_filters
    matches = matches and operators[f.operator](left, right)
TypeError: unhashable type: 'list'; uid=None; errno=None; agent=HTTPie/0.9.2; authn_type=None; collection_id=record; collection_timestamp=1448795208123
@Natim Natim added the bug label Nov 30, 2015
@leplatrem
Copy link
Contributor

Appart from the 500 which is of course unacceptable, I think there is a misunderstanding here: if tags is a list attribute in the records, then ?in_tags=burundi is not exactly what we expect here.

We made the in operator to filter against multiple values (e.g. in_status=read,unread), but not as a contains operator.

@Natim
Copy link
Member Author

Natim commented Dec 15, 2015

Oh yes, we should probably:

  • add a filter to search for list containing something
  • add a filter to search for records having a specific attribute (kinto-telegram-wall text attribute)
  • Filtering on sub-objects properties (kinto-telegram-wall from.first_name for instance)

@leplatrem
Copy link
Contributor

I suggest that you open 3 different issues for that :)

@Natim
Copy link
Member Author

Natim commented Dec 16, 2015

Ok let's do that!

@Natim Natim closed this as completed Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants