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

Product matching query does not exist #33

Open
4 tasks
freezed opened this issue Oct 19, 2018 · 1 comment
Open
4 tasks

Product matching query does not exist #33

freezed opened this issue Oct 19, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@freezed
Copy link
Owner

freezed commented Oct 19, 2018

TODO :

  • catch error & display message
  • non regression test
  • checks impact on data already stored
  • FIX

Description

Message :

DoesNotExist at /ersatz/code/0611972117018
Product matching query does not exist.
Request Method:	GET
Request URL:	http://127.0.0.1:8000/ersatz/code/0611972117018
Django Version:	2.1.1
Exception Type:	DoesNotExist
Exception Value:	
Product matching query does not exist.
Exception Location:	~/git/ocp8/.venv/lib/python3.6/site-packages/django/db/models/query.py in get, line 399
Python Executable:	~/git/ocp8/.venv/bin/python
Python Version:	3.6.6
Python Path:	
['~/git/ocp8',
 '/usr/lib/python36.zip',
 '/usr/lib/python3.6',
 '/usr/lib/python3.6/lib-dynload',
 '~/git/ocp8/.venv/lib/python3.6/site-packages']
Server time:	ven, 19 Oct 2018 15:35:50 +0200

Request on DB :

freezed@(none):omega> SELECT p.*, pc.category_id, c.name
                   FROM ersatz_product p
                       JOIN ersatz_product_category pc ON pc.product_id = p.id
                       JOIN ersatz_category c ON c.id = pc.category_id
                   WHERE p.code = '0611972117018'
                   ORDER BY p.id DESC
                   LIMIT 20;
+------+------------------------------------------------------------+--------------------+---------------+---------------+--------+
| id   | name                                                       | nutrition_grades   | code          | category_id   | name   |
|------+------------------------------------------------------------+--------------------+---------------+---------------+--------|
| 3466 | Sardines Écossaises Brisling, dans huile d'olive (Rob-roy) | b                  | 0611972117018 | 145           | fishes |
| 3466 | Sardines Écossaises Brisling, dans huile d'olive (Rob-roy) | b                  | 0611972117018 | 20            | meals  |
+------+------------------------------------------------------------+--------------------+---------------+---------------+--------+
SELECT 2
Time: 0.021s
@freezed freezed added the bug Something isn't working label Oct 19, 2018
@freezed freezed self-assigned this Oct 19, 2018
@freezed
Copy link
Owner Author

freezed commented Oct 19, 2018

Integer cannot begins with 0

>>> p = Product.objects.get(code=int(0611972117018))
  File "<console>", line 1
    p = Product.objects.get(code=int(0611972117018))
                                                 ^
SyntaxError: invalid token
>>> p = Product.objects.get(code='0611972117018')

>>> code = 0611972117018
  File "<console>", line 1
    code = 0611972117018
                       ^
SyntaxError: invalid token
>>> code = '0611972117018'
>>> int_code = int(code)
>>> int_code
611972117018
>>> print(code)
0611972117018

freezed added a commit that referenced this issue Nov 4, 2018
This config used to work a few days (not on Heroku), now I cannot have traceback
for a known error 500 (described in #33)
freezed added a commit that referenced this issue Nov 4, 2018
This config used to work a few days (not on Heroku), now I cannot have traceback
for a known error 500 (described in #33)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant