Allow set plugin can now set entry fields to types other than str#2344
Allow set plugin can now set entry fields to types other than str#2344gazpachoking merged 3 commits intodevelopfrom
set plugin can now set entry fields to types other than str#2344Conversation
Remove some uses of 'basestring' (which we should not need anywhere)
|
So, I'm generally a fan of this 'native' rendering for the way we are using jinja templates. I think it allows more user manipulation of entry fields with the only cost being quotes sometimes needed if you explicitly need a string. @paranoidi @liiight @cvium Anything I'm overlooking? |
| for field in config: | ||
| # If this doesn't appear to be a jinja template, just set it right away. | ||
| if not isinstance(config[field], basestring) or '{' not in config[field]: | ||
| if not isinstance(config[field], str) or '{' not in config[field]: |
There was a problem hiding this comment.
Doesn't this remove unicode support? Why swtich from basestring -> str, we are not yet python3? :)
There was a problem hiding this comment.
It's a redundant import actually. Because of from builtins import *, str is equivalent to basestring.
Source: https://python-future.org/compatible_idioms.html#basestring
There was a problem hiding this comment.
Actually, 'str' is equivalent to 'unicode' on python 2 (because of the from builtins import *.) We don't actually allow byte strings in any of these places.
liiight
left a comment
There was a problem hiding this comment.
Looks good @gazpachoking. Maybe add native types specific tests?
|
@liiight Yeah, good plan, added. |
Motivation for changes:
If you want to manipulate a number field it is not currently possible.
Detailed changes:
Addressed issues:
Config usage if relevant (new plugin or updated schema):
To Do: