## 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 if REQUEST.get('form.button.Remove'): found = 0 for x in REQUEST.form.keys(): if x.startswith('link_'): found = 1 break if not found: return state.set(status='failure', errors={}, portal_status_message='Select link(s) to remove from blogroll.') return state.set(portal_status_message='message') title = REQUEST.get('new_title') link = REQUEST.get('new_link') if not title: return state.set(status='failure', errors={}, portal_status_message='You didn\'t provide a title') if not link: return state.set(status='failure', errors={}, portal_status_message='You didn\'t provide a link') if not link.startswith('http://'): return state.set(status='failure', errors={}, portal_status_message='Links have to start with http://') if len(link)<8: return state.set(status='failure', errors={}, portal_status_message='Link too short.') return state.set(portal_status_message='message')