Skip to content

The save method in the directories is not working #297

@srik-git

Description

@srik-git

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions