You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This line is causing an XPathTextField to receive the value 'None' (where type('None') == str) for empty XML elements.
This is happening because force_unicode (or force_text in my case as I'm using Python3) when not given the strings_only key attribute a value of True, will return the string 'None' for empty elements.
It is difficult to me to determine if this is actually a bad thing. But I'll share with you my experience:
I'm using django-xml as a interface for interacting with all my XMLs. Sometimes, I have to store some information from those XML in a database. In that context, it is bad to have a string 'None' instead of the actual None value or an empty string ''.
Maybe the Django force_text behaviour has a good reason behind: I suppose that as it was designed with the presentation layer in mind and not the model layer.
The text was updated successfully, but these errors were encountered:
It wasn't intentional. I had mistakenly assumed that _Element.text mapped more-or-less to DOM level 3 DOMNode.textContent, which has an empty string for an element without content. Which do you think makes more sense here, '' or None? I'd be inclined to go with an empty string.
This line is causing an XPathTextField to receive the value
'None'
(wheretype('None') == str
) for empty XML elements.This is happening because
force_unicode
(or force_text in my case as I'm using Python3) when not given thestrings_only
key attribute a value ofTrue
, will return the string'None'
for empty elements.It is difficult to me to determine if this is actually a bad thing. But I'll share with you my experience:
I'm using django-xml as a interface for interacting with all my XMLs. Sometimes, I have to store some information from those XML in a database. In that context, it is bad to have a string
'None'
instead of the actualNone
value or an empty string''
.Maybe the Django
force_text
behaviour has a good reason behind: I suppose that as it was designed with the presentation layer in mind and not the model layer.The text was updated successfully, but these errors were encountered: