fix: refuse an unhashable HOST or PORT instead of raising TypeError

Open Beginner friendly
#140 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, python
Domain
backend

Research direction

Start in neolith/_databases.py at databases_problems and trace how it validates HOST and PORT; compare those checks with the other entry refusals. Add coverage for unhashable values such as lists and confirm each produces a problem line naming the key and type instead of raising TypeError.

Written by the indexing model from the issue text.

Description

_databases.databases_problems should return a refusal for a bad HOST or PORT. When the value is unhashable, it raises a bare TypeError instead (rule K2).

Reproduction, on release/0.1.0a3:

from neolith._databases import databases_problems

databases_problems(
    {"default": {"ENGINE": "django.db.backends.postgresql", "NAME": "x", "HOST": []}},
    [],
)
# TypeError: unhashable type: 'list'

PORT: [] gives the same error. Expected: a problem line naming the key and the type, like the other entry refusals.

Dominant language
Python
Stars
1
Forks
0
Avg merge
5h 30m
Merged PRs (30d)
85

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stack314/django-neolith

All issues in stack314/django-neolith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.