OLD | NEW |
1 """distutils.command.register | 1 """distutils.command.register |
2 | 2 |
3 Implements the Distutils 'register' command (register with the repository). | 3 Implements the Distutils 'register' command (register with the repository). |
4 """ | 4 """ |
5 | 5 |
6 # created 2002/10/21, Richard Jones | 6 # created 2002/10/21, Richard Jones |
7 | 7 |
8 __revision__ = "$Id$" | 8 __revision__ = "$Id$" |
9 | 9 |
10 import urllib2 | 10 import urllib2 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 host = urlparse.urlparse(self.repository)[1] | 165 host = urlparse.urlparse(self.repository)[1] |
166 auth.add_password(self.realm, host, username, password) | 166 auth.add_password(self.realm, host, username, password) |
167 # send the info to the server and report the result | 167 # send the info to the server and report the result |
168 code, result = self.post_to_server(self.build_post_data('submit'), | 168 code, result = self.post_to_server(self.build_post_data('submit'), |
169 auth) | 169 auth) |
170 self.announce('Server response (%s): %s' % (code, result), | 170 self.announce('Server response (%s): %s' % (code, result), |
171 log.INFO) | 171 log.INFO) |
172 | 172 |
173 # possibly save the login | 173 # possibly save the login |
174 if code == 200: | 174 if code == 200: |
175 if self.has_config: | 175 # sharing credentials in the distribution instance |
176 # sharing the password in the distribution instance | 176 # so the upload command can reuse it |
177 # so the upload command can reuse it | 177 self.distribution.username = username |
178 self.distribution.password = password | 178 self.distribution.password = password |
179 else: | 179 if not self.has_config: |
180 self.announce(('I can store your PyPI login so future ' | 180 self.announce(('I can store your PyPI login so future ' |
181 'submissions will be faster.'), log.INFO) | 181 'submissions will be faster.'), log.INFO) |
182 self.announce('(the login will be stored in %s)' % \ | 182 self.announce('(the login will be stored in %s)' % \ |
183 self._get_rc_file(), log.INFO) | 183 self._get_rc_file(), log.INFO) |
184 choice = 'X' | 184 choice = 'X' |
185 while choice.lower() not in 'yn': | 185 while choice.lower() not in 'yn': |
186 choice = raw_input('Save your login (y/N)?') | 186 choice = raw_input('Save your login (y/N)?') |
187 if not choice: | 187 if not choice: |
188 choice = 'n' | 188 choice = 'n' |
189 if choice.lower() == 'y': | 189 if choice.lower() == 'y': |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 result = 500, str(e) | 298 result = 500, str(e) |
299 else: | 299 else: |
300 if self.show_response: | 300 if self.show_response: |
301 data = result.read() | 301 data = result.read() |
302 result = 200, 'OK' | 302 result = 200, 'OK' |
303 if self.show_response: | 303 if self.show_response: |
304 dashes = '-' * 75 | 304 dashes = '-' * 75 |
305 self.announce('%s%s%s' % (dashes, data, dashes)) | 305 self.announce('%s%s%s' % (dashes, data, dashes)) |
306 | 306 |
307 return result | 307 return result |
OLD | NEW |