Trevor Toenjes writes:
What am I doing wrong here?...I realize I am missing some fundamentals.
# getPrevious Script (Python) # # determine the position of the current object y=0 for o in context.objectIds(): y=y+1 if sequence-item currentPosition=y
## loop to the previousItem and get ID for o in context.objectIds(): if sequence-item == currentPosition-1 previousObject=sequence-item.id
return previousObject Lots of things!
Basic Python syntax errors: all compound statement headerlines end in ':', not only "for" but also "if" and "else" "sequence-item" is "sequence" minus "item". Usually, you have the following correspondence (very weak!): DTML: <dtml-in sequence> ... <dtml-var sequence-item> ... </dtml-in> Python Script: for item in sequence: ... item ... But this makes no sense with your code. You "o" is an "id". It does not make sense to have "if o:" nor "if o == cuttentPosition-1". You must carefully think again.... Dieter