cancel
Showing results for 
Search instead for 
Did you mean: 

python client: newly created workspace not showing in Admin UI

Roy_Mathew
Champ in-the-making
Champ in-the-making

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

1 REPLY 1

Roy_Mathew
Champ in-the-making
Champ in-the-making

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()