## Script (Python) "validate_atct" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind state=state ##bind subpath=traverse_subpath ##parameters= ## errors = {} REQUEST = context.REQUEST title = REQUEST.get('title') desc = REQUEST.get('description') if REQUEST.get('form.button.getList'): return state.set(portal_status_message='') if not title: return state.set(status='failure', errors={}, portal_status_message='You didn\'t provide a title') service = REQUEST.get('photo_service') if service == 'flickr': album = REQUEST.get('album') if not album: return state.set(status='failure', errors={}, portal_status_message='You didn\'t choose a album') if service == 'nagi': url = context.absolute_url() + '/photoalbum_edit?service='+service+'&title='+title+'&desc='+desc nagi_uname = REQUEST.get('nagi_username') nagi_set_id = REQUEST.get('nagi_set_id') if not nagi_uname: url += '&nagi_set_id='+nagi_set_id state.setNextAction('redirect_to:string:%s'%url) return state.set(status='failure', errors={}, portal_status_message='You didn\'t provide nagi username') if not nagi_set_id: url += '&nagi_username='+nagi_uname state.setNextAction('redirect_to:string:%s'%url) return state.set(status='failure', errors={}, portal_status_message='You didn\'t provide nagi set id') return state.set(portal_status_message='Changes saved.')