-
-
Notifications
You must be signed in to change notification settings - Fork 8
parse_mod_info: Filter empty strings to marshmallow doesn't get angry #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Don't you just want to update the schema with |
|
Ah, I didn't know that was possible! I didn't find that in the marshmallow docs when I was looking. |
|
This doesn't actually work, and apparently the workaround is to remove all "empty" values before passing the data to marshmallow - marshmallow-code/marshmallow#167 (comment) For a schema description tool this is kind of shite. |
When we execute lua scripts to extract the global variables they set, we are not interested in the things that already hang around in the globals table when the Lua VM is initialized. Since these things also contain binary that we don't want to run through string decoding (resulting in `UnicodeDecodeError`), we're better off getting rid of them.
marshmallow does not like empty strings in `UrlField`s and therefore failed validation if a `mod_info.lua` contained `url = ""`. This commit removes all `None` and `""` values from the data before passing it to the marshmallow schema. Fixes FAForever#31
2596548 to
6687cab
Compare
|
@Sheeo can you reproduce that without my commit to ignore the "internal" lua globals using |
|
Here is what it takes for me to trigger the problem: from faf.tools.lua import parse
parse.from_lua('')results in this: |
marshmallow does not like empty strings in
UrlFields and therefore failed validation if amod_info.luacontainedurl = "".This commit removes all
Noneand""values from the data before passing it to the marshmallow schema.Fixes #31
Also contains a lua fix:
Ignore "internal" globals when parsing lua: When we execute lua scripts to extract the global variables they set, we are not interested in the things that already hang around in the globals table when the Lua VM is initialized.
Since these things also contain binary that we don't want to run through string decoding (resulting in
UnicodeDecodeError), we're better off getting rid of them.