Did I find the right examples for you? yes no

All Samples(148)  |  Call(96)  |  Derive(0)  |  Import(52)
Returns the Routes RequestConfig object.

To get the Routes RequestConfig:

>>> from routes import *
>>> config = request_config()

The following attributes must be set on the config object every request:

mapper(more...)

        def request_config(original=False):
    """
    Returns the Routes RequestConfig object.
    
    To get the Routes RequestConfig:
    
    >>> from routes import *
    >>> config = request_config()
    
    The following attributes must be set on the config object every request:
    
    mapper
        mapper should be a Mapper instance thats ready for use
    host
        host is the hostname of the webapp
    protocol
        protocol is the protocol of the current request
    mapper_dict
        mapper_dict should be the dict returned by mapper.match()
    redirect
        redirect should be a function that issues a redirect, 
        and takes a url as the sole argument
    prefix (optional)
        Set if the application is moved under a URL prefix. Prefix
        will be stripped before matching, and prepended on generation
    environ (optional)
        Set to the WSGI environ for automatic prefix support if the
        webapp is underneath a 'SCRIPT_NAME'
        
        Setting the environ will use information in environ to try and
        populate the host/protocol/mapper_dict options if you've already
        set a mapper.
    
    **Using your own requst local**
    
    If you have your own request local object that you'd like to use instead 
    of the default thread local provided by Routes, you can configure Routes 
    to use it::
        
        from routes import request_config()
        config = request_config()
        if hasattr(config, 'using_request_local'):
            config.request_local = YourLocalCallable
            config = request_config()
    
    Once you have configured request_config, its advisable you retrieve it 
    again to get the object you wanted. The variable you assign to 
    request_local is assumed to be a callable that will get the local config 
    object you wish.
    
    This example tests for the presence of the 'using_request_local' attribute
    which will be present if you haven't assigned it yet. This way you can 
    avoid repeat assignments of the request specific callable.
    
    Should you want the original object, perhaps to change the callable its 
    using or stop this behavior, call request_config(original=True).
    """
    obj = _RequestConfig()
    try:
        if obj.request_local and original is False:
            return getattr(obj, 'request_local')()
    except AttributeError:
        obj.request_local = False
        obj.using_request_local = False
    return _RequestConfig()
        


src/t/w/twMaps-0.1a0.dev-r720/twMapsSampleAppPylons/twmapssampleapppylons/tests/__init__.py   twMaps(Download)
 
from twmapssampleapppylons.config.routing import *
from routes import request_config, url_for
 
test_file = os.path.join(conf_dir, 'test.ini')

src/r/u/rum-0.4dev-20110726/rum/router.py   rum(Download)
    def request_config(self):
        config = routes.request_config()
        config_mapper = config.mapper
        assert config_mapper is self.mapper, "Router has not been activaed!"
        return config
 
    def activate(self, app=None):
        config = routes.request_config()
            request_local = _RumReqLocal()
            config.request_local = lambda: request_local
            config = routes.request_config()
            config.mapper = self.mapper
        return config
 
    def deactivate(self, app=None):
        orig_config = routes.request_config(original=True)

src/p/y/pybald-0.2.6/pybald/core/router.py   pybald(Download)
import re
from webob import Request, Response, exc
from routes import Mapper, request_config, URLGenerator
# handle Mako's top level lookup
from mako import exceptions
 
        url = URLGenerator(self.map, environ)
        config = request_config()
 
        # Your mapper object

src/s/k/skunk.web-4.0.0a2dev-r227/src/skunk/web/routing.py   skunk.web(Download)
import httplib
 
from routes import request_config
import routes.middleware
 
    map.create_regs(list(Configuration.controllers))
    context.routes_mapper=map
    request_config().redirect=_redirect
 
# initial the mapper in the context middleware

src/k/f/kforge-0.20/src/kforge/url.py   kforge(Download)
    def url_for(self, *args, **kwargs):
        # have to set up request_config as url_for uses it ...
        # have to set it here as it must be set on each request
        # o/w get exceptions talking about thread local issues
        config = routes.request_config()

src/c/o/consent-0.6/src/consent/url.py   consent(Download)
    def url_for(self, *args, **kwargs):
        # have to set up request_config as url_for uses it ...
        # have to set it here as it must be set on each request
        # o/w get exceptions talking about thread local issues
        config = routes.request_config()

src/d/r/drydrop-HEAD/dryapp/routes/util.py   drydrop(Download)
import re
import urllib
from routes import request_config
 
def _screenargs(kargs):
    This is responsible for the requests "memory" of the current.
    """
    config = request_config()
 
    # Coerce any unicode args with the encoding
        if kargs.has_key(key+'_'):
            kargs[key] = kargs.pop(key+'_')
    config = request_config()
    route = None
    static = False
    """
    target = url_for(*args, **kargs)
    config = request_config()
    return config.redirect(target)
 

src/g/i/gibe-0.12.4/gibe/controllers.py   gibe(Download)
        proto = d['protocol']
 
        config = routes.request_config()
        config.mapper = self._mapper
        host = cherrypy.config.get('gibe.hostname', host)

src/b/i/biosqlweb-HEAD/app/lib/python/routes/util.py   biosqlweb(Download)
import re
import urllib
from routes import request_config
 
 
        if kargs.has_key(key+'_'):
            kargs[key] = kargs.pop(key+'_')
    config = request_config()
    route = None
    static = False
    """
    target = url_for(*args, **kargs)
    config = request_config()
    return config.redirect(target)
 

src/r/o/Routes-2.0/routes/util.py   Routes(Download)
import re
import urllib
from routes import request_config
 
 
        if kargs.get(key):
            del kargs[key]
    config = request_config()
    route = None
    static = False
    """
    target = url_for(*args, **kargs)
    config = request_config()
    return config.redirect(target)
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next