University Marketing & Communications

September 1, 2010

List Items in an ATFolder


This was originally posted on Chris Heiland’s staff blog while he was a member of the Web Team. Chris migrated this post to the Web Team blog before he left because we thought the content still had value to the UW community.

I was updating a test due to a recent migration for a content type. The previous was based on an ATBTreeFolder while the new inherits from an ATFolder. I was getting a test failure and couldn’t narrow it down to what was going on. I’m still unsure if this is a bug and where to even report it. Also, since Plone 4 has completely changed the folder implementation it’s probably not something to worry about.

However, if you are running plone 3.3.5 and see this problem, then here is a problem description.

The problem comes with the workflow.listActions() method when testing if a folder has the proper workflow actions associated with it.  Workflow actions listed under the actions menu such as ‘publish’,’retract’ which one would expected to change depending on the state of the object.

The problem comes in when issuing that command on an ATFolder in a non-published state. In this case you will get the following:

AttributeError: portal_url

Now this is strange because we expect to get a list of workflow actions. When issued on a published ATFolder or a ATBTreeFolder in either published or private state then it works as expected.  I’m still not sure exactly which component was throwing the error. In my case it was acceptable to change the test to point to another object in the system that behaves as expected.

This is not a great solution because it’s more of a workaround but in this case it did make sense.