This was on a brand new install of Plone 5.2.2 on an Ubuntu 20.04 box.
I have some code that I used to load various folders in an automated way...
_path = '/ontology-of-courts/united-states/supreme-court-of-the-united-states'
container = api.portal.get()
container = api.content.get(path=_path)Now, create the object...
for item in state_sc:
print('Working on ' + item)
obj = api.content.create(type='Folder', title=item, container=container)Since we are at the command line, we need to commit the object to the database...
transaction.commit()
api.content.transition(obj=obj, transition='submit')
api.content.transition(obj=obj, transition='publish')
transaction.commit()
... which works just fine. All the objects that were created are viewable in the correct folder. However, when I try to insert a hierarchy of objects (folders within folders), none of the new objects are viewable in the standard folder view. I know that the objects were instantiated (because they show up in the catalog, as well as the nav-bar menu). But they don't show up in the folder into which they were instantiated (even when you look at "Contents"). They do show up if you hit manage_main in the respective folder URL's. Here is the nested code for the objects that are instantiated but not visible:
def get_path_section(S = ''):
S = S.lower()
S = S.strip()
S = S.replace(' ', '-')
return S
for i in usca:
# The first element is the Court of Appeals.
# Create that folder object first...
the_path = '/ontology-of-courts/united-states/supreme-court-of-the-united-states'
print('Working on ' + i[0])
container = api.portal.get()
container = api.content.get(path=the_path)
obj = api.content.create(type='Folder', title=i[0], container=container, path=the_path)
# Commit the object to the database, so that we can add the various districts...
transaction.commit()
api.content.transition(obj=obj, transition='submit')
api.content.transition(obj=obj, transition='publish')
transaction.commit()
# the second element is the set of districts.
sub_path = the_path + '/' + get_path_section(i[0])
for j in i[1]:
print('Adding ' + j)
container = api.portal.get()
container = api.content.get(path=sub_path)
obj = api.content.create(type='Folder', title=j, container=container, path=sub_path)
# Commit the new object to the database...
transaction.commit()
api.content.transition(obj=obj, transition='submit')
api.content.transition(obj=obj, transition='publish')
transaction.commit()
Any idea what I might have done wrong?