Logo Search packages:      
Sourcecode: zine version File versions  Download package

def zine::application::Zine::add_url_rule (   self,
  rule,
  kwargs 
)

Add a new URL rule to the url map.  This function accepts the same
arguments as a werkzeug routing rule.  Additionally a `prefix`
parameter is accepted that can be used to add the common prefixes
based on the configuration.  Basically the following two calls
do exactly the same::

    app.add_url_rule('/foo', prefix='admin', ...)
    app.add_url_rule(app.cfg['admin_url_prefix'] + '/foo', ...)

It also takes a `view` keyword argument that, if given registers
a view for the url view::

    app.add_url_rule(..., endpoint='bar', view=bar)

is equivalent to::

    app.add_url_rule(..., endpoint='bar')
    app.add_view('bar', bar)

Definition at line 955 of file application.py.

00955                                           :
        """Add a new URL rule to the url map.  This function accepts the same
        arguments as a werkzeug routing rule.  Additionally a `prefix`
        parameter is accepted that can be used to add the common prefixes
        based on the configuration.  Basically the following two calls
        do exactly the same::

            app.add_url_rule('/foo', prefix='admin', ...)
            app.add_url_rule(app.cfg['admin_url_prefix'] + '/foo', ...)

        It also takes a `view` keyword argument that, if given registers
        a view for the url view::

            app.add_url_rule(..., endpoint='bar', view=bar)

        is equivalent to::

            app.add_url_rule(..., endpoint='bar')
            app.add_view('bar', bar)
        """
        prefix = kwargs.pop('prefix', None)
        if prefix is not None:
            rule = self.cfg[prefix + '_url_prefix'] + rule
        view = kwargs.pop('view', None)
        self._url_rules.append(routing.Rule(rule, **kwargs))
        if view is not None:
            self.views[kwargs['endpoint']] = view

    @setuponly
    def add_absolute_url(self, handler):


Generated by  Doxygen 1.6.0   Back to index