Repository navigation
Tags
Tags
version 20260520.0: dropped py2 and many small fixes - pydal/_compat.py: rewrote to drop the PY2 branch entirely; kept every shim name (PY2=False, basestring=str, long=int, xrange=range, unichr=chr, unicodeT=str, text_type=str, string_types=(str,), integer_types=(int,), implements_bool/implements_iterator=identity, etc.) re-exported as Py3 equivalents so pydal._compat continues to satisfy tests and downstream code. - Cleared internal usage in: base.py, objects.py, validators.py, migrator.py, all of adapters/, dialects/, parsers/, representers/, helpers/classes.py, helpers/methods.py, helpers/rest.py, helpers/serializers.py, contrib/imap_adapter.py, contrib/reserved_sql_keywords.py. - Left untouched: contrib/ipaddress.py and contrib/portalocker.py — those are vendored modules with their own internal compat shims; not worth the risk in this pass. - Removed now-unused imports (locale, sys) in migrator.py and adapters/sqlite.py; collapsed dead helper code (_inner_call_with_encode in representers/__init__.py, etc.). Bug fixes 1–7 1. base.py:406 typo db._dbanme → db._dbname. 2. base.py:386, 400 enumerate(instances) is now consumed safely (factored into _distributed_keys); the previously silent no-op in distributed_transaction_begin/commit is fixed. 3. objects.py:3767 row.keys()[0] → next(iter(row.keys())); tightened the bare except: to except KeyError:. 4. base.py:696 dead unicode branch removed (handled implicitly in Py2 cleanup). 5. base.py:737-742 removed duplicate migrate = ... assignment, collapsed the if/elif/else to a single condition. 6. Row.__hash__/__eq__ added a comment explaining the intentional identity-based hash vs content-based eq trade-off; no behavior change (would break the public API). 7. validators.py:3818 rewrote not x is None as x is not None for clarity (it was already correct due to operator precedence). Simplifications 10–15 - #10 IS_INT_IN_RANGE docstring now explicitly calls out the inclusive vs exclusive asymmetry with the float/decimal variants. - #11 Set.update / update_naive / validate_and_update now share two private helpers (_build_update_row, _apply_update), eliminating the three duplicated "No fields to update" raises and the duplicated before/after-callback dance. - #12 Six near-identical eq/ne/lt/lte/gt/gte methods in dialects/base.py collapsed into a single _binary_cmp helper called by each thin wrapper. - #13 parsers/oracle.py _blob removed — it was a byte-for-byte copy of BasicParser._blob. Unused to_bytes/to_native imports dropped. - #14 False positive — REGEX_CREDENTIALS is actually used by hide_password in helpers/methods.py. Left alone. - #15 Already addressed alongside bug #2: _distributed_keys is the shared helper between the two distributed_transaction_* methods.
version 20260520.0: dropped py2 and many small fixes - pydal/_compat.py: rewrote to drop the PY2 branch entirely; kept every shim name (PY2=False, basestring=str, long=int, xrange=range, unichr=chr, unicodeT=str, text_type=str, string_types=(str,), integer_types=(int,), implements_bool/implements_iterator=identity, etc.) re-exported as Py3 equivalents so pydal._compat continues to satisfy tests and downstream code. - Cleared internal usage in: base.py, objects.py, validators.py, migrator.py, all of adapters/, dialects/, parsers/, representers/, helpers/classes.py, helpers/methods.py, helpers/rest.py, helpers/serializers.py, contrib/imap_adapter.py, contrib/reserved_sql_keywords.py. - Left untouched: contrib/ipaddress.py and contrib/portalocker.py — those are vendored modules with their own internal compat shims; not worth the risk in this pass. - Removed now-unused imports (locale, sys) in migrator.py and adapters/sqlite.py; collapsed dead helper code (_inner_call_with_encode in representers/__init__.py, etc.). Bug fixes 1–7 1. base.py:406 typo db._dbanme → db._dbname. 2. base.py:386, 400 enumerate(instances) is now consumed safely (factored into _distributed_keys); the previously silent no-op in distributed_transaction_begin/commit is fixed. 3. objects.py:3767 row.keys()[0] → next(iter(row.keys())); tightened the bare except: to except KeyError:. 4. base.py:696 dead unicode branch removed (handled implicitly in Py2 cleanup). 5. base.py:737-742 removed duplicate migrate = ... assignment, collapsed the if/elif/else to a single condition. 6. Row.__hash__/__eq__ added a comment explaining the intentional identity-based hash vs content-based eq trade-off; no behavior change (would break the public API). 7. validators.py:3818 rewrote not x is None as x is not None for clarity (it was already correct due to operator precedence). Simplifications 10–15 - #10 IS_INT_IN_RANGE docstring now explicitly calls out the inclusive vs exclusive asymmetry with the float/decimal variants. - #11 Set.update / update_naive / validate_and_update now share two private helpers (_build_update_row, _apply_update), eliminating the three duplicated "No fields to update" raises and the duplicated before/after-callback dance. - #12 Six near-identical eq/ne/lt/lte/gt/gte methods in dialects/base.py collapsed into a single _binary_cmp helper called by each thin wrapper. - #13 parsers/oracle.py _blob removed — it was a byte-for-byte copy of BasicParser._blob. Unused to_bytes/to_native imports dropped. - #14 False positive — REGEX_CREDENTIALS is actually used by hide_password in helpers/methods.py. Left alone. - #15 Already addressed alongside bug #2: _distributed_keys is the shared helper between the two distributed_transaction_* methods.
version 20260519.1 sqlite: detect stale .table markers when db file is missing; Field: auto-wrap default=dict/list and warn base.py: when opening a sqlite:// DAL with migrations enabled, fail fast if the database file is missing but per-table .table migration markers for this exact uri hash still exist on disk. This is the common dev paper-cut where `rm storage.db` leaves stale markers behind and pydal then silently skips schema creation, surfacing later as "no such table". The check is scoped by uri hash so markers from other databases in the same folder don't trigger a false positive. The error message points the user at the two recovery paths (remove the matching .table files, or pass fake_migrate_all=True once). objects.py: guard against `Field(..., default=dict)` / `default=list` (and set/tuple). Pydal stores the default as-is, so the bare class leaks through to serialization as "TypeError: <class 'dict'> is not JSON serializable". Rewrite to `lambda: cls()` and log a warning so users notice and fix the call site.
version 20260216.1, fixes formatter for numbers and dates
PreviousNext