gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
765 stars 138 forks source link

Do not call orm.Model.Meta callables during `__init_subclass__` #357

Closed mesozoic closed 5 months ago

mesozoic commented 5 months ago

The whole idea behind allowing Meta values to be callables (#268) was to defer evaluation until after the Model subclass is created. However, these callables still get evaluated when the subclass is created, since we try to validate that base_id, table_name, and api_key are defined.

This branch will validate that those three names exist inside Meta, but will defer raising an exception if they are callable and return None until the first time they get used.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (eef7b6f) to head (c289427).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #357 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 25 25 Lines 2313 2315 +2 ========================================= + Hits 2313 2315 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.