python client: newly created workspace not showing in Admin UI

Hello folks,

I'm using the python nuxeo client library to create a workspace as follows:

adminClient = nuxeo.Nuxeo(
  base_url=URL,
  auth={
    'username': 'Administrator',
    'password': 'Administrator'
  })

repository = adminClient.repository()
wsRoot = '/default-domain/workspaces'
ws = {
    'name': "china",
    'type': 'Workspace',
    'properties': {'dc:title': "China"}
    }
res = repository.create(wsRoot, ws)

The call succeeds.. however, I don't see the change reflected in the Admin UI (with a simple refresh to list the workspaces). But if I create another workspace via the UI, the “china” workspace then appears. So it looks like I'm missing a 'flush' call to make the UI sync w/the data. Can someone help?

thanks

0 votes

1 answers

1678 views

ANSWER



Quick update:

If I add a doc.save() at the end, it seems to fix the issue. Can someone comment on whether this is really necessary, and the recommended approach?

ws = {
    'name': "china",
    'type': 'Workspace',
    'properties': {'dc:title': "China"}
doc = repository.create(wsRoot, ws)
doc.save()
0 votes