Compare commits

...

1 commit

Author SHA1 Message Date
db49a47ce5 0.7.8 missing type guard in *bound_fk() 2025-11-05 18:12:33 +01:00
3 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ license = "Apache-2.0"
readme = "README.md" readme = "README.md"
dependencies = [ dependencies = [
"suou==0.7.6", "suou==0.7.8",
"itsdangerous", "itsdangerous",
"toml", "toml",
"pydantic", "pydantic",

View file

@ -37,7 +37,7 @@ from .redact import redact_url_password
from .http import WantsContentType from .http import WantsContentType
from .color import chalk from .color import chalk
__version__ = "0.7.7" __version__ = "0.7.8"
__all__ = ( __all__ = (
'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue',

View file

@ -256,6 +256,8 @@ def unbound_fk(target: str | Column | InstrumentedAttribute, typ: _T | None = No
target_name = target target_name = target
if typ is None: if typ is None:
typ = IdType typ = IdType
else:
raise TypeError('target must be a str, a Column or a InstrumentedAttribute')
return Column(typ, ForeignKey(target_name, ondelete='SET NULL'), nullable=True, **kwargs) return Column(typ, ForeignKey(target_name, ondelete='SET NULL'), nullable=True, **kwargs)
@ -277,6 +279,8 @@ def bound_fk(target: str | Column | InstrumentedAttribute, typ: _T = None, **kwa
target_name = target target_name = target
if typ is None: if typ is None:
typ = IdType typ = IdType
else:
raise TypeError('target must be a str, a Column or a InstrumentedAttribute')
return Column(typ, ForeignKey(target_name, ondelete='CASCADE'), nullable=False, **kwargs) return Column(typ, ForeignKey(target_name, ondelete='CASCADE'), nullable=False, **kwargs)