'Constructor
@param label: the label
@param c: the controller
@param f: the function
@param args: the arguments list
@param vars: the variables Storage
@param extension: the request extension
@param a: the application (defaults to current.request.application)
@param r: the request to default to
@param m: the URL method (will be appended to args)
@param p: the method to check authorization for
(will not be appended to args)
@param t: the table concerned by this request
(overrides c_f for auth)
@param url: a URL to use instead of building one manually
- e.g. for external websites or mailto: links
@param tags: list of tags for this item
@param parent: the parent item
@param translate: translate the label
@param layout: the layout
@param check: a condition or list of conditions to automatically
enable/disable this item
@param restrict: restrict to roles (role UID or list of role UIDs)
@param link: item has its own URL
@param mandatory: item is always active
@param ltr: item is always rendered LTR
@param attributes: attributes to use in layout'

def __init__(self, label=None, c=None, f=None, args=None, vars=None, extension=None, a=None, r=None, m=None, p=None, t=None, url=None, tags=None, parent=None, translate=True, layout=None, check=None, restrict=None, link=True, mandatory=False, ltr=False, **attributes):

    if (isinstance(label, basestring) and translate):
        self.label = current.T(label)
    else:
        self.label = label
    if tags:
        if (type(tags) is not list):
            tags = [tags]
        self.tags = tags
    else:
        self.tags = []
    if (r is not None):
        self.r = r
        if (a is None):
            a = r.application
        if (c is None):
            c = r.controller
        if (f is None):
            f = r.function
        if (args is None):
            args = r.args
        if (vars is None):
            vars = r.vars
    else:
        self.r = current.request
    self.application = a
    if (isinstance(c, (list, tuple)) and len(c)):
        self.controller = c[0]
        self.match_controller = c
    else:
        self.controller = c
        self.match_controller = [c]
    if (isinstance(f, (list, tuple)) and len(f)):
        self.function = f[0]
        self.match_function = f
    else:
        self.function = f
        self.match_function = [f]
    if (args is None):
        args = []
    elif isinstance(args, str):
        args = args.split('/')
    self.args = args
    if vars:
        self.vars = vars
    else:
        self.vars = Storage()
    self.extension = extension
    self.tablename = t
    self.method = m
    if (m is not None):
        if (not len(args)):
            self.args = [m]
        elif (args[(-1)] != m):
            self.args.append(m)
    if (p is not None):
        self.p = p
    else:
        self.p = m
    self.override_url = url
    attr = Storage()
    opts = Storage()
    for (k, v) in attributes.iteritems():
        if (k[0] == '_'):
            attr[k] = v
        else:
            opts[k] = v
    self.attr = attr
    self.opts = opts
    self.parent = parent
    self.components = []
    self.enabled = True
    self.selected = None
    self.visible = None
    self.link = link
    self.mandatory = mandatory
    self.ltr = ltr
    self.restrict = restrict
    if (restrict is not None):
        if (not isinstance(restrict, (list, tuple))):
            self.restrict = [restrict]
    self.check = check
    renderer = None
    if (layout is not None):
        renderer = layout
    elif hasattr(self.__class__, 'OVERRIDE'):
        renderer = self.get_layout(self.OVERRIDE)
    if ((renderer is None) and hasattr(self.__class__, 'layout')):
        renderer = self.layout
    self.renderer = renderer
