Server error when calling findMedia with item query #3038

Open
opened 2017-07-18 10:25:25 +00:00 by rlx · 1 comment
Owner

api.findMedia({
    'keys': ['item', 'path'],
    'query': {
        'conditions': [
            {'key': 'item', 'operator': '!^', 'value': '0x'},
            {'key': 'path', 'operator': '$', 'value': '.srt'}
        ],
        'operator': '&'
    },
    'range': [0, 1000],
    'sort': [
        {'key': 'path', 'operator': '+'},
    ]
})


Traceback (most recent call last):

  File "/srv/pandora/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/srv/pandora/pandora/oxdjango/api/views.py", line 51, in api
    response = f(request, data)

  File "/srv/pandora/pandora/archive/views.py", line 622, in findMedia
    query = parse_query(data, request.user)

  File "/srv/pandora/pandora/archive/views.py", line 604, in parse_query
    query['qs'] = models.File.objects.find(data, user)

  File "/srv/pandora/pandora/archive/managers.py", line 150, in find
    qs = qs.filter(conditions)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/query.py", line 790, in filter
    return self._filter_or_exclude(False, *args, **kwargs)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/query.py", line 808, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1243, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1263, in _add_q
    current_negated, allow_joins, split_subq)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1263, in _add_q
    current_negated, allow_joins, split_subq)

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1269, in _add_q
    allow_joins=allow_joins, split_subq=split_subq,

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1194, in build_filter
    lookup_class = field.get_lookup(lookups[0])

  File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/fields/related.py", line 693, in get_lookup
    raise TypeError('Related Field got invalid lookup: %s' % lookup_name)

TypeError: Related Field got invalid lookup: istartswith


<WSGIRequest: POST '/api/'>

``` api.findMedia({ 'keys': ['item', 'path'], 'query': { 'conditions': [ {'key': 'item', 'operator': '!^', 'value': '0x'}, {'key': 'path', 'operator': '$', 'value': '.srt'} ], 'operator': '&' }, 'range': [0, 1000], 'sort': [ {'key': 'path', 'operator': '+'}, ] }) ``` ``` Traceback (most recent call last): File "/srv/pandora/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response response = self.process_exception_by_middleware(e, request) File "/srv/pandora/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/srv/pandora/pandora/oxdjango/api/views.py", line 51, in api response = f(request, data) File "/srv/pandora/pandora/archive/views.py", line 622, in findMedia query = parse_query(data, request.user) File "/srv/pandora/pandora/archive/views.py", line 604, in parse_query query['qs'] = models.File.objects.find(data, user) File "/srv/pandora/pandora/archive/managers.py", line 150, in find qs = qs.filter(conditions) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/query.py", line 790, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/query.py", line 808, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1243, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1263, in _add_q current_negated, allow_joins, split_subq) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1263, in _add_q current_negated, allow_joins, split_subq) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1269, in _add_q allow_joins=allow_joins, split_subq=split_subq, File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 1194, in build_filter lookup_class = field.get_lookup(lookups[0]) File "/srv/pandora/local/lib/python3.5/site-packages/django/db/models/fields/related.py", line 693, in get_lookup raise TypeError('Related Field got invalid lookup: %s' % lookup_name) TypeError: Related Field got invalid lookup: istartswith <WSGIRequest: POST '/api/'> ```
j added the
backend
label 2017-07-18 10:25:25 +00:00
j added this to the 14.04 milestone 2017-07-18 10:25:25 +00:00
j self-assigned this 2017-07-18 10:25:25 +00:00
j added the
normal
defect
labels 2017-07-18 10:25:25 +00:00
Owner

query is item query, the following works:


api.findMedia({
     'keys': ['item', 'path'],
     'query': {
         'conditions': [
             {'key': 'id', 'operator': '!^', 'value': '0x'},
             {'key': 'filename', 'operator': '$', 'value': '.srt'}
         ],
         'operator': '&'
     },
     'range': [0, 100000],
     'sort': [
         {'key': 'path', 'operator': '+'},
     ]
 })
query is item query, the following works: ``` api.findMedia({ 'keys': ['item', 'path'], 'query': { 'conditions': [ {'key': 'id', 'operator': '!^', 'value': '0x'}, {'key': 'filename', 'operator': '$', 'value': '.srt'} ], 'operator': '&' }, 'range': [0, 100000], 'sort': [ {'key': 'path', 'operator': '+'}, ] }) ```
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: 0x2620/pandora#3038
No description provided.