For PEP-8, I recommend moving these imports to the top (flake 8 will be upset about this).
BTW, I recently made a PR on Bodhi to change the template so this happens automatically:
https://github.com/fedora-infra/bodhi/pull/1397
Won't this be an invalid foreign key reference? If so, it might be best to just allow this column to be nullable, and to interpret a null value as meaning "unknown".
I suggest allowing that column to be NULL because I think you may have problems when loading the foreign key reference with "unknown". Unless maybe you also create a record with "unknown" as the key in the foreign table?
Hm fair point yes
rebased
1 new commit added
assert statements get removed in .pyo files, which are built by RPM. Thus, this line will not be present in production. I recommend replacing it with something like:
assert
.pyo
if token_id is None: raise ValueError('token_id may not be None.')
There may be a more specific sqlalchemy Exception you could use instead.
Just one comment, though it is pretty important to address. If you switch it to an if statement and raising an Exception, it'll be good to go!
I didn't know about the .pyo, thanks for that :)
I'm adjusting as you suggested, will push and merge :)
Thanks again for your review and suggestions :)
Pull-Request has been merged by pingou