mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Added some convenience functions to NetworkedPrinterOutputdevice
This also moves the getUser from legacy to networked printer CL-541
This commit is contained in:
parent
c1c59925de
commit
cfc6a3ad48
2 changed files with 37 additions and 18 deletions
|
@ -143,6 +143,7 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
continue # If it's not readonly, it's created by user, so skip it.
|
||||
|
||||
file_name = "none.xml"
|
||||
|
||||
self.postForm("materials", "form-data; name=\"file\";filename=\"%s\"" % file_name, xml_data.encode(), onFinished=None)
|
||||
|
||||
except NotImplementedError:
|
||||
|
@ -596,13 +597,4 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
result = "********" + result
|
||||
return result
|
||||
|
||||
return self._authentication_key
|
||||
|
||||
## Convenience function to get the username from the OS.
|
||||
# The code was copied from the getpass module, as we try to use as little dependencies as possible.
|
||||
def _getUserName(self):
|
||||
for name in ("LOGNAME", "USER", "LNAME", "USERNAME"):
|
||||
user = os.environ.get(name)
|
||||
if user:
|
||||
return user
|
||||
return "Unknown User" # Couldn't find out username.
|
||||
return self._authentication_key
|
Loading…
Add table
Add a link
Reference in a new issue