Exemplo n.º 1
0
    def __before__(self, action, **params):
        c.time_call_started = datetime.now()

        # what is different between session['user'] and environ['REMOTE_USER']
        c.__version__ = ckan.__version__
        c.user = request.environ.get('REMOTE_USER', None)
        c.remote_addr = request.environ.get('REMOTE_ADDR', 'Unknown IP Address')
        if c.remote_addr == 'localhost' or c.remote_addr == '127.0.0.1':
            # see if it was proxied
            c.remote_addr = request.environ.get('HTTP_X_FORWARDED_FOR',
                    '127.0.0.1')
        if c.user:
            c.user = c.user.decode('utf8')
            c.author = c.user
        else:
            c.author = c.remote_addr
        c.author = unicode(c.author)
        i18n.handle_request(request, c)
Exemplo n.º 2
0
 def __before__(self, action, **params):
     c.__version__ = ckan.__version__
     self._identify_user()
     i18n.handle_request(request, c)