Mercurial > kallithea
comparison kallithea/lib/middleware/pygrack.py @ 5374:d69aa464f373
cleanup: consistently use 'except ... as ...:'
Use the Python 2.6+ syntax instead of the old confusing 'except ..., ...'
syntax.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 09 Aug 2015 02:17:14 +0200 |
parents | 0e2d450feb03 |
children | 0210d0b769d4 |
comparison
equal
deleted
inserted
replaced
5373:e84c2738fbd8 | 5374:d69aa464f373 |
---|---|
87 log.debug('handling cmd %s', cmd) | 87 log.debug('handling cmd %s', cmd) |
88 try: | 88 try: |
89 out = subprocessio.SubprocessIOChunker(cmd, | 89 out = subprocessio.SubprocessIOChunker(cmd, |
90 starting_values=[packet_len + server_advert + '0000'] | 90 starting_values=[packet_len + server_advert + '0000'] |
91 ) | 91 ) |
92 except EnvironmentError, e: | 92 except EnvironmentError as e: |
93 log.error(traceback.format_exc()) | 93 log.error(traceback.format_exc()) |
94 raise exc.HTTPExpectationFailed() | 94 raise exc.HTTPExpectationFailed() |
95 resp = Response() | 95 resp = Response() |
96 resp.content_type = 'application/x-%s-advertisement' % str(git_command) | 96 resp.content_type = 'application/x-%s-advertisement' % str(git_command) |
97 resp.charset = None | 97 resp.charset = None |
127 cmd, | 127 cmd, |
128 inputstream=inputstream, | 128 inputstream=inputstream, |
129 env=gitenv, | 129 env=gitenv, |
130 cwd=self.content_path, | 130 cwd=self.content_path, |
131 ) | 131 ) |
132 except EnvironmentError, e: | 132 except EnvironmentError as e: |
133 log.error(traceback.format_exc()) | 133 log.error(traceback.format_exc()) |
134 raise exc.HTTPExpectationFailed() | 134 raise exc.HTTPExpectationFailed() |
135 | 135 |
136 if git_command in [u'git-receive-pack']: | 136 if git_command in [u'git-receive-pack']: |
137 # updating refs manually after each push. | 137 # updating refs manually after each push. |
155 app = self.inforefs | 155 app = self.inforefs |
156 elif [a for a in self.valid_accepts if a in request.accept]: | 156 elif [a for a in self.valid_accepts if a in request.accept]: |
157 app = self.backend | 157 app = self.backend |
158 try: | 158 try: |
159 resp = app(request, environ) | 159 resp = app(request, environ) |
160 except exc.HTTPException, e: | 160 except exc.HTTPException as e: |
161 resp = e | 161 resp = e |
162 log.error(traceback.format_exc()) | 162 log.error(traceback.format_exc()) |
163 except Exception, e: | 163 except Exception as e: |
164 log.error(traceback.format_exc()) | 164 log.error(traceback.format_exc()) |
165 resp = exc.HTTPInternalServerError() | 165 resp = exc.HTTPInternalServerError() |
166 return resp(environ, start_response) | 166 return resp(environ, start_response) |
167 | 167 |
168 | 168 |