def __init__(self, object_id, status, context_type, button, controller=None): object_id = object_id.strip() if controller: s = controller._checkId(object_id) if s: raise ValueError, 'Illegal template id: %s' % s status = status.strip() if not status: raise ValueError, 'Illegal status %s' % (status) if not context_type: context_type = ANY_CONTEXT if button is not None: button = button.strip() if not button: button = ANY_BUTTON Key.__init__(self, (object_id, status, context_type, button))
def __init__(self, object_id, context_type, button, controller=None): object_id = object_id.strip() if controller: path_elements = object_id.split('/') for p in path_elements: s = controller._checkId(p) if s: raise ValueError, 'Illegal template id: %s' % s if not context_type: context_type = ANY_CONTEXT if button is not None: button = button.strip() if not button: button = ANY_BUTTON Key.__init__(self, (object_id, context_type, button))