Mercurial > kallithea
comparison rhodecode/controllers/api/__init__.py @ 3126:703070153bc1 beta
added API method for checking IP
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 31 Dec 2012 01:51:30 +0100 |
parents | 9b92cf5a0cca |
children | c5169e445fb8 |
comparison
equal
deleted
inserted
replaced
3125:9b92cf5a0cca | 3126:703070153bc1 |
---|---|
84 Sub-classes should catch their exceptions and raise JSONRPCError | 84 Sub-classes should catch their exceptions and raise JSONRPCError |
85 if they want to pass meaningful errors to the client. | 85 if they want to pass meaningful errors to the client. |
86 | 86 |
87 """ | 87 """ |
88 | 88 |
89 def _get_ip_addr(self, environ): | |
90 return _get_ip_addr(environ) | |
91 | |
89 def _get_method_args(self): | 92 def _get_method_args(self): |
90 """ | 93 """ |
91 Return `self._rpc_args` to dispatched controller method | 94 Return `self._rpc_args` to dispatched controller method |
92 chosen by __call__ | 95 chosen by __call__ |
93 """ | 96 """ |
97 """ | 100 """ |
98 Parse the request body as JSON, look up the method on the | 101 Parse the request body as JSON, look up the method on the |
99 controller and if it exists, dispatch to it. | 102 controller and if it exists, dispatch to it. |
100 """ | 103 """ |
101 start = time.time() | 104 start = time.time() |
102 ip_addr = self._get_ip_addr(environ) | 105 ip_addr = self.ip_addr = self._get_ip_addr(environ) |
103 self._req_id = None | 106 self._req_id = None |
104 if 'CONTENT_LENGTH' not in environ: | 107 if 'CONTENT_LENGTH' not in environ: |
105 log.debug("No Content-Length") | 108 log.debug("No Content-Length") |
106 return jsonrpc_error(retid=self._req_id, | 109 return jsonrpc_error(retid=self._req_id, |
107 message="No Content-Length in request") | 110 message="No Content-Length in request") |