Skip to content
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

The save method in the directories is not working #297

Open
srik-git opened this issue Oct 12, 2023 · 0 comments
Open

The save method in the directories is not working #297

srik-git opened this issue Oct 12, 2023 · 0 comments

Comments

@srik-git
Copy link

srik-git commented Oct 12, 2023

The create method is working but not the save method. Is it a known issue or am I not calling it correctly?
This code does not work second time as first time an entry is created:
dir = self.nuxeo.directories.get(dir_name)
entry = DirectoryEntry(properties={'id': id,'label': label, 'ordering': ordering, 'obselete': obselete})
if not dir.exists(id):
print('Entry does not exist')
dir.create(entry)
return
else:
print('Entry exists')
dir.save(entry)
return
The entry's id is the same but label changed. It fails with the stack trace:
True
Entry exists
Traceback (most recent call last):
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\nuxeo\client.py", line 311, in request
resp.raise_for_status()
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: for url: http://dualstack.a14a3bc794cb248649aa88fb0071cfa2-593430633.us-east-2.elb.amazonaws.com/nuxeo/api/v1/directory/OfficeCodes/sri

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "d:\sri\contrib\code\python\nuxeo_vocab.py", line 49, in
exit(main())
^^^^^^
File "d:\sri\contrib\code\python\nuxeo_vocab.py", line 44, in main
nux_manager.save_entry('OfficeCodes', 'sri', 'sri')
File "d:\sri\contrib\code\python\nuxeo_vocab.py", line 20, in save_entry
dir.save(entry)
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\nuxeo\models.py", line 434, in save
return self.service.put(entry, dir_name=self.uid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\nuxeo\directories.py", line 69, in put
return super().put(resource, path=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\nuxeo\endpoint.py", line 138, in put
response = self.client.request(
^^^^^^^^^^^^^^^^^^^^
File "D:\sri\contrib\env\venv\dvenv\Lib\site-packages\nuxeo\client.py", line 314, in request
raise self._handle_error(exc)
nuxeo.exceptions.HTTPError: HTTPError(500), error: 'Internal Server Error', server trace: None
PS D:\sri\contrib\env\venv\dvenv>

  • History restored
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant