GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — Issue #96: Add port support by t8y8 · Pull Request #97 · tableau/document-api-python Conversation
|
|
/cc @RussTheAerialist @geordielad |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self._port = value | ||
| # If port is None we don't actually want to update the XML | ||
| if value is not None: | ||
| self._connectionXML.set('port', value) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How do you remove the port if it exists and you want to remove it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I can invert the logic so that it's:
@port.setter
def port(self, value):
self._port = value
# If port is None we remove the element and don't write it to XML
if value is None:
try:
self._connectionXML.attrib.pop('port')
except KeyError:
pass
else:
self._connectionXML.set('port', value)
EDIT: This is an implementation that passes tests
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That would be good, though I prefer this semantic for deleting rather than poping
del self._connectionXML.attrib['port']
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done -- one SO post said del doesn't work, but others said it's fine and it works for me too
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self._username = connxml.get('username') | ||
| self._authentication = connxml.get('authentication') | ||
| self._class = connxml.get('class') | ||
| self.port = connxml.get('port', None) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
should this be self._port?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think originally I didn't so that validation logic would get triggered, but with my new "Don't write it" approach I think I can do just _port now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🚀
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.