Ok, I’m fed up. Here’s the first of a series of Pearls from the Plone Source. Call it The Plone WTF if you like.
Here goes, a loop that does nothing. Notice the ‘locking_info’ adapter is fetched outside the for loop:
for action in workflowActions:
if action[‘category’] != ‘workflow’:
continuelocking_info = queryMultiAdapter((context, request), name=’plone_lock_info’)
And then a few lines below, the same loop repeats, this time it is doing something. The ‘actionUrl’ variable is assigned inside the for loop:
if locking_info and locking_info.is_locked_for_current_user():
return []for action in workflowActions:
if action[‘category’] != ‘workflow’:
continue
actionUrl = action[‘url’]
Sad. I don’t think anyone is really reviewing this code….